Page MenuHome

Implement an Armature constraint that mimics the modifier.

Authored by Alexander Gavrilov (angavrilov) on Aug 30 2018, 9:38 PM.



The main use one can imagine for this is adding tweak controls to
parts of a model that are already deformed by multiple other major
bones. It is natural to expect such locations to deform as if the
tweaks aren't there by default; however currently there is no easy
way to make a bone follow multiple other bones.

This adds a new constraint that implements the math behind the Armature
modifier, with support for explicit weights, bone envelopes, and dual
quaternion blending. It can also access bones from multiple armatures
at the same time (mainly because it's easier to code it that way.)

Diff Detail

rB Blender

Event Timeline

Rebased and fixed a couple of UI problems.


Just do if not con.targets: avoids counting items in the list.


Rather commit this separate with explanation of what it improves.


If this isn't saved/restored in DNA, prefer add a bConstraintTarget_Runtime struct which can have an owner.

Also note that it's questionable if we should even have this, such pointers can easily become invalid. There are many other planes in RNA that similar pointers would be convenient, but we've avoided it because keeping them valid is a hassle.

Removed owner and other tweaks.

Alexander Gavrilov (angavrilov) marked 2 inline comments as done.Nov 2 2018, 5:27 PM
Alexander Gavrilov (angavrilov) added inline comments.

This function was unused before, and the result was plain wrong compared to mul_v3m3_dq that is used to transform vertex coordinates in the modifier. These are minimal changes needed to make it match.

Generally seems fine from code perspective, would like if riggers could give feedback on these kinds of features.


Prefer: *list = data->targets;


Prefer return args use explicit r_ prefix. See:


Second arc can be be true/false.

Alexander Gavrilov (angavrilov) marked 3 inline comments as done.Nov 5 2018, 6:54 AM

Generally seems fine from code perspective, would like if riggers could give feedback on these kinds of features.

I think this is simply necessary, given the complexity of the alternatives to achieve the same effect:

  • Using the Armature modifier itself, you need:
    1. Specialized mesh so the bone can be parented to 3 appropriately placed vertices.
    2. Slave armature that includes copies of only the 'parent' bones with Copy Transforms, to break the dependency cycle due to Armature modifier depending on all bones.
  • If precise result is not required, you still need one copy of the 'child' per 'parent' to blend transformations with Copy Transforms.

Both approaches need many bones, and advanced rigging skills.

This revision is now accepted and ready to land.Nov 6 2018, 8:48 AM
This revision was automatically updated to reflect the committed changes.