How to apply a transform to all keyframes of an object?

How to apply a transform to all keyframes of an object?

Anonymous
Not applicable
3,510 Views
8 Replies
Message 1 of 9

How to apply a transform to all keyframes of an object?

Anonymous
Not applicable

I have an object with a bunch of keyframes already on it.  I need to move and rotate the whole thing.  How can I do that?  Grouping it (in two groups, one for the translation and one for the rotation) works, but I need the final result to be a single object when I export, not a nest of groups.

 

I tried animation layers (because that exports a single object) but cannot get the transform I want (a move and then a rotate) to work correctly with them.

 

I got the transform I want by grouping my object and rotating, and then grouping THAT and moving.  So I have a group like this:

 

Group (with rotation applied)

   Group (with movement applied)

       Object (with a bunch of keyframes)

 

To export my object I need to just have the object without the groups.  I can ungroup the Object to world, and tell it to preserve its position, and that works for the object itself, but it ignores the keyframes.

 

I feel like if I could apply a transform to each keyframe, then I could save off the transform of the object within the heirarchy and apply it to each keyframe.

 

Anyone know how to do that?  I'm sorry if my explanation is unclear.

Thanks

 

0 Likes
Accepted solutions (1)
3,511 Views
8 Replies
Replies (8)
Message 2 of 9

mcw0
Advisor
Advisor
Accepted solution

Sounds like what you want is to bake the animation.  Make a duplicate of your object without the groups.  Transfer your animation to the duplicate and create the groups and transforms that gets you what you want.  Now, parent constrain your original object (now with no animation) to your duplicate.  And bake the animation.  Once baked, you can delete the transform groups that has your duplicate.

0 Likes
Message 3 of 9

Anonymous
Not applicable

Thanks for the reply.  I will try that, though I don't yet know how to do half of what you describe.  What is the purpose of all the duplicating and constraining?  My "object" is actually a skeleton with a heirarchy of children, each with their own animation.  Will what you describe work for that?  Also - when you say Bake the Animation, do I do that on the grouped duplicate or the original object?

0 Likes
Message 4 of 9

mcw0
Advisor
Advisor

If there's animation on the root of your skeleton, then baking the root will take care of everything.  Since you want to calculate the new position of the root in world space based on some additional transforms (rotation and translation of your groups), one way is to do as I described.  Another way would be to use the new offset parent matrix feature in Maya2020...that's assuming you are in Maya2020 and later.  But since I don't know which version of Maya you are in, baking works for all versions.

The reason for the duplicating is so that you leave your root node in the space you want it in...in your case, world space.  Not parented under additional groups.  So to achieve this, you need a duplicate node to carry your animation from the root.  And to place that under the groups.  The constraint is an easy way to convert the result to world space.  I hope that makes sense.

0 Likes
Message 5 of 9

Anonymous
Not applicable

I do have 2020.  I think I can use the Parent Offset Matrix to get what I want - but can those values be set in MEL?  When I change the values in the editor, I don't see anything printed to the script window...

0 Likes
Message 6 of 9

mcw0
Advisor
Advisor

Do you have "echo all commands" checked?  It's under the "History" menu.  It's an attribute like any other so setAttr will work.

Message 7 of 9

Anonymous
Not applicable
I struggled with this all yesterday and am going back to try this first solution again. Can you tell me, how do I transfer the animation to the duplicate?
0 Likes
Message 8 of 9

mcw0
Advisor
Advisor

Edit -> Keys -> Copy Keys and Paste Keys

0 Likes
Message 9 of 9

Anonymous
Not applicable

Finally got this working last night, and from a Mel script too.  Thanks for the help!

0 Likes