[Bf-extensions-cvs] [b757daf6] master: Rigify: Fix T80764: handling of bones with ORG prefix in raw_copy.
Alexander Gavrilov
noreply at git.blender.org
Wed Nov 25 12:46:51 CET 2020
Commit: b757daf681b0c39c67b3ed2391ff8437a46e237e
Author: Alexander Gavrilov
Date: Wed Nov 25 14:31:01 2020 +0300
Branches: master
https://developer.blender.org/rBAb757daf681b0c39c67b3ed2391ff8437a46e237e
Rigify: Fix T80764: handling of bones with ORG prefix in raw_copy.
Originally the raw_copy rig used a standard API of rigify to rename
the bone after generate already added an ORG prefix. However, if the
bone already had that prefix, generate didn't add the second one to
avoid 'ORG-ORG', and thus raw_copy removed the only remaining prefix.
As the simplest solution, hard-code handling of this rig in generate.
This isn't that bad, because this rig is special by definition, and
the special handling consists in doing nothing.
The original API based code is kept commented out as an example.
===================================================================
M rigify/generate.py
M rigify/rigs/basic/raw_copy.py
===================================================================
diff --git a/rigify/generate.py b/rigify/generate.py
index 9c861d97..e1fd29b8 100644
--- a/rigify/generate.py
+++ b/rigify/generate.py
@@ -30,6 +30,7 @@ from .utils.widgets import WGT_PREFIX
from .utils.widgets_special import create_root_widget
from .utils.misc import gamma_correct, select_object
from .utils.collections import ensure_widget_collection, list_layer_collections, filter_layer_collections_by_object
+from .utils.rig import get_rigify_type
from . import base_generate
from . import rig_ui_template
@@ -198,9 +199,12 @@ class Generator(base_generate.BaseGenerator):
# Add the ORG_PREFIX to the original bones.
for i in range(0, len(original_bones)):
- new_name = make_original_name(original_bones[i])
- obj.data.bones[original_bones[i]].name = new_name
- original_bones[i] = new_name
+ bone = obj.pose.bones[original_bones[i]]
+
+ # This rig type is special in that it preserves the name of the bone.
+ if get_rigify_type(bone) != 'basic.raw_copy':
+ bone.name = make_original_name(original_bones[i])
+ original_bones[i] = bone.name
self.original_bones = original_bones
diff --git a/rigify/rigs/basic/raw_copy.py b/rigify/rigs/basic/raw_copy.py
index 7d6d693e..077deaa6 100644
--- a/rigify/rigs/basic/raw_copy.py
+++ b/rigify/rigs/basic/raw_copy.py
@@ -27,6 +27,8 @@ from ...base_generate import SubstitutionRig
from itertools import repeat
+'''
+Due to T80764, bone name handling for 'limbs.raw_copy' was hard-coded in generate.py
class Rig(SubstitutionRig):
""" A raw copy rig, preserving the metarig bone as is, without the ORG prefix. """
@@ -37,7 +39,7 @@ class Rig(SubstitutionRig):
new_name = self.generator.rename_org_bone(self.base_bone, new_name)
return [ self.instantiate_rig(InstanceRig, new_name) ]
-
+'''
class RelinkConstraintsMixin:
""" Utilities for constraint relinking. """
@@ -122,7 +124,7 @@ class RelinkConstraintsMixin:
layout.label(text="Constraint names have special meanings.", icon='ERROR')
-class InstanceRig(BaseRig, RelinkConstraintsMixin):
+class Rig(BaseRig, RelinkConstraintsMixin):
def find_org_bones(self, pose_bone):
return pose_bone.name
@@ -148,8 +150,8 @@ class InstanceRig(BaseRig, RelinkConstraintsMixin):
self.add_relink_constraints_ui(layout, params)
-add_parameters = InstanceRig.add_parameters
-parameters_ui = InstanceRig.parameters_ui
+#add_parameters = InstanceRig.add_parameters
+#parameters_ui = InstanceRig.parameters_ui
def create_sample(obj):
More information about the Bf-extensions-cvs
mailing list