diff options
-rw-r--r-- | rigify/__init__.py | 8 | ||||
-rw-r--r-- | rigify/generate.py | 4 | ||||
-rw-r--r-- | rigify/rig_ui_template.py | 3 | ||||
-rw-r--r-- | rigify/ui.py | 8 |
4 files changed, 18 insertions, 5 deletions
diff --git a/rigify/__init__.py b/rigify/__init__.py index 10e90b4c..8a45ae05 100644 --- a/rigify/__init__.py +++ b/rigify/__init__.py @@ -550,14 +550,18 @@ def register(): name="Widgets Collection", description="Defines which collection to place widget objects in. If unset, a new one will be created based on the name of the rig") + bpy.types.Armature.rigify_rig_basename = StringProperty(name="Rigify Rig Name", + description="Optional. If specified, this name will be used for the newly generated rig, widget collection and script. Otherwise, a name is generated based on the name of the metarig object by replacing 'metarig' with 'rig', 'META' with 'RIG', or prefixing with 'RIG-'. When updating an already generated rig its name is never changed", + default="") + bpy.types.Armature.rigify_target_rig = PointerProperty(type=bpy.types.Object, name="Rigify Target Rig", - description="Defines which rig to overwrite. If unset, a new one called 'rig' will be created", + description="Defines which rig to overwrite. If unset, a new one will be created with name based on the Rig Name option or the name of the metarig", poll=lambda self, obj: obj.type == 'ARMATURE' and obj.data is not self) bpy.types.Armature.rigify_rig_ui = PointerProperty(type=bpy.types.Text, name="Rigify Target Rig UI", - description="Defines the UI to overwrite. If unset, 'rig_ui.py' will be used") + description="Defines the UI to overwrite. If unset, a new one will be created and named based on the name of the rig") bpy.types.Armature.rigify_finalize_script = PointerProperty(type=bpy.types.Text, name="Finalize Script", diff --git a/rigify/generate.py b/rigify/generate.py index d63399cc..8a2aa942 100644 --- a/rigify/generate.py +++ b/rigify/generate.py @@ -65,7 +65,9 @@ class Generator(base_generate.BaseGenerator): target_rig = meta_data.rigify_target_rig if not target_rig: - if "metarig" in self.metarig.name: + if meta_data.rigify_rig_basename: + rig_new_name = meta_data.rigify_rig_basename + elif "metarig" in self.metarig.name: rig_new_name = self.metarig.name.replace("metarig", "rig") elif "META" in self.metarig.name: rig_new_name = self.metarig.name.replace("META", "RIG") diff --git a/rigify/rig_ui_template.py b/rigify/rig_ui_template.py index b98907ee..d581805f 100644 --- a/rigify/rig_ui_template.py +++ b/rigify/rig_ui_template.py @@ -1159,7 +1159,8 @@ class ScriptGenerator(base_generate.GeneratorPlugin): if script: script.clear() else: - script = bpy.data.texts.new("rig_ui.py") + script_name = self.generator.obj.name + "_ui.py" + script = bpy.data.texts.new(script_name) metarig.data.rigify_rig_ui = script for s in OrderedDict.fromkeys(self.ui_imports): diff --git a/rigify/ui.py b/rigify/ui.py index 68cfd330..3a7af546 100644 --- a/rigify/ui.py +++ b/rigify/ui.py @@ -137,10 +137,16 @@ class DATA_PT_rigify_advanced(bpy.types.Panel): armature_id_store = context.object.data col = layout.column() + + row = col.row() + row.active = not armature_id_store.rigify_target_rig + row.prop(armature_id_store, "rigify_rig_basename", text="Rig Name") + + col.separator() col.row().prop(armature_id_store, "rigify_target_rig", text="Target Rig") col.row().prop(armature_id_store, "rigify_rig_ui", text="Rig UI Script") - col.separator() col.row().prop(armature_id_store, "rigify_widgets_collection") + col.separator() col.row().prop(armature_id_store, "rigify_force_widget_update") col.row().prop(armature_id_store, "rigify_mirror_widgets") col.separator() |