diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2020-12-05 18:59:13 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2020-12-07 14:11:53 +0300 |
commit | c93dc355888ec2f9a4376ad6cf0422277c69d565 (patch) | |
tree | cb30669758c2c036c3819b9fecca0a8ef4c5219d /rigify/utils/widgets.py | |
parent | 53bfa6c93a17b6fa6bcc19f86c3c8df17cb57c5c (diff) |
Rigify: keep custom widgets already assigned in metarig.
Also make error handling more robust and extend constraint relink mixin.
Diffstat (limited to 'rigify/utils/widgets.py')
-rw-r--r-- | rigify/utils/widgets.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/rigify/utils/widgets.py b/rigify/utils/widgets.py index f4713372..04e176c6 100644 --- a/rigify/utils/widgets.py +++ b/rigify/utils/widgets.py @@ -57,6 +57,13 @@ def obj_to_bone(obj, rig, bone_name, bone_transform_name=None): def create_widget(rig, bone_name, bone_transform_name=None): """ Creates an empty widget object for a bone, and returns the object. """ + assert rig.mode != 'EDIT' + bone = rig.pose.bones[bone_name] + + # The bone already has a widget + if bone.custom_shape: + return None + obj_name = WGT_PREFIX + rig.name + '_' + bone_name scene = bpy.context.scene collection = ensure_widget_collection(bpy.context) |