PDA

View Full Version : How can I change the tangent type with maxscript?


daaz
01-08-2009, 02:51 PM
I would like to change the tangent type of a selected key. The controller is a position xyz.

The script will create a key, select it and change the tangent type to constant.

This is what I got now: c = $.pos.controller[2]
k = addNewKey c currentTime #select
k.outTangentType = #step

The bold line doesn't work, does anybody know why ?

Thanks!

RodBiffi
01-09-2009, 12:26 AM
Just make another assignment of the Key and configure it:

...
k = c.keys[1] -- replace "1" for the keyframes' index in the controller.
k.outTangentType = #step

daaz
01-12-2009, 10:07 PM
Thanks!

Your help has been helpful but I'm still having a problem. I want to change the tangent of a key for which I dont know the time.

Knowing the keys[x] select the x'th key I have adjusted my script like this

c = $.pos.controller[2]
k = addNewKey c currentTime
selectKeys c 0 currentTime
n = numSelKeys c ((-- No ""numSelKeys"" function for SubAnim:Zero_Pos_XYZ))
c.keys[n]
k.outTangentType = #step

Do you know why the numSelKeys doesn't work, or do you know an other way to select a key at the current time and change the tangent?

Thx again!

JayG
01-13-2009, 12:48 AM
What's the actual error you're getting?

You're probably trying to move forward with an undefined "k", as RodBiffi suggested.

Also, are you trying to set all keys on c to stepped at the currentTime, or just the new/selected key?

CGTalk Moderation
01-13-2009, 12:48 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.