Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDemeter Dzadik <Mets>2022-07-12 17:28:14 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2022-07-12 18:13:37 +0300
commit144dbedd9f72b80793541703f3041daae81e3c4f (patch)
tree7e510d1e81b4492164bb93a164c90c907c0efae7 /rigify/rig_ui_template.py
parent9f59c24f1f3b75550a8189bf4080cc7e19838837 (diff)
Rigify: Allow entering name on first generation
Requested by @dexon, see rBAece39d809ce#339214. This patch tries to improve a workflow that was hurt by D11356. One of the goals of that patch was to make the connection between metarig and generated rig stronger and more reliable, by using datablock pointers rather than text-based matching. This allows users to rename their datablocks as they would do with any other datablock in Blender, so there's much more freedom with naming when working with one metarig per generated rig per file. However, this made it hard to duplicate the metarig, make changes to it, and make a new rig out of it within the same file. Renaming several datablocks in this case is not an "option", but an unintuitive necessity. With the patch applied, when the metarig has no target rig, there is an option to input a rig name. If something is input by the user, that name will be used for the rig, the widget collection (by extension the widget objects) and the rig script, as long as they are not specified. So, while still requiring a few more clicks than before, the workflow for duplicating metarigs to make new ones is now much more reasonable: - Duplicate metarig, make changes - Remove the datablock references - Input a rig name - Generate If the a rig object with the same name already existed, it will NOT be overwritten, and the generated rig will have a .001 suffix. This matches the "new" option of the removed "new/overwrite" options. Meanwhile, the other workflow of having one metarig per generated rig per file is not affected at all: The text box for the name input can simply be ignored on the first generation. It will not show up after that, since you would never remove the target rig in this workflow. Differential Revision: https://developer.blender.org/D14757
Diffstat (limited to 'rigify/rig_ui_template.py')
-rw-r--r--rigify/rig_ui_template.py3
1 files changed, 2 insertions, 1 deletions
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):