Implement an Armature constraint that mimics the modifier.
ClosedPublic

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

Details

Summary

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

Repository
rB Blender

Rebased and fixed a couple of UI problems.

release/scripts/startup/bl_ui/properties_constraint.py
927

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

source/blender/blenlib/intern/math_rotation.c
1874–1889

Rather commit this separate with explanation of what it improves.

source/blender/makesdna/DNA_constraint_types.h
100

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.Fri, Nov 2, 5:27 PM
Alexander Gavrilov (angavrilov) added inline comments.
source/blender/blenlib/intern/math_rotation.c
1874–1889

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.

source/blender/blenkernel/intern/constraint.c
2124–2125

Prefer: *list = data->targets;

2164

Prefer return args use explicit r_ prefix. See: https://wiki.blender.org/wiki/Source/Code_Style#Return_arguments

2199–2200

Second arc can be be true/false.

Alexander Gavrilov (angavrilov) marked 3 inline comments as done.Mon, Nov 5, 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.Tue, Nov 6, 8:48 AM
This revision was automatically updated to reflect the committed changes.