[Bf-extensions-cvs] [46590bb7] master: Rigify: Fix T78463: better support unguligrade animals (horse) setup.

Demeter Dzadik noreply at git.blender.org
Tue Nov 24 16:01:35 CET 2020


Commit: 46590bb7800eea5aa1826f6e9305d7e0320829be
Author: Demeter Dzadik
Date:   Sat Nov 7 17:32:29 2020 +0300
Branches: master
https://developer.blender.org/rBA46590bb7800eea5aa1826f6e9305d7e0320829be

Rigify: Fix T78463: better support unguligrade animals (horse) setup.

Add support for 5 bone chains to the limbs.paw rig.

Implement a new limbs.rear_paw rig, which provides a three bone IK
mechanism designed to keep the first and third bones nearly parallel
by default (based on a YouTube video by @Pieriko as suggested by
@icappiello).

Implement a limbs.front_paw rig with automation that aims to
keep the angle between second and third bones mostly stable
by default (has influence option), as suitable for front paws.

The horse and wolf metarigs are updated to use these new rig
types, with the horse rig further overhauled by @icappiello.

Maniphest Tasks: T78463

Differential Revision: https://developer.blender.org/D8496

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

M	rigify/base_generate.py
M	rigify/base_rig.py
M	rigify/generate.py
M	rigify/metarigs/Animals/horse.py
M	rigify/metarigs/Animals/wolf.py
M	rigify/rig_ui_template.py
M	rigify/rigs/limbs/arm.py
A	rigify/rigs/limbs/front_paw.py
M	rigify/rigs/limbs/leg.py
M	rigify/rigs/limbs/limb_rigs.py
M	rigify/rigs/limbs/paw.py
M	rigify/rigs/limbs/rear_paw.py
M	rigify/utils/bones.py

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

diff --git a/rigify/base_generate.py b/rigify/base_generate.py
index 22a35eae..ce04b8fc 100644
--- a/rigify/base_generate.py
+++ b/rigify/base_generate.py
@@ -359,6 +359,10 @@ class BaseGenerator:
         self.__run_object_stage('configure_bones')
 
 
+    def invoke_preapply_bones(self):
+        self.__run_object_stage('preapply_bones')
+
+
     def invoke_apply_bones(self):
         self.__run_edit_stage('apply_bones')
 
diff --git a/rigify/base_rig.py b/rigify/base_rig.py
index 056c2785..d878143b 100644
--- a/rigify/base_rig.py
+++ b/rigify/base_rig.py
@@ -119,6 +119,13 @@ class GenerateCallbackHost(BaseStagedClass, define_stages=True):
         """
         pass
 
+    def preapply_bones(self):
+        """
+        Read bone matrices for applying to edit mode.
+        Called in Object mode. May not do Edit mode operations.
+        """
+        pass
+
     def apply_bones(self):
         """
         Can be used to apply some constraints to rest pose, and for final parenting.
diff --git a/rigify/generate.py b/rigify/generate.py
index a4e97f96..9c861d97 100644
--- a/rigify/generate.py
+++ b/rigify/generate.py
@@ -428,6 +428,13 @@ class Generator(base_generate.BaseGenerator):
 
         t.tick("Configure bones: ")
 
+        #------------------------------------------
+        bpy.ops.object.mode_set(mode='OBJECT')
+
+        self.invoke_preapply_bones()
+
+        t.tick("Preapply bones: ")
+
         #------------------------------------------
         bpy.ops.object.mode_set(mode='EDIT')
 
diff --git a/rigify/metarigs/Animals/horse.py b/rigify/metarigs/Animals/horse.py
index eafb9b02..1cdd4feb 100644
--- a/rigify/metarigs/Animals/horse.py
+++ b/rigify/metarigs/Animals/horse.py
@@ -165,432 +165,432 @@ def create(obj):
 
     bones = {}
 
-    bone = arm.edit_bones.new('spine.005')
-    bone.head = -0.0000, 0.9228, 1.4526
-    bone.tail = -0.0000, 0.6989, 1.4910
-    bone.roll = -0.0000
+    bone = arm.edit_bones.new('spine.001')
+    bone.head = 0.0000, 0.8059, 1.3950
+    bone.tail = 0.0000, 0.3939, 1.3950
+    bone.roll = 0.0000
     bone.use_connect = False
-    bones['spine.005'] = bone.name
-    bone = arm.edit_bones.new('spine.004')
-    bone.head = -0.0000, 0.9228, 1.4526
-    bone.tail = -0.0000, 1.0291, 1.4191
-    bone.roll = -0.0000
+    bones['spine.001'] = bone.name
+    bone = arm.edit_bones.new('tail.001')
+    bone.head = -0.0000, 0.8970, 1.4526
+    bone.tail = 0.0000, 1.0033, 1.4420
+    bone.roll = 0.0000
     bone.use_connect = False
