[Bf-extensions-cvs] [9a9923dd] master: Rigify: replace deprecated use_inherit_scale and use_offset properties.

Alexander Gavrilov noreply at git.blender.org
Sun Sep 15 19:00:58 CEST 2019


Commit: 9a9923dd278703f05206037a31b4226b337d8448
Author: Alexander Gavrilov
Date:   Sun Sep 15 11:30:26 2019 +0300
Branches: master
https://developer.blender.org/rBA9a9923dd278703f05206037a31b4226b337d8448

Rigify: replace deprecated use_inherit_scale and use_offset properties.

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

M	rigify/legacy/rigs/pitchipoy/simple_tentacle.py
M	rigify/legacy/rigs/pitchipoy/super_face.py
M	rigify/legacy/rigs/pitchipoy/super_palm.py
M	rigify/legacy/rigs/pitchipoy/tentacle.py
M	rigify/legacy/utils.py
M	rigify/rigs/experimental/super_chain.py
M	rigify/rigs/faces/super_face.py
M	rigify/rigs/limbs/simple_tentacle.py
M	rigify/rigs/limbs/super_palm.py
M	rigify/rigs/spines/basic_tail.py
M	rigify/rigs/spines/super_head.py
M	rigify/utils/bones.py
M	rigify/utils/switch_parent.py

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

diff --git a/rigify/legacy/rigs/pitchipoy/simple_tentacle.py b/rigify/legacy/rigs/pitchipoy/simple_tentacle.py
index 9351a659..facb2b90 100644
--- a/rigify/legacy/rigs/pitchipoy/simple_tentacle.py
+++ b/rigify/legacy/rigs/pitchipoy/simple_tentacle.py
@@ -194,7 +194,7 @@ class Rig:
                         setattr( con, prop, True )
                     else:
                         setattr( con, prop, False )
-                con.use_offset   = True
+                con.mix_mode     = 'OFFSET'
                 con.target_space = 'LOCAL'
                 con.owner_space  = 'LOCAL'
 
diff --git a/rigify/legacy/rigs/pitchipoy/super_face.py b/rigify/legacy/rigs/pitchipoy/super_face.py
index 41d1169e..5a46299a 100644
--- a/rigify/legacy/rigs/pitchipoy/super_face.py
+++ b/rigify/legacy/rigs/pitchipoy/super_face.py
@@ -698,7 +698,7 @@ class Rig:
             const = owner_pb.constraints.new( 'COPY_ROTATION' )
             const.target       = self.obj
             const.subtarget    = subtarget
-            const.use_offset   = True
+            const.mix_mode     = 'OFFSET'
             const.target_space = 'LOCAL'
             const.owner_space  = 'LOCAL'
 
diff --git a/rigify/legacy/rigs/pitchipoy/super_palm.py b/rigify/legacy/rigs/pitchipoy/super_palm.py
index 68d38958..a87eb735 100644
--- a/rigify/legacy/rigs/pitchipoy/super_palm.py
+++ b/rigify/legacy/rigs/pitchipoy/super_palm.py
@@ -110,7 +110,7 @@ class Rig:
         # turn off inherit scale for all ORG-bones to prevent undesired transformations
 
         for o in self.org_bones:
-            eb[o].use_inherit_scale = False
+            eb[o].inherit_scale = 'NONE'
 
         for d, b in zip(def_bones, self.org_bones):
             eb[d].use_connect = False
diff --git a/rigify/legacy/rigs/pitchipoy/tentacle.py b/rigify/legacy/rigs/pitchipoy/tentacle.py
index c3a8c85a..36c7f40a 100644
--- a/rigify/legacy/rigs/pitchipoy/tentacle.py
+++ b/rigify/legacy/rigs/pitchipoy/tentacle.py
@@ -307,7 +307,7 @@ class Rig:
                     con = pb[ctrl].constraints.new('COPY_ROTATION')
                     con.target       = self.obj
                     con.subtarget    = ctrls[ ctrls.index(ctrl) - 1 ]
-                    con.use_offset   = True
+                    con.mix_mode     = 'OFFSET'
                     con.target_space = 'LOCAL'
                     con.owner_space  = 'LOCAL'
 
