[Bf-extensions-cvs] [26088d76] master: Rigify: replace the Damped Track + Stretch To idiom with the Swing mode.

Alexander Gavrilov noreply at git.blender.org
Tue Nov 17 12:51:32 CET 2020


Commit: 26088d766e55bd4b18be812d60aa20f5316f8ab8
Author: Alexander Gavrilov
Date:   Tue Nov 17 14:44:04 2020 +0300
Branches: master
https://developer.blender.org/rBA26088d766e55bd4b18be812d60aa20f5316f8ab8

Rigify: replace the Damped Track + Stretch To idiom with the Swing mode.

It has been long enough since 2.82 when Swing was added to use this.

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

M	rigify/__init__.py
M	rigify/rigs/chain_rigs.py
M	rigify/rigs/faces/super_face.py
M	rigify/rigs/limbs/limb_rigs.py
M	rigify/rigs/limbs/paw.py
M	rigify/rigs/limbs/super_finger.py
M	rigify/rigs/spines/spine_rigs.py
M	rigify/rigs/spines/super_head.py

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

diff --git a/rigify/__init__.py b/rigify/__init__.py
index d9fb680d..df584872 100644
--- a/rigify/__init__.py
+++ b/rigify/__init__.py
@@ -20,9 +20,9 @@
 
 bl_info = {
     "name": "Rigify",
-    "version": (0, 6, 1),
+    "version": (0, 6, 2),
     "author": "Nathan Vegdahl, Lucio Rossi, Ivan Cappiello, Alexander Gavrilov",
-    "blender": (2, 81, 0),
+    "blender": (2, 82, 0),
     "description": "Automatic rigging from building-block components",
     "location": "Armature properties, Bone properties, View3d tools panel, Armature Add menu",
     "doc_url": "{BLENDER_MANUAL_URL}/addons/rigging/rigify/index.html",
diff --git a/rigify/rigs/chain_rigs.py b/rigify/rigs/chain_rigs.py
index 9a7808dd..96bf8abd 100644
--- a/rigify/rigs/chain_rigs.py
+++ b/rigify/rigs/chain_rigs.py
@@ -209,8 +209,7 @@ class TweakChainRig(SimpleChainRig):
     def rig_org_bone(self, i, org, tweak, next_tweak):
         self.make_constraint(org, 'COPY_TRANSFORMS', tweak)
         if next_tweak:
-            self.make_constraint(org, 'DAMPED_TRACK', next_tweak)
-            self.make_constraint(org, 'STRETCH_TO', next_tweak)
+            self.make_constraint(org, 'STRETCH_TO', next_tweak, keep_axis='SWING_Y')
 
 
 class ConnectingChainRig(TweakChainRig):
@@ -338,8 +337,7 @@ class ConnectingChainRig(TweakChainRig):
 
     def rig_org_bone(self, i, org, tweak, next_tweak):
         if self.use_connect_chain and self.use_connect_reverse:
-            self.make_constraint(org, 'DAMPED_TRACK', tweak)
-            self.make_constraint(org, 'STRETCH_TO', tweak)
+            self.make_constraint(org, 'STRETCH_TO', tweak, keep_axis='SWING_Y')
         else:
             super().rig_org_bone(i, org, tweak, next_tweak)
 
diff --git a/rigify/rigs/faces/super_face.py b/rigify/rigs/faces/super_face.py
index e3617695..6cf2cd35 100644
--- a/rigify/rigs/faces/super_face.py
+++ b/rigify/rigs/faces/super_face.py
@@ -648,25 +648,18 @@ class Rig:
 
         if   constraint_type == 'def_tweak':
 
-            const = owner_pb.constraints.new( 'DAMPED_TRACK' )
-            const.target    = self.obj
-            const.subtarget = subtarget
-
             const = owner_pb.constraints.new( 'STRETCH_TO' )
             const.target    = self.obj
             const.subtarget = subtarget
+            const.keep_axis = 'SWING_Y'
 
         elif constraint_type == 'def_lids':
 
-            const = owner_pb.constraints.new( 'DAMPED_TRACK' )
-            const.target    = self.obj
-            const.subtarget = subtarget
-            const.head_tail = 1.0
-
             const = owner_pb.constraints.new( 'STRETCH_TO' )
             const.target    = self.obj
             const.subtarget = subtarget
             const.head_tail = 1.0
+            const.keep_axis = 'SWING_Y'
 
         elif constraint_type == 'mch_eyes':
 
diff --git a/rigify/rigs/limbs/limb_rigs.py b/rigify/rigs/limbs/limb_rigs.py
index bb7de5f1..2e3fbc90 100644
--- a/rigify/rigs/limbs/limb_rigs.py
+++ b/rigify/rigs/limbs/limb_rigs.py
@@ -565,8 +565,7 @@ class BaseLimbRig(BaseRig):
         self.rig_ik_mch_end_bone(mch.ik_end, mch.ik_target, self.bones.ctrl.ik_pole)
 
     def rig_ik_mch_stretch_bone(self, mch_stretch, input_bone):
-        self.make_constraint(mch_stretch, 'DAMPED_TRACK', input_bone, head_tail=self.ik_input_head_tail)
-        self.make_constraint(mch_stretch, 'STRETCH_TO', input_bone, head_tail=self.ik_input_head_tail)
+        self.make_constraint(mch_stretch, 'STRETCH_TO', input_bone, head_tail=self.ik_input_head_tail, keep_axis='SWING_Y')
 
         con = self.make_constraint(mch_stretch, 'LIMIT_SCALE', min_y=0.0, max_y=1.05, owner_space='LOCAL')
 
@@ -765,14 +764,12 @@ class BaseLimbRig(BaseRig):
             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)
