Fix T74483: Rigify Meta-Human Neck Bone stretching.

This implements Ivan's suggestion: all the constraints on
spine bones have to be moved from ORG to its DEF bone. All
the spine ORG-bones have to be unconnected-children of their
corresponding tweak.

This is actually how chain rigs work in my own Rigify feature set,
so as far as I'm concerned this is a tried and viable solution.
The result is that, if you want to parent something to your chain
rig, you can do it in two ways: If you parent it to the ORG bone
(ie. by default), it will not inherit any squash and stretch induced
by the "tweak" bones. If you parent it to the DEF bone however,
it will behave the same as before.

This raises a backwards compatibility concern; If you want the old
behavior, you have to express that in your metarig explicitly, by
parenting your bone to the DEF bone in some way. This patch also
only affects the spine rig, which makes it inconsistent with other
chain rigs in Rigify in this regard.

Maniphest Tasks: T74483

Differential Revision: https://developer.blender.org/D7801
This commit is contained in:
Demeter Dzadik 2020-06-09 17:20:46 +03:00 committed by Alexander Gavrilov
parent 084eec3697
commit ba2521b7ed
Notes: blender-bot 2023-02-14 19:00:01 +01:00
Referenced by issue #91474, Rigify - new setup for connected neck & spine (Bug or a Feature?)
Referenced by issue #74483, Rigify Meta-Human Neck Bone stretching
1 changed files with 26 additions and 0 deletions

View File

@ -128,6 +128,20 @@ class BaseSpineRig(TweakChainRig):
set_bone_widget_transform(self.obj, master, self.get_master_control_output())
create_cube_widget(self.obj, master, radius=0.5)
####################################################
# ORG bones
@stage.parent_bones
def parent_org_chain(self):
ctrl = self.bones.ctrl
org = self.bones.org
for tweak, org in zip(ctrl.tweak, org):
self.set_bone_parent(org, tweak)
def rig_org_bone(self, i, org, tweak, next_tweak):
# For spine rigs, these constraints go on the deform bones. See T74483#902192.
pass
####################################################
# Tweak bones
@ -140,6 +154,18 @@ class BaseSpineRig(TweakChainRig):
####################################################
# Deform bones
@stage.rig_bones
def rig_deform_chain(self):
tweaks = self.bones.ctrl.tweak
for args in zip(count(0), self.bones.deform, tweaks, tweaks[1:]):
self.rig_deform_bone(*args)
def rig_deform_bone(self, i, deform, tweak, next_tweak):
self.make_constraint(deform, 'COPY_TRANSFORMS', tweak)
if next_tweak:
self.make_constraint(deform, 'DAMPED_TRACK', next_tweak)
self.make_constraint(deform, 'STRETCH_TO', next_tweak)
@stage.configure_bones
def configure_bbone_chain(self):
self.get_bone(self.bones.deform[0]).bone.bbone_easein = 0.0