chib
03-17-2010, 12:39 PM
...I didn't manage to do so...
I'd like to modify all tangents of an object's keys at a time t by script, in order to avoid having to do so in the trackview, but I got stuck in various problems:
1) there is apparently no Nested Object Controller Functions to do that (that's a few functions that act on all controllers of an object at once... but they are so... few...).
2) so I tried to do my own function to do that, but I got so many problems with all the different controllers: my idea was pretty simple (at the beginning): it was to select all the keys of a controller, modify their tangents eventually, and then collect all the sub-controllers of this first controller, and apply it this function recursively... something like that:
function setTangents2Custom ctrl =
(
/* the part where I modify the keys (didn't write it now) */
subCtrlList = getPropNames ctrl -- I collect all the properties of the controller
for subCtrlName in subCtrlList do
(
subCtrl = getproperty ctrl subCtrlName -- actually it doesn't get the sub controller, like I'd like it to do, but only the value of the property :(
setTangents2Custom subCtrl -- I use the function on the new controller
)
)
the main problem is that getPropNames, as its name tells, collects all the properties, and it doesn't include only keyable properties (ex: on a lookAt() you have a .Flip property that is a boolean at first) and Max will fall in error if I try to call their ".controller" property...
the other problem is that "getProperty ctrl subCtrlName" doesn't return the property's controller, but the value of the property (a point 3, a float, etc...), and I didn't manage to extract the controller of a property only with it's name.
So I'd be very grateful if someone has some tips about manipulating keys in mxs :)
Paul
I'd like to modify all tangents of an object's keys at a time t by script, in order to avoid having to do so in the trackview, but I got stuck in various problems:
1) there is apparently no Nested Object Controller Functions to do that (that's a few functions that act on all controllers of an object at once... but they are so... few...).
2) so I tried to do my own function to do that, but I got so many problems with all the different controllers: my idea was pretty simple (at the beginning): it was to select all the keys of a controller, modify their tangents eventually, and then collect all the sub-controllers of this first controller, and apply it this function recursively... something like that:
function setTangents2Custom ctrl =
(
/* the part where I modify the keys (didn't write it now) */
subCtrlList = getPropNames ctrl -- I collect all the properties of the controller
for subCtrlName in subCtrlList do
(
subCtrl = getproperty ctrl subCtrlName -- actually it doesn't get the sub controller, like I'd like it to do, but only the value of the property :(
setTangents2Custom subCtrl -- I use the function on the new controller
)
)
the main problem is that getPropNames, as its name tells, collects all the properties, and it doesn't include only keyable properties (ex: on a lookAt() you have a .Flip property that is a boolean at first) and Max will fall in error if I try to call their ".controller" property...
the other problem is that "getProperty ctrl subCtrlName" doesn't return the property's controller, but the value of the property (a point 3, a float, etc...), and I didn't manage to extract the controller of a property only with it's name.
So I'd be very grateful if someone has some tips about manipulating keys in mxs :)
Paul
