[Bf-extensions-cvs] [0c859edf] blender-v2.81-release: Rigify: fix incorrect layer assignment for tweak bones in the cat metarig.

Alexander Gavrilov noreply at git.blender.org
Tue Oct 15 14:38:12 CEST 2019


Commit: 0c859edf37b06de18bc0a6ac96c20ecbdc1b4052
Author: Alexander Gavrilov
Date:   Tue Oct 15 15:33:10 2019 +0300
Branches: blender-v2.81-release
https://developer.blender.org/rBA0c859edf37b06de18bc0a6ac96c20ecbdc1b4052

Rigify: fix incorrect layer assignment for tweak bones in the cat metarig.

The layer selection for the spine tweaks happens to be the default value,
so simply copying the data does not overwrite non-default garbage values
remaining in some of the bones. To fix it's necessary to clear params.

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

M	rigify/base_generate.py
M	rigify/rigs/spines/super_spine.py
M	rigify/utils/misc.py

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

diff --git a/rigify/base_generate.py b/rigify/base_generate.py
index 8cf04ade..651e0612 100644
--- a/rigify/base_generate.py
+++ b/rigify/base_generate.py
@@ -27,7 +27,7 @@ from .utils.errors import MetarigError, RaiseErrorMixin
 from .utils.naming import random_id
 from .utils.metaclass import SingletonPluginMetaclass
 from .utils.rig import list_bone_names_depth_first_sorted, get_rigify_type
-from .utils.misc import assign_parameters
+from .utils.misc import clone_parameters, assign_parameters
 
 from . import base_rig
 
@@ -78,6 +78,7 @@ class SubstitutionRig(RaiseErrorMixin):
         self.obj = generator.obj
         self.base_bone = pose_bone.name
         self.params = pose_bone.rigify_parameters
+        self.params_copy = clone_parameters(self.params)
 
     def substitute(self):
         # return [rig1, rig2...]
diff --git a/rigify/rigs/spines/super_spine.py b/rigify/rigs/spines/super_spine.py
index 3f7e41e1..5ed1588e 100644
--- a/rigify/rigs/spines/super_spine.py
+++ b/rigify/rigs/spines/super_spine.py
@@ -33,7 +33,7 @@ class Rig(SubstitutionRig, BoneUtilityMixin):
     """Compatibility proxy for the monolithic super_spine rig that splits it into parts."""
 
     def substitute(self):
-        params_copy = dict(self.params)
+        params_copy = self.params_copy
         orgs = [self.base_bone] + connected_children_names(self.obj, self.base_bone)
 
         # Split the bone list according to the settings
diff --git a/rigify/utils/misc.py b/rigify/utils/misc.py
index 4d0fbad3..64367bb7 100644
--- a/rigify/utils/misc.py
+++ b/rigify/utils/misc.py
@@ -24,6 +24,7 @@ import collections
 
 from itertools import tee, chain, islice, repeat
 from mathutils import Vector, Matrix, Color
+from rna_prop_ui import rna_idprop_value_to_python
 
 
 #=============================================
@@ -170,8 +171,30 @@ def copy_attributes(a, b):
                 pass
 
 
+def property_to_python(value):
+    value = rna_idprop_value_to_python(value)
+
+    if isinstance(value, dict):
+        return { k: property_to_python(v) for k, v in value.items() }
+    elif isinstance(value, list):
+        return map_list(property_to_python, value)
+    else:
+        return value
+
+
+def clone_parameters(target):
+    return property_to_python(dict(target))
+
+
 def assign_parameters(target, val_dict=None, **params):
-    data = { **val_dict, **params } if val_dict else params
+    if val_dict is not None:
+        for key in list(target.keys()):
+            del target[key]
+
+        data = { **val_dict, **params }
+    else:
+        data = params
+
     for key, value in data.items():
         try:
             target[key] = value



More information about the Bf-extensions-cvs mailing list