Notifications
Clear all

[Closed] adding keys

hi, I’m new to maxscript and i’ve this problem:
I’ve an object with position constraint and some target, so when i press a button I need to addkey to every weight. I found in the reference the “AddNewKey” but when I use it in this way:

addnewkey $.pos.controller.weight[1] currenttime

it returns undefined. where’s the mistake? it’s not a controller? for example if I wire weight to another track I can use addnewkey.

1 Reply
 JHN

try

addnewkey $.pos.controller[1].controller currenttime

Be aware that by default there is no controller available to weight tracks, you’ll have to assign them first before creating keys

$.pos.controller[1].controller = bezier_float()

You were accessing a property of the controller containing the results of the weight controller, not the controller itself.

Also check out the interfaces available

showinterfaces $.pos.controller
Methods:
<index>getNumTargets()
<node>getNode <index>nodeNumber
<float>getWeight <index>targetNumber
<boolean>setWeight <index>targetNumber <float>weight
<boolean>appendTarget <node>target <float>weight
<boolean>deleteTarget <index>targetNumber

Maybe something in there you can use,

-Johan