THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 30/01/2011 at 10:23, xxxxxxxx wrote:
In case it isn't clear what I'm trying to do :
My code should do the same as highlighting the object's parameter in the attribute manager, right clicking for menu and choosing Animation > Add Keyframe Selection. This makes the parameter turn orange and now when the 'set key' button is pressed with the object selected, only these highlighted parameters are keyframed.
This is useful to avoid generating unnecessesary keyframes on tracks you don't want to key, for example no point generating scale keys on a character's foot controller. It's also useful to make sure that user data or particular parameters are keyed along with position, rotation etc.
According to the python documents, you can do this in code by using the BaseList2D.SetKeyframeSelection() method.
The first argument you supply is the DescID of the parameter whose KeyframeSelection state you want to change and the second argument you supply is if it is in the Keyframe selection or not, using 0 for 'is not' and 1 for 'is'.
So the code :
id = c4d.DescID(c4d.ID_BASEOBJECT_VISIBILITY_EDITOR)
sets the object's 'Visibile in editor' parameter as part of the KeyframeSelection
but when I try to do the same for the object's position parameter :
id = c4d.DescID(c4d.ID_BASEOBJECT_REL_POSITION)
it doesn't work, the writing doesn't turn orange and position is not keyed when the 'set key' button is pressed. The same happens with any parameter in the 'Coord.' tab.
So either I need to use different syntax for these parameters, or there is a bug in this method.
Hope that explains it better.
Another user noted that it isn't working in C++ either, here's his code:
BaseObject *myObject = doc->GetFirstObject();
myObject->SetKeyframeSelection(ID_BASEOBJECT_VISIBILITY_EDIT OR,1); // This works fine
myObject->SetKeyframeSelection(#ID_BASEOBJECT_REL_POSITION,1 ); // This DOES NOT work!!