diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2020-11-25 14:31:01 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2020-11-25 14:42:56 +0300 |
commit | b757daf681b0c39c67b3ed2391ff8437a46e237e (patch) | |
tree | 30ffd358c720e1e0aebf6f2204c8385dcc10c13c /rigify/generate.py | |
parent | 292b5975d6d4d470f51ff683d5b5a5d979e887a4 (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/generate.py')
-rw-r--r-- | rigify/generate.py | 10 |
1 files changed, 7 insertions, 3 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 |