[Bf-extensions-cvs] [ba2521b7] master: Fix T74483: Rigify Meta-Human Neck Bone stretching.

Demeter Dzadik noreply at git.blender.org
Wed Jun 10 13:11:49 CEST 2020


Commit: ba2521b7ed14b5deb6bb9a82a442bc85d2e05224
Author: Demeter Dzadik
Date:   Tue Jun 9 17:20:46 2020 +0300
Branches: master
https://developer.blender.org/rBAba2521b7ed14b5deb6bb9a82a442bc85d2e05224

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

===================================================================

M	rigify/rigs/spines/spine_rigs.py

===================================================================

diff --git a/rigify/rigs/spines/spine_rigs.py b/rigify/rigs/spines/spine_rigs.py
index d23676d5..fa5babf3 100644
--- a/rigify/rigs/spines/spine_rigs.py
+++ b/rigify/rigs/spines/spine_rigs.py
@@ -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



More information about the Bf-extensions-cvs mailing list