-    bone.parent = arm.edit_bones[bones['spine.005']]
-    bones['spine.004'] = bone.name
-    bone = arm.edit_bones.new('spine.006')
-    bone.head = -0.0000, 0.6989, 1.4910
-    bone.tail = 0.0000, 0.3824, 1.3801
-    bone.roll = -0.0000
+    bone.parent = arm.edit_bones[bones['spine.001']]
+    bones['tail.001'] = bone.name
+    bone = arm.edit_bones.new('spine.002')
+    bone.head = 0.0000, 0.3939, 1.3950
+    bone.tail = -0.0000, 0.2088, 1.3270
+    bone.roll = 0.0000
     bone.use_connect = True
-    bone.parent = arm.edit_bones[bones['spine.005']]
-    bones['spine.006'] = bone.name
-    bone = arm.edit_bones.new('spine.003')
-    bone.head = -0.0000, 1.0291, 1.4191
+    bone.parent = arm.edit_bones[bones['spine.001']]
+    bones['spine.002'] = bone.name
+    bone = arm.edit_bones.new('tail.002')
+    bone.head = 0.0000, 1.0033, 1.4420
     bone.tail = -0.0000, 1.1423, 1.3128
     bone.roll = -0.0000
     bone.use_connect = True
-    bone.parent = arm.edit_bones[bones['spine.004']]
-    bones['spine.003'] = bone.name
-    bone = arm.edit_bones.new('spine.007')
-    bone.head = 0.0000, 0.3824, 1.3801
-    bone.tail = 0.0000, 0.1316, 1.3086
+    bone.parent = arm.edit_bones[bones['tail.001']]
+    bones['tail.002'] = bone.name
+    bone = arm.edit_bones.new('spine.003')
+    bone.head = -0.0000, 0.2088, 1.3270
+    bone.tail = -0.0000, 0.0294, 1.2857
     bone.roll = 0.0000
     bone.use_connect = True
-    bone.parent = arm.edit_bones[bones['spine.006']]
-    bones['spine.007'] = bone.name
+    bone.parent = arm.edit_bones[bones['spine.002']]
+    bones['spine.003'] = bone.name
     bone = arm.edit_bones.new('pelvis.L')
-    bone.head = 0.0503, 0.6868, 1.3205
+    bone.head = -0.0000, 0.8059, 1.3950
     bone.tail = 0.1803, 0.4418, 1.5783
-    bone.roll = 0.7837
+    bone.roll = 0.6304
     bone.use_connect = False
-    bone.parent = arm.edit_bones[bones['spine.006']]
+    bone.parent = arm.edit_bones[bones['spine.002']]
     bones['pelvis.L'] = bone.name
-    bone = arm.edit_bones.new('thigh.L')
-    bone.head = 0.1922, 0.7048, 1.4330
-    bone.tail = 0.1933, 0.5712, 1.0272
-    bone.roll = 3.1380
-    bone.use_connect = False
-    bone.parent = arm.edit_bones[bones['spine.006']]
-    bones['thigh.L'] = bone.name
     bone = arm.edit_bones.new('pelvis.R')
-    bone.head = -0.0503, 0.6868, 1.3205
+    bone.head = 0.0000, 0.8059, 1.3950
     bone.tail = -0.1803, 0.4418, 1.5783
-    bone.roll = -0.7837
+    bone.roll = -0.6304
     bone.use_connect = False
-    bone.parent = arm.edit_bones[bones['spine.006']]
+    bone.parent = arm.edit_bones[bones['spine.002']]
     bones['pelvis.R'] = bone.name
-    bone = arm.edit_bones.new('thigh.R')
-    bone.head = -0.1922, 0.7048, 1.4330
-    bone.tail = -0.1933, 0.5712, 1.0272
-    bone.roll = -3.1380
-    bone.use_connect = False
-    bone.parent = arm.edit_bones[bones['spine.006']]
-    bones['thigh.R'] = bone.name
-    bone = arm.edit_bones.new('pelvis')
-    bone.head = 0.0000, 0.6845, 1.3200
-    bone.tail = -0.0000, 0.4276, 1.0452
+    bone = arm.edit_bones.new('hip')
+    bone.head = -0.0000, 0.8059, 1.3950
+    bone.tail = -0.0000, 0.4636, 1.0212
     bone.roll = 0.0000
     bone.use_connect = False
-    bone.parent = arm.edit_bones[bones['spine.006']]
-    bones['pelvis'] = bone.name
-    bone = arm.edit_bones.new('spine.002')
+    bone.parent = arm.edit_bones[bones['spine.002']]
+    bones['hip'] = bone.name
+    bone = arm.edit_bones.new('tail.003')
     bone.head = -0.0000, 1.1423, 1.3128
     bone.tail = -0.0000, 1.3779, 1.1589
     bone.roll = -0.0000
     bone.use_connect = True
-    bone.parent = arm.edit_bones[bones['spine.003']]
-    bones['spine.002'] = bone.name
-    bone = arm.edit_bones.new('spine.008')
-    bone.head = 0.0000, 0.1316, 1.3086
-    bone.tail = 0.0000, -0.1712, 1.2964
+    bone.parent = arm.edit_bones[bones['tail.002']]
+    bones['tail.003'] = bone.name
+    bone = arm.edit_bones.new('spine.004')
+    bone.head = -0.0000, 0.0294, 1.2857
+    bone.tail = -0.0000, -0.1769, 1.2735
     bone.roll = 0.0000
     bone.use_connect = True
