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

01 January 2009, 03: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 ?


01 January 2009, 01: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

01 January 2009, 11:07 PM

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))
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!

01 January 2009, 01: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 January 2009, 01: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.