diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2019-12-22 18:27:27 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2019-12-22 18:52:04 +0300 |
commit | a50e8748493ac28723ce7dca502daf04de0afb0f (patch) | |
tree | 4e5d5d0ac3036ec1a760a2245480f9f8339c60e8 /rigify/base_generate.py | |
parent | 86e03ba498290f2f6b9ae7a29defc2b290232260 (diff) |
Rigify: replace Rename To Deform with a new basic.raw_copy rig.
Add a separate rig aimed at transferring bones from the metarig
completely verbatim without the ORG prefix, and remove the hacky
copy_chain/super_copy option for renaming ORG to DEF. Share the
constraint retargeting feature between super_copy and raw_copy.
Diffstat (limited to 'rigify/base_generate.py')
-rw-r--r-- | rigify/base_generate.py | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/rigify/base_generate.py b/rigify/base_generate.py index 651e0612..ea1415c9 100644 --- a/rigify/base_generate.py +++ b/rigify/base_generate.py @@ -219,6 +219,9 @@ class BaseGenerator: # different rigs don't collide id's self.rig_id = random_id(16) + # Table of renamed ORG bones + self.org_rename_table = dict() + def disable_auto_parent(self, bone_name): """Prevent automatically parenting the bone to root if parentless.""" @@ -231,6 +234,20 @@ class BaseGenerator: self.layer_group_priorities[bone_name][i] = priority + def rename_org_bone(self, old_name, new_name): + assert self.stage == 'instantiate' + assert old_name == self.org_rename_table.get(old_name, None) + assert old_name not in self.bone_owners + + bone = self.obj.data.bones[old_name] + + bone.name = new_name + new_name = bone.name + + self.org_rename_table[old_name] = new_name + return new_name + + def __run_object_stage(self, method_name): assert(self.context.active_object == self.obj) assert(self.obj.mode == 'OBJECT') @@ -431,9 +448,16 @@ class BaseGenerator: assert(self.context.active_object == self.obj) assert(self.obj.mode == 'OBJECT') + self.stage = 'instantiate' + + # Compute the list of bones + bone_list = list_bone_names_depth_first_sorted(self.obj) + + self.org_rename_table = {n: n for n in bone_list} + # Construct the rig instances - for name in list_bone_names_depth_first_sorted(self.obj): - self.__create_rigs(name, halt_on_missing) + for name in bone_list: + self.__create_rigs(self.org_rename_table[name], halt_on_missing) # Connect rigs and bones into a tree handled = {} |