Setting animation keys to linear pymxs

Setting animation keys to linear pymxs

Fauns
Explorer Explorer
1,516 Views
3 Replies
Message 1 of 4

Setting animation keys to linear pymxs

Fauns
Explorer
Explorer

Hello everyone,

i'm creating an animation in code with pymxs:

with pymxs.animate(True):
    with pymxs.attime(0):
        objGrp.rotation = rt.eulerToQuat(rt.eulerAngles(0,0,0))
        objGrp.pos = pos
    with pymxs.attime(self.animTime/3):
        objGrp.rotation = rt.eulerToQuat(rt.eulerAngles(0,0,120))
        objGrp.pos = pos
    with pymxs.attime(self.animTime*2/3):
        objGrp.rotation = rt.eulerToQuat(rt.eulerAngles(0,0,240))
        objGrp.pos = pos
    with pymxs.attime(self.animTime):
        objGrp.rotation = rt.eulerToQuat(rt.eulerAngles(0,0,360))
        objGrp.pos = pos

 This works fine! But i need my animation key tangents to be linear and not smoothed (which they are by default) and i can't for the life of me find the way to do this due to the absolute absence of documentation for the API.

 

I'd appreciate help toward achieving this, thank you 🙂

0 Likes
1,517 Views
3 Replies
Replies (3)
Message 2 of 4

denisT.MaxDoctor
Advisor
Advisor

instread of changing rotation key types change whole Euler_XYZ leaf controller from Bezier_Float to Linear_Float

 

or whole Euler_XYZ to Linear_Rotation 

0 Likes
Message 3 of 4

denisT.MaxDoctor
Advisor
Advisor

another solution is to change default tangents for new keys:

 

maxops.getDefaultTangentType &inTangent &outTangent
maxops.setDefaultTangentType #linear #linear

with animate on for t=0 to 100 by 10 do at time t $.rotation = eulerangles (random 0 180) (random 0 180) (random 0 180)

maxops.setDefaultTangentType inTangent outTangent

 

PS. I would simple use Linear_Float controllers

 

0 Likes
Message 4 of 4

chadwilliamson1
Observer
Observer

Thank you so much for this maxops post.  I've been trying all kinds of things to get linear keys, and I can't believe it's one line!  🙂 

0 Likes