diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-02-14 14:21:21 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-02-14 14:21:21 +0300 |
commit | 39c04315e2815bbd24c9ba5f7e0aa11736fa1c48 (patch) | |
tree | 6c88f9d9dc4562374df40f080147b3a6144834e6 /release/scripts/ui/properties_data_armature_rigify.py | |
parent | b02f78ed02fd0c6fbb8f67bba1c123552052321c (diff) |
change python scripts so modules which register with blender have a register() function rather then making import automatically run the register functions (generally considered bad practice by python people)
Diffstat (limited to 'release/scripts/ui/properties_data_armature_rigify.py')
-rw-r--r-- | release/scripts/ui/properties_data_armature_rigify.py | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/release/scripts/ui/properties_data_armature_rigify.py b/release/scripts/ui/properties_data_armature_rigify.py index de516cd8fd4..e737bdfcf9f 100644 --- a/release/scripts/ui/properties_data_armature_rigify.py +++ b/release/scripts/ui/properties_data_armature_rigify.py @@ -327,24 +327,37 @@ class INFO_MT_armature_metarig_add(bpy.types.Menu): text = bpy.utils.display_name(submodule_type) layout.operator("pose.metarig_sample_add", text=text, icon='OUTLINER_OB_ARMATURE').metarig_type = submodule_type -bpy.types.register(DATA_PT_template) +classes = [ + DATA_PT_template, -bpy.types.register(PoseTemplateSettings) -bpy.types.register(PoseTemplate) + PoseTemplateSettings, + PoseTemplate, -bpy.types.register(Reload) -bpy.types.register(Generate) -bpy.types.register(Validate) -bpy.types.register(Sample) -bpy.types.register(Graph) -bpy.types.register(AsScript) + Reload, + Generate, + Validate, + Sample, + Graph, + AsScript, -bpy.types.register(ActiveAssign) -bpy.types.register(ActiveClear) + ActiveAssign, + ActiveClear, + INFO_MT_armature_metarig_add] -bpy.types.register(INFO_MT_armature_metarig_add) - -import space_info menu_func = (lambda self, context: self.layout.menu("INFO_MT_armature_metarig_add", icon='OUTLINER_OB_ARMATURE')) -space_info.INFO_MT_armature_add.append(menu_func) +import space_info # ensure the menu is loaded first + +def register(): + register = bpy.types.register + for cls in classes: + register(cls) + + space_info.INFO_MT_armature_add.append(menu_func) + +def unregister(): + unregister = bpy.types.unregister + for cls in classes: + unregister(cls) + + bpy.types.INFO_MT_armature_add.remove(menu_func) |