Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/rigify
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2020-11-25 14:31:01 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2020-11-25 14:42:56 +0300
commitb757daf681b0c39c67b3ed2391ff8437a46e237e (patch)
tree30ffd358c720e1e0aebf6f2204c8385dcc10c13c /rigify
parent292b5975d6d4d470f51ff683d5b5a5d979e887a4 (diff)
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.
Diffstat (limited to 'rigify')
-rw-r--r--rigify/generate.py10
-rw-r--r--rigify/rigs/basic/raw_copy.py10
2 files changed, 13 insertions, 7 deletions
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):