diff --git a/rigify/legacy/utils.py b/rigify/legacy/utils.py
index 6a92a961..cd7d61c3 100644
--- a/rigify/legacy/utils.py
+++ b/rigify/legacy/utils.py
@@ -190,8 +190,8 @@ def copy_bone(obj, bone_name, assign_name=''):
         edit_bone_2.roll = edit_bone_1.roll
 
         edit_bone_2.use_inherit_rotation = edit_bone_1.use_inherit_rotation
-        edit_bone_2.use_inherit_scale = edit_bone_1.use_inherit_scale
         edit_bone_2.use_local_location = edit_bone_1.use_local_location
+        edit_bone_2.inherit_scale = edit_bone_1.inherit_scale
 
         edit_bone_2.use_deform = edit_bone_1.use_deform
         edit_bone_2.bbone_segments = edit_bone_1.bbone_segments
@@ -395,7 +395,7 @@ def create_widget(rig, bone_name, bone_transform_name=None):
 
     obj_name = WGT_PREFIX + bone_name
     scene = bpy.context.scene
-    collection = bpy.context.collection
+    collection = ensure_widget_collection(bpy.context)
 
     # Check if it already exists in the scene
     if obj_name in scene.objects:
diff --git a/rigify/rigs/experimental/super_chain.py b/rigify/rigs/experimental/super_chain.py
index fd6569c1..9c34478d 100644
--- a/rigify/rigs/experimental/super_chain.py
+++ b/rigify/rigs/experimental/super_chain.py
@@ -303,15 +303,15 @@ class Rig:
 
         for i, twk in enumerate(bones['chain']['tweak']):
             eb[twk].parent = eb[bones['chain']['mch_ctrl'][i+1]]
-            eb[twk].use_inherit_scale = False
+            eb[twk].inherit_scale = 'NONE'
 
         eb[bones['chain']['ctrl'][0]].parent = eb[bones['chain']['mch_ctrl'][0]] if bones['chain']['mch_ctrl'] else None
-        eb[bones['chain']['ctrl'][0]].use_inherit_scale = False
+        eb[bones['chain']['ctrl'][0]].inherit_scale = 'NONE'
         eb[bones['chain']['ctrl'][1]].parent = eb[bones['chain']['mch_ctrl'][-1]] if bones['chain']['mch_ctrl'] else None
-        eb[bones['chain']['ctrl'][1]].use_inherit_scale = False
+        eb[bones['chain']['ctrl'][1]].inherit_scale = 'NONE'
 
         if 'pivot' in bones.keys():
-            eb[bones['pivot']['ctrl']].use_inherit_scale = False
+            eb[bones['pivot']['ctrl']].inherit_scale = 'NONE'
 
         for i, mch in enumerate(bones['chain']['mch']):
             if mch == bones['chain']['mch'][0]:
diff --git a/rigify/rigs/faces/super_face.py b/rigify/rigs/faces/super_face.py
index 4eda647d..e482a7db 100644
--- a/rigify/rigs/faces/super_face.py
+++ b/rigify/rigs/faces/super_face.py
@@ -716,7 +716,7 @@ class Rig:
             const = owner_pb.constraints.new( 'COPY_ROTATION' )
             const.target       = self.obj
             const.subtarget    = subtarget
-            const.use_offset   = True
+            const.mix_mode     = 'OFFSET'
             const.target_space = 'LOCAL'
             const.owner_space  = 'LOCAL'
 
diff --git a/rigify/rigs/limbs/simple_tentacle.py b/rigify/rigs/limbs/simple_tentacle.py
index ea5a2224..10bdd2b5 100644
--- a/rigify/rigs/limbs/simple_tentacle.py
+++ b/rigify/rigs/limbs/simple_tentacle.py
@@ -74,7 +74,7 @@ class Rig(TweakChainRig):
             self.make_constraint(
                 ctrl, 'COPY_ROTATION', prev_ctrl,
                 use_xyz=self.copy_rotation_axes,
-                space='LOCAL', use_offset=True
+                space='LOCAL', mix_mode='BEFORE',
             )
 
     # Widgets
