0
$\begingroup$

Is there any simple way to change bones hierarchy maintaining animations unaltered?

As far as I know, bone keyframes transforms are relative to its parent. This way, if a bone changes its parent (in edit mode), pre-existing animation will get messed up because blender maintaining the keyframe values.

I strongly think that blender should update keyframe values to adapt to the new parent, maintaining its final transform. Like the "maintain transform" option when parenting or unparenting objects.

Is there a way to do it with animations?

$\endgroup$
4
  • 2
    $\begingroup$ As far as I know, you would have to write a script to do this. $\endgroup$ Dec 18, 2021 at 1:08
  • $\begingroup$ Define "simple". You can use copy transforms constraints (and then bake action) to copy animations from one rig to another. $\endgroup$
    – Nathan
    Dec 19, 2021 at 17:16
  • $\begingroup$ You basically have to somehow bake and store the world-space-animation somewhere, then change the hierarchy, and then paste the word-space-animation. This isn't "simple" in the background, although it could be made simple on the user-side. Some scripts and addons can do this, but there is no tools to do this out of the box AFAIK. But the new addon planned for Blender 3.1 might be able to do that. $\endgroup$
    – L0Lock
    Dec 20, 2021 at 16:35
  • $\begingroup$ Yes. this is not a complex operation, a multiplication of a couple of matrixes, but strangely it is not implemented in Blender out of the box. Seems like Blender is ment for a restricted "rig -> animation" workflow, lacking flexibility for in-beteween operations. That addon seems promising! Thanks for you answer. $\endgroup$
    – user138436
    Feb 23, 2022 at 0:22

1 Answer 1

0
$\begingroup$

I don't know if this is simple enough for you, but this is how you can do it:

Say we start with this:

enter image description here

We have an animated armature, and an armature with a different hierarchy, but with a correspondence between bones. In this case, I've named the original bones "old1" and "old2" while I've named the new bones "new1" and "new2". Note that the numbers represent the correspondence to the old hierarchy: new1 is the child of new2. Importantly, none of the bones in the new armature have the same exact name as the bones in the old armature, which will be important when we join the armatures:

enter image description here

I've created a copy of our new armature, joined it to the old armature, and assigned the bones from the new armature to new parents. Notice the outliner: new1 is parented to old1, and new2 is parented to old2.

Now let's make some constraints for bones in our new armature:

enter image description here

Each bone in our new armature gets a copy transforms constraint targeting the corresponding copy in the old armature. In this case, I've made these constraints operate in pose->pose space; if the armatures were in the same location, I would have used world->world which is fewer clicks, but I need to keep the armatures in different places so you can continue to see what's going on. Next we use a "bake action" operation on our new armature:

enter image description here

I've run a Bake Action with visual keying and clear constraints. That writes the transform of the constraint into the f-curve of the animation. At this point, we can play our animations side-by-side and see that they are identical.

Notice the graph editor. I started with two keyframes; now I have a keyframe for every single frame! Is that really necessary? Unfortunately, yes, it is. Interpolation between keyframes depends on the hierarchy. Consider our new2 bone. Its head is no longer being rotated by anything, so its transform requires position. But that position needs to move through the arc described by the tail of old2. So we can't represent that position with only 2 keyframes the way that we can describe the rotation of old2 with only 2 keyframes. Although in this case, we could still get awfully close by adjusting the handles; we could follow this up with a clean keyframes operation if we really need to. Not all situations will be so simple to manage though.

Notice that a lot of this could be simplified dramatically with scripting. If we use names to indicate correspondences, scripts could use those names to create the parenting and constraint relationships. I would expect somebody, somewhere, to have made an addon or script that does this automatically. However, I'm not personally aware of any.

$\endgroup$
3
  • $\begingroup$ Thanks. As you notice, this is simple enough for small cases but it is not for complex rigs and animations. In fact animations get modified because they create a lot more keyframes. Blender seems to be made for a "rigging -> animating" order strictly, lacking flexibility for in-between rig modifications. Thanks again, it seems to be a World-space animation add-on planned for Blender 3.1. I will get into scripting also. $\endgroup$
    – user138436
    Feb 23, 2022 at 0:14
  • $\begingroup$ @user138436 You cannot do this without adding more keyframes. The interpolation is not the same, as I explained. $\endgroup$
    – Nathan
    Feb 23, 2022 at 0:31
  • $\begingroup$ Maybe, but the point is getting the same key frames. This is, just transforming each key-frame bone pose to world space then applying back the local transform respect to the new bone properties (parent, scale, translation, rotation). $\endgroup$
    – user138436
    Feb 23, 2022 at 2:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .