diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2021-09-19 19:16:20 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2021-09-19 19:46:16 +0300 |
commit | ecf30de46c368ffddad259c125402a38e6093382 (patch) | |
tree | ed74dc70798c13130f20e01e0c9da91121ae3a4d /rigify/__init__.py | |
parent | e7f22134350127ac18747c367bb0ad9a1ef2d8a3 (diff) |
Rigify: support executing an arbitrary script after generation.
Just in case the user wants to apply some custom changes to the
generated rig, allow executing a text datablock as a python script
after generation completes.
The script is executed with the generated rig active and in object
mode. When executed by rigify, the generator instance is available
via `rigify.get_generator()`. Outside of Rigify generation the return
value is None.
Diffstat (limited to 'rigify/__init__.py')
-rw-r--r-- | rigify/__init__.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/rigify/__init__.py b/rigify/__init__.py index 1bb633f6..dd55be04 100644 --- a/rigify/__init__.py +++ b/rigify/__init__.py @@ -140,6 +140,11 @@ from bpy.props import ( ) +def get_generator(): + """Returns the currently active generator instance.""" + return base_generate.BaseGenerator.instance + + class RigifyFeatureSets(bpy.types.PropertyGroup): name: bpy.props.StringProperty() module_name: bpy.props.StringProperty() @@ -534,6 +539,10 @@ def register(): name="Rigify Target Rig UI", description="Defines the UI to overwrite. If unset, 'rig_ui.py' will be used") + bpy.types.Armature.rigify_finalize_script = PointerProperty(type=bpy.types.Text, + name="Finalize Script", + description="Run this script after generation to apply user-specific changes") + bpy.types.Armature.rigify_rig_basename = StringProperty(name="Rigify Rig Name", description="Defines the name of the Rig. If unset, in 'new' mode 'rig' will be used, in 'overwrite' mode the target rig name will be used", default="") |