-    bone.parent = arm.edit_bones[bones['spine.007']]
-    bones['spine.008'] = bone.name
-    bone = arm.edit_bones.new('shin.L')
-    bone.head = 0.1933, 0.5712, 1.0272
-    bone.tail = 0.1933, 0.7355, 0.6045
-    bone.roll = -3.1416
-    bone.use_connect = True
-    bone.parent = arm.edit_bones[bones['thigh.L']]
-    bones['shin.L'] = bone.name
-    bone = arm.edit_bones.new('shin.R')
-    bone.head = -0.1933, 0.5712, 1.0272
-    bone.tail = -0.1933, 0.7355, 0.6045
-    bone.roll = 3.1416
-    bone.use_connect = True
-    bone.parent = arm.edit_bones[bones['thigh.R']]
-    bones['shin.R'] = bone.name
-    bone = arm.edit_bones.new('spine.001')
+    bone.parent = arm.edit_bones[bones['spine.003']]
+    bones['spine.004'] = bone.name
+    bone = arm.edit_bones.new('abdomen')
+    bone.head = -0.0000, 0.1503, 1.2207
+    bone.tail = -0.0000, 0.2042, 0.9012
+    bone.roll = 0.0000
+    bone.use_connect = False
+    bone.parent = arm.edit_bones[bones['spine.003']]
+    bones['abdomen'] = bone.name
+    bone = arm.edit_bones.new('thigh.L')
+    bone.head = 0.1922, 0.6243, 1.4090
+    bone.tail = 0.1933, 0.5569, 1.0335
+    bone.roll = 3.1378
+    bone.use_connect = False
+    bone.parent = arm.edit_bones[bones['pelvis.L']]
+    bones['thigh.L'] = bone.name
+    bone = arm.edit_bones.new('thigh.R')
+    bone.head = -0.1922, 0.6243, 1.4090
+    bone.tail = -0.1933, 0.5569, 1.0335
+    bone.roll = -3.1378
+    bone.use_connect = False
+    bone.parent = arm.edit_bones[bones['pelvis.R']]
+    bones['thigh.R'] = bone.name
+    bone = arm.edit_bones.new('tail.004')
     bone.head = -0.0000, 1.3779, 1.1589
     bone.tail = -0.0000, 1.5754, 1.1088
     bone.roll = -0.0000
     bone.use_connect = True
-    bone.parent = arm.edit_bones[bones['spine.002']]
-    bones['spine.001'] = bone.name
-    bone = arm.edit_bones.new('spine.009')
-    bone.head = 0.0000, -0.1712, 1.2964
-    bone.tail = 0.0000, -0.4908, 1.3031
+    bone.parent = arm.edit_bones[bones['tail.003']]
+    bones['tail.004'] = bone.name
+    bone = arm.edit_bones.new('spine.005')
+    bone.head = -0.0000, -0.1769, 1.2735
+    bone.tail = -0.0000, -0.3674, 1.2808
     bone.roll = 0.0000
     bone.use_connect = True
-    bone.parent = arm.edit_bones[bones['spine.008']]
-    bones['spine.009'] = bone.name
-    bone = arm.edit_bones.new('belly')
-    bone.head = -0.0000, 0.1503, 1.2207
-    bone.tail = -0.0000, 0.1802, 0.9332
-    bone.roll = 0.0000
-    bone.use_connect = False
-    bone.parent = arm.edit_bones[bones['spine.008']]
-    bones['belly'] = bone.name
-    bone = arm.edit_bones.new('foot.L')
-    bone.head = 0.1933, 0.7355, 0.6045
-    bone.tail = 0.1933, 0.6771, 0.1732
+    bone.parent = arm.edit_bones[bones['spine.004']]
+    bones['spine.005'] = bone.name
+    bone = arm.edit_bones.new('lower_leg.L')
+    bone.head = 0.1933, 0.5569, 1.0335
+    bone.tail = 0.1933, 0.7635, 0.6074
     bone.roll = -3.1416
     bone.use_connect = True
-    bone.parent = arm.edit_bones[bones['shin.L']]
-    bones['foot.L'] = bone.name
-    bone = arm.edit_bones.new('foot.R')
-    bone.head = -0.1933, 0.7355, 0.6045
-    bone.tail = -0.1933, 0.6771, 0.1732
+    bone.parent = arm.edit_bones[bones['thigh.L']]
+    bones['lower_leg.L'] = bone.name
+    bone = arm.edit_bones.new('lower_leg.R')
+    bone.head = -0.1933, 0.5569, 1.0335
+    bone.tail = -0.1933, 0.7635, 0.6074
     bone.roll = 3.1416
     bone.use_connect = True
-    bone.parent = arm.edit_bones[bones['shin.R']]
-    bones['foot.R'] = bone.name
-    bone = arm.edit_bones.new('spine')
+    bone.parent = arm.edit_bones[bones['thigh.R']]
+    bones['lower_leg.R'] = bone.name
+    bo

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list