diff --git a/rigify/rigs/limbs/super_palm.py b/rigify/rigs/limbs/super_palm.py
index 127d9d0c..8cde6648 100644
--- a/rigify/rigs/limbs/super_palm.py
+++ b/rigify/rigs/limbs/super_palm.py
@@ -110,7 +110,7 @@ class Rig:
         # turn off inherit scale for all ORG-bones to prevent undesired transformations
 
         for o in self.org_bones:
-            eb[o].use_inherit_scale = False
+            eb[o].inherit_scale = 'NONE'
 
         for d, b in zip(def_bones, self.org_bones):
             eb[d].use_connect = False
diff --git a/rigify/rigs/spines/basic_tail.py b/rigify/rigs/spines/basic_tail.py
index 6697858c..845c3ca3 100644
--- a/rigify/rigs/spines/basic_tail.py
+++ b/rigify/rigs/spines/basic_tail.py
@@ -90,7 +90,7 @@ class Rig(BaseHeadTailRig):
         self.make_constraint(
             ctrl, 'COPY_ROTATION', prev_ctrl,
             use_xyz=self.copy_rotation_axes,
-            space='LOCAL', use_offset=True
+            space='LOCAL', mix_mode='BEFORE',
         )
 
     # Widgets
diff --git a/rigify/rigs/spines/super_head.py b/rigify/rigs/spines/super_head.py
index 79ec2396..de25113a 100644
--- a/rigify/rigs/spines/super_head.py
+++ b/rigify/rigs/spines/super_head.py
@@ -257,7 +257,7 @@ class Rig(BaseHeadTailRig):
         mch = self.bones.mch
         for bone in mch.chain:
             self.set_bone_parent(bone, mch.stretch)
-            self.get_bone(bone).use_inherit_scale = False
+            self.get_bone(bone).inherit_scale = 'NONE'
 
     @stage.rig_bones
     def rig_mch_chain(self):
diff --git a/rigify/utils/bones.py b/rigify/utils/bones.py
index b5559a76..738f5d42 100644
--- a/rigify/utils/bones.py
+++ b/rigify/utils/bones.py
@@ -150,8 +150,8 @@ def copy_bone(obj, bone_name, assign_name='', *, parent=False, bbone=False, leng
             edit_bone_2.use_connect = edit_bone_1.use_connect
 
             edit_bone_2.use_inherit_rotation = edit_bone_1.use_inherit_rotation
-            edit_bone_2.use_inherit_scale = edit_bone_1.use_inherit_scale
             edit_bone_2.use_local_location = edit_bone_1.use_local_location
+            edit_bone_2.inherit_scale = edit_bone_1.inherit_scale
 
         if bbone:
             for name in ['bbone_segments',
diff --git a/rigify/utils/switch_parent.py b/rigify/utils/switch_parent.py
index 5daa6a6c..85e6e130 100644
--- a/rigify/utils/switch_parent.py
+++ b/rigify/utils/switch_parent.py
@@ -106,6 +106,7 @@ class SwitchParentBuilder(GeneratorPlugin, MechanismUtilityMixin):
           ctrl_bone         User visible control bone that depends on this parent (for switch & keep transform)
           no_fix_*          Disable "Switch and Keep Transform" correction for specific channels.
           copy_*            Override the specified components by copying from another bone.
+          inherit_scale     Inherit scale mode for the child bone (default: AVERAGE).
 
         Lazy parameters:
           'extra_parents', 'select_parent', 'prop_bone', 'controls', 'copy_*'
@@ -161,6 +162,7 @@ class SwitchParentBuilder(GeneratorPlugin, MechanismUtilityMixin):
         'ctrl_bone': None,
         'no_fix_location': False, 'no_fix_rotation': False, 'no_fix_scale': False,
         'copy_location': None, 'copy_rotation': None, 'copy_scale': None,
+        'inherit_scale': 'AVERAGE',
     }
 
     def assign_child_options(self, child, options):
@@ -217,6 +219,7 @@ class SwitchParentBuilder(GeneratorPlugin, MechanismUtilityMixin):
             # Parent child to the MCH proxy
             if mch != child['bone']:
                 rig.set_bone_parent(child['bone'], mch)
+                rig.get_bone(child['bone']).inherit_scale = child['inherit_scale']
 
     def configure_bones(self):
         for child in self.child_list:



More information about the Bf-extensions-cvs mailing list