diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2021-01-04 11:48:24 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2021-01-04 11:48:37 +0300 |
commit | 2660631657c4b38e4ee9653c6395988bb9ca8313 (patch) | |
tree | 27aceda2805e481e28963d69a58c09f91c5bba2d /rigify/utils/bones.py | |
parent | a6ee5b0e6f6a945c33b6159fd0536d548b23ccb6 (diff) |
Rigify: move drivers together with constraints and code improvement.
Diffstat (limited to 'rigify/utils/bones.py')
-rw-r--r-- | rigify/utils/bones.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/rigify/utils/bones.py b/rigify/utils/bones.py index 0142922c..7f178481 100644 --- a/rigify/utils/bones.py +++ b/rigify/utils/bones.py @@ -24,7 +24,7 @@ from mathutils import Vector, Matrix, Color from rna_prop_ui import rna_idprop_ui_prop_get from .errors import MetarigError -from .naming import get_name, make_derived_name +from .naming import get_name, make_derived_name, is_control_bone from .misc import pairwise #======================= @@ -391,9 +391,19 @@ class BoneUtilityMixin(object): self.register_new_bone(name, bone_name) return name - def copy_bone_properties(self, src_name, tgt_name, **kwargs): + def copy_bone_properties(self, src_name, tgt_name, *, props=True, ui_controls=None, **kwargs): """Copy pose-mode properties of the bone.""" - copy_bone_properties(self.obj, src_name, tgt_name, **kwargs) + if props: + if ui_controls is None and is_control_bone(tgt_name) and hasattr(self, 'script'): + ui_controls = [tgt_name] + elif ui_controls is True: + ui_controls = self.bones.flatten('ctrl') + + copy_bone_properties(self.obj, src_name, tgt_name, props=props and not ui_controls, **kwargs) + + if props and ui_controls: + from .mechanism import copy_custom_properties_with_ui + copy_custom_properties_with_ui(self, src_name, tgt_name, ui_controls=ui_controls) def rename_bone(self, old_name, new_name): """Rename the bone, returning the actual new name.""" |