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.
This commit is contained in:
parent
292b5975d6
commit
b757daf681
Notes:
blender-bot
2023-02-14 18:48:56 +01:00
Referenced by issue #80764, Rigify - basic.raw_copy bones with ORG prefix are not generated correctly
|
@ -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
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue