I'd like to set keyframes for the changed attributes of an object using scripting.
How should I go about doing this?
Here are the two approaches I've tried:
- Just going for the position, I tried turning on Autokeying and then using
SetMl()with the Matrix but it did not create a keyframe (even with animation track with keyframes).
- I then tried using the BaseDocument.AutoKey method, but could not understand how it works.
obj = doc.GetActiveObject() doc.AddUndo(c4d.UNDOTYPE_CHANGE,obj) obj.SetMl(myMatrix) # Should this be turning Autokeying on for this object? Am I using undo correctly with this? # There are no examples I could find on this forum, in the documentation, or online. doc.AutoKey(obj, obj, recursive=True, pos=True, scale=True, rot=True, param=True, pla=False) c4d.EventAdd()
- Can I access/change the Document's Autokeying settings with code? (e.g. turning on/off Position for recording)
Setting Attributes One-by-One
If Autokeying isn't an option, I could get all of the Desc IDs for the attributes and set keys manually, which is probably what will need to happen, but I didn't know if there was a faster, more flexible way.