+                self.make_constraint(deform, 'STRETCH_TO', next_tweak, keep_axis='SWING_Y')
 
                 self.rig_deform_easing(i, deform, tweak, next_tweak)
 
             elif next_entry:
-                self.make_constraint(deform, 'DAMPED_TRACK', next_entry.org)
-                self.make_constraint(deform, 'STRETCH_TO', next_entry.org)
+                self.make_constraint(deform, 'STRETCH_TO', next_entry.org, keep_axis='SWING_Y')
 
         else:
             self.make_constraint(deform, 'COPY_TRANSFORMS', entry.org)
diff --git a/rigify/rigs/limbs/paw.py b/rigify/rigs/limbs/paw.py
index 8c130e95..4f6acaa8 100644
--- a/rigify/rigs/limbs/paw.py
+++ b/rigify/rigs/limbs/paw.py
@@ -181,8 +181,7 @@ class Rig(BaseLimbRig):
         super().rig_deform_bone(i, deform, entry, next_entry, tweak, next_tweak)
 
         if tweak and not (next_tweak or next_entry):
-            self.make_constraint(deform, 'DAMPED_TRACK', entry.org, head_tail=1.0)
-            self.make_constraint(deform, 'STRETCH_TO', entry.org, head_tail=1.0)
+            self.make_constraint(deform, 'STRETCH_TO', entry.org, head_tail=1.0, keep_axis='SWING_Y')
 
 
     ####################################################
diff --git a/rigify/rigs/limbs/super_finger.py b/rigify/rigs/limbs/super_finger.py
index ccb9ba22..02f9bff8 100644
--- a/rigify/rigs/limbs/super_finger.py
+++ b/rigify/rigs/limbs/super_finger.py
@@ -295,8 +295,7 @@ class Rig(SimpleChainRig):
             self.make_constraint(mch, 'COPY_LOCATION', ctrl)
             self.make_constraint(mch, 'COPY_SCALE', ctrl)
 
-        self.make_constraint(mch, 'DAMPED_TRACK', ctrl_next)
-        self.make_constraint(mch, 'STRETCH_TO', ctrl_next, volume='NO_VOLUME')
+        self.make_constraint(mch, 'STRETCH_TO', ctrl_next, volume='NO_VOLUME', keep_axis='SWING_Y')
 
     ##############################
     # ORG chain
diff --git a/rigify/rigs/spines/spine_rigs.py b/rigify/rigs/spines/spine_rigs.py
index fa5babf3..3c8b8223 100644
--- a/rigify/rigs/spines/spine_rigs.py
+++ b/rigify/rigs/spines/spine_rigs.py
@@ -163,8 +163,7 @@ class BaseSpineRig(TweakChainRig):
     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)
+            self.make_constraint(deform, 'STRETCH_TO', next_tweak, keep_axis='SWING_Y')
 
     @stage.configure_bones
     def configure_bbone_chain(self):
diff --git a/rigify/rigs/spines/super_head.py b/rigify/rigs/spines/super_head.py
index eb19c304..f35e122c 100644
--- a/rigify/rigs/spines/super_head.py
+++ b/rigify/rigs/spines/super_head.py
@@ -211,8 +211,7 @@ class Rig(BaseHeadTailRig):
             self.rig_mch_stretch_bone(self.bones.mch.stretch, self.bones.ctrl.head)
 
     def rig_mch_stretch_bone(self, mch, head):
-        self.make_constraint(mch, 'DAMPED_TRACK', head)
-        self.make_constraint(mch, 'STRETCH_TO', head)
+        self.make_constraint(mch, 'STRETCH_TO', head, keep_axis='SWING_Y')
 
     ####################################################
     # MCH IK chain for the long neck



More information about the Bf-extensions-cvs mailing list