change python scripts so modules which register with blender have a register() functi...
authorCampbell Barton <ideasman42@gmail.com>
Sun, 14 Feb 2010 11:21:21 +0000 (11:21 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 14 Feb 2010 11:21:21 +0000 (11:21 +0000)
76 files changed:
release/scripts/io/engine_render_pov.py
release/scripts/io/export_3ds.py
release/scripts/io/export_fbx.py
release/scripts/io/export_mdd.py
release/scripts/io/export_obj.py
release/scripts/io/export_ply.py
release/scripts/io/export_x3d.py
release/scripts/io/import_anim_bvh.py
release/scripts/io/import_scene_3ds.py
release/scripts/io/import_scene_obj.py
release/scripts/io/netrender/__init__.py
release/scripts/modules/bpy/utils.py
release/scripts/modules/bpy_types.py
release/scripts/op/add_armature_human.py
release/scripts/op/add_mesh_torus.py
release/scripts/op/console_python.py
release/scripts/op/console_shell.py
release/scripts/op/euler_filter.py
release/scripts/op/image.py
release/scripts/op/mesh.py
release/scripts/op/object.py
release/scripts/op/object_align.py
release/scripts/op/object_randomize_transform.py
release/scripts/op/presets.py
release/scripts/op/screen_play_rendered_anim.py
release/scripts/op/sequencer.py
release/scripts/op/uv.py
release/scripts/op/uvcalc_follow_active.py
release/scripts/op/uvcalc_smart_project.py
release/scripts/op/vertexpaint_dirt.py
release/scripts/op/wm.py
release/scripts/ui/properties_animviz.py
release/scripts/ui/properties_data_armature.py
release/scripts/ui/properties_data_armature_rigify.py
release/scripts/ui/properties_data_bone.py
release/scripts/ui/properties_data_camera.py
release/scripts/ui/properties_data_curve.py
release/scripts/ui/properties_data_empty.py
release/scripts/ui/properties_data_lamp.py
release/scripts/ui/properties_data_lattice.py
release/scripts/ui/properties_data_mesh.py
release/scripts/ui/properties_data_metaball.py
release/scripts/ui/properties_data_modifier.py
release/scripts/ui/properties_game.py
release/scripts/ui/properties_material.py
release/scripts/ui/properties_object.py
release/scripts/ui/properties_object_constraint.py
release/scripts/ui/properties_particle.py
release/scripts/ui/properties_physics_cloth.py
release/scripts/ui/properties_physics_common.py
release/scripts/ui/properties_physics_field.py
release/scripts/ui/properties_physics_fluid.py
release/scripts/ui/properties_physics_smoke.py
release/scripts/ui/properties_physics_softbody.py
release/scripts/ui/properties_render.py
release/scripts/ui/properties_scene.py
release/scripts/ui/properties_texture.py
release/scripts/ui/properties_world.py
release/scripts/ui/space_buttons.py
release/scripts/ui/space_console.py
release/scripts/ui/space_dopesheet.py
release/scripts/ui/space_filebrowser.py
release/scripts/ui/space_graph.py
release/scripts/ui/space_image.py
release/scripts/ui/space_info.py
release/scripts/ui/space_logic.py
release/scripts/ui/space_nla.py
release/scripts/ui/space_node.py
release/scripts/ui/space_outliner.py
release/scripts/ui/space_sequencer.py
release/scripts/ui/space_text.py
release/scripts/ui/space_time.py
release/scripts/ui/space_userpref.py
release/scripts/ui/space_view3d.py
release/scripts/ui/space_view3d_toolbar.py
source/blender/python/intern/bpy_rna.c

index 33e6dee22d51a4bfa053883cf68535de4e95bd76..6e7c7ea68cc0ba88346bb39e86b23feccc2c36de 100644 (file)
@@ -854,7 +854,6 @@ class PovrayRender(bpy.types.RenderEngine):
 
         self._cleanup()
 
-bpy.types.register(PovrayRender)
 
 # Use some of the existing buttons.
 import properties_render
@@ -944,4 +943,18 @@ class RENDER_PT_povray_radiosity(RenderButtonsPanel):
             col = split.column()
             col.prop(scene, "pov_radio_always_sample")
 
-bpy.types.register(RENDER_PT_povray_radiosity)
+
+classes = [
+    PovrayRender,
+    RENDER_PT_povray_radiosity]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index af6dd7cd59c7e003399177b817bf6d22a414fcfd..4f6972ea2a3a3b663a4707f03055d2b11374eb42 100644 (file)
@@ -1136,11 +1136,17 @@ class Export3DS(bpy.types.Operator):
     def poll(self, context): # Poll isnt working yet
         return context.active_object != None
 
-bpy.types.register(Export3DS)
 
 # Add to a menu
 def menu_func(self, context):
     default_path = bpy.data.filename.replace(".blend", ".3ds")
     self.layout.operator(Export3DS.bl_idname, text="Autodesk 3DS...").path = default_path
 
-bpy.types.INFO_MT_file_export.append(menu_func)
+
+def register():
+    bpy.types.register(Export3DS)
+    bpy.types.INFO_MT_file_export.append(menu_func)
+
+def unregister():
+    bpy.types.unregister(Export3DS)
+    bpy.types.INFO_MT_file_export.remove(menu_func)
index 3574059f942868d4501747245d1f0a4dca6936e5..50a1e9e1c1c31bf62f12a0ee3e0954d9d90da1b5 100644 (file)
@@ -3435,7 +3435,7 @@ class ExportFBX(bpy.types.Operator):
         return {'RUNNING_MODAL'}
 
 
-bpy.types.register(ExportFBX)
+
 
 # if __name__ == "__main__":
 #      bpy.ops.EXPORT_OT_ply(filename="/tmp/test.ply")
@@ -3467,4 +3467,11 @@ def menu_func(self, context):
     default_path = bpy.data.filename.replace(".blend", ".fbx")
     self.layout.operator(ExportFBX.bl_idname, text="Autodesk FBX...").path = default_path
 
-menu_item = bpy.types.INFO_MT_file_export.append(menu_func)
+
+def register():
+    bpy.types.register(ExportFBX)
+    bpy.types.INFO_MT_file_export.append(menu_func)
+    
+def unregister():
+    bpy.types.unregister(ExportFBX)
+    bpy.types.INFO_MT_file_export.remove(menu_func)
index f8fd2f34d2e4b022d52594626df3b0243b8e4cd9..ff25d0dc3f3e12f0bf826ac42200763384c0f558 100644 (file)
@@ -181,14 +181,16 @@ class ExportMDD(bpy.types.Operator):
         wm.add_fileselect(self)
         return {'RUNNING_MODAL'}
 
-bpy.types.register(ExportMDD)
-
 
 def menu_func(self, context):
     default_path = bpy.data.filename.replace(".blend", ".mdd")
     self.layout.operator(ExportMDD.bl_idname, text="Vertex Keyframe Animation (.mdd)...").path = default_path
 
-bpy.types.INFO_MT_file_export.append(menu_func)
 
-if __name__ == '__main__':
-    bpy.ops.export.mdd(path="/tmp/test.mdd")
+def register():
+    bpy.types.register(ExportMDD)
+    bpy.types.INFO_MT_file_export.append(menu_func)
+    
+def unregister():
+    bpy.types.unregister(ExportMDD)
+    bpy.types.INFO_MT_file_export.remove(menu_func)
index add54e8e15640b41f95f24bd1e3ce24d5259474c..2e90d66b7a7a6345c00c7f661ea0c3645e49f83a 100644 (file)
@@ -958,16 +958,20 @@ class ExportOBJ(bpy.types.Operator):
         wm.add_fileselect(self)
         return {'RUNNING_MODAL'}
 
-bpy.types.register(ExportOBJ)
 
 def menu_func(self, context):
     default_path = bpy.data.filename.replace(".blend", ".obj")
     self.layout.operator(ExportOBJ.bl_idname, text="Wavefront (.obj)...").path = default_path
 
-menu_item = bpy.types.INFO_MT_file_export.append(menu_func)
 
-if __name__ == "__main__":
-    bpy.ops.EXPORT_OT_obj(filename="/tmp/test.obj")
+def register():
+    bpy.types.register(ExportOBJ)
+    bpy.types.INFO_MT_file_export.append(menu_func)
+    
+def unregister():
+    bpy.types.unregister(ExportOBJ)
+    bpy.types.INFO_MT_file_export.remove(menu_func)
+
 
 # CONVERSION ISSUES
 # - matrix problem
index d0712d820fdb69e77f56a09dc7fbdb67452bfc03..9bae14ff468ae3d7a89a0c4796cc8b81680a445c 100644 (file)
@@ -313,14 +313,15 @@ class ExportPLY(bpy.types.Operator):
         row.prop(props, "use_colors")
 
 
-bpy.types.register(ExportPLY)
-
-
 def menu_func(self, context):
     default_path = bpy.data.filename.replace(".blend", ".ply")
     self.layout.operator(ExportPLY.bl_idname, text="Stanford (.ply)...").path = default_path
 
-bpy.types.INFO_MT_file_export.append(menu_func)
 
-if __name__ == "__main__":
-    bpy.ops.export.ply(path="/tmp/test.ply")
+def register():
+    bpy.types.register(ExportPLY)
+    bpy.types.INFO_MT_file_export.append(menu_func)
+    
+def unregister():
+    bpy.types.unregister(ExportPLY)
+    bpy.types.INFO_MT_file_export.remove(menu_func)
index c7210e5ceb7870555b998d0322ea0cbc746c1768..be648ddb11a9fdff1216791ec66fa578abec5d97 100644 (file)
@@ -1242,14 +1242,19 @@ class ExportX3D(bpy.types.Operator):
         wm.add_fileselect(self)
         return {'RUNNING_MODAL'}
 
-bpy.types.register(ExportX3D)
-
 
 def menu_func(self, context):
     default_path = bpy.data.filename.replace(".blend", ".x3d")
     self.layout.operator(ExportX3D.bl_idname, text="X3D Extensible 3D (.x3d)...").path = default_path
 
-bpy.types.INFO_MT_file_export.append(menu_func)
+
+def register():
+    bpy.types.register(ExportX3D)
+    bpy.types.INFO_MT_file_export.append(menu_func)
+    
+def unregister():
+    bpy.types.unregister(ExportX3D)
+    bpy.types.INFO_MT_file_export.remove(menu_func)
 
 # NOTES
 # - blender version is hardcoded
index 7b455fb4b28a9cecc40dc27f560c66e9db4b0c84..98b80ae879d5f21b6d726af221438f170d5855d3 100644 (file)
@@ -895,7 +895,12 @@ class BvhImporter(bpy.types.Operator):
         return {'RUNNING_MODAL'}
 
 
-bpy.types.register(BvhImporter)
-
 menu_func = lambda self, context: self.layout.operator(BvhImporter.bl_idname, text="Motion Capture (.bvh)...")
-bpy.types.INFO_MT_file_import.append(menu_func)
+
+def register():
+    bpy.types.register(BvhImporter)
+    bpy.types.INFO_MT_file_export.append(menu_func)
+    
+def unregister():
+    bpy.types.unregister(BvhImporter)
+    bpy.types.INFO_MT_file_export.remove(menu_func)
index 29289ae09704b67689873b6c936b0d1486c91b12..e5f9ef5a8bd2f7a28d86bcece5f890f90ec3043f 100644 (file)
@@ -1031,10 +1031,17 @@ class IMPORT_OT_autodesk_3ds(bpy.types.Operator):
         wm.add_fileselect(self)
         return {'RUNNING_MODAL'}
 
-bpy.types.register(IMPORT_OT_autodesk_3ds)
 
 menu_func = lambda self, context: self.layout.operator(IMPORT_OT_autodesk_3ds.bl_idname, text="3D Studio (.3ds)...")
-bpy.types.INFO_MT_file_import.append(menu_func)
+
+
+def register():
+    bpy.types.register(IMPORT_OT_autodesk_3ds)
+    bpy.types.INFO_MT_file_export.append(menu_func)
+    
+def unregister():
+    bpy.types.unregister(IMPORT_OT_autodesk_3ds)
+    bpy.types.INFO_MT_file_export.remove(menu_func)
 
 # NOTES:
 # why add 1 extra vertex? and remove it when done? - "Answer - eekadoodle - would need to re-order UV's without this since face order isnt always what we give blender, BMesh will solve :D"
index 1ebf08451a6caf783e54dc3509a05869f607a3a4..5ff5ec015d8d28140939b69ac3b926a6c6030c0e 100644 (file)
@@ -1623,11 +1623,16 @@ class IMPORT_OT_obj(bpy.types.Operator):
         return {'RUNNING_MODAL'}
 
 
-bpy.types.register(IMPORT_OT_obj)
+menu_func = lambda self, context: self.layout.operator(IMPORT_OT_obj.bl_idname, text="Wavefront (.obj)...")
 
 
-menu_func = lambda self, context: self.layout.operator(IMPORT_OT_obj.bl_idname, text="Wavefront (.obj)...")
-menu_item = bpy.types.INFO_MT_file_import.append(menu_func)
+def register():
+    bpy.types.register(IMPORT_OT_obj)
+    bpy.types.INFO_MT_file_export.append(menu_func)
+    
+def unregister():
+    bpy.types.unregister(IMPORT_OT_obj)
+    bpy.types.INFO_MT_file_export.remove(menu_func)
 
 
 # NOTES (all line numbers refer to 2.4x import_obj.py, not this file)
index 0ba6b76c653a887919c5c0a9089c2df7e8539150..37102e611ffad52bf35a395241e6b7aedc421755 100644 (file)
@@ -35,3 +35,9 @@ blacklist = []
 init_file = ""
 init_data = True
 init_address = True
+
+def register():
+    pass # TODO
+
+def unregister():
+    pass # TODO
index 6d83450e059376862c2d0e03429d3c8a03e62041..8e2e86acb66a4017c9174a2aac11f053b8e8dac4 100644 (file)
@@ -56,7 +56,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
 
     def test_reload(module):
         try:
-            reload(module)
+            return reload(module)
         except:
             traceback.print_exc()
 
@@ -97,7 +97,15 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
 
                     if reload_scripts and mod:
                         print("Reloading:", mod)
-                        test_reload(mod)
+                        mod = test_reload(mod)
+
+                    if mod:
+                        register = getattr(mod, "register", None)
+                        if register:
+                            register()
+                        else:
+                            print("\nWarning! '%s%s%s' has no register function, this is now a requirement for registerable scripts." % (path, _os.sep, f))
+
 
     if _bpy.app.debug:
         print("Time %.4f" % (time.time() - t_main))
index 8f8151f297648bc7278f01e353b878dff1ff520f..9d2e157f8436155147275093b79297addb3b8444 100644 (file)
@@ -448,9 +448,9 @@ class _GenericUI:
 
         if draw_funcs is None:
 
-            def draw_ls(*args):
+            def draw_ls(self, context):
                 for func in draw_ls._draw_funcs:
-                    func(*args)
+                    func(self, context)
 
             draw_funcs = draw_ls._draw_funcs = [cls.draw]
             cls.draw = draw_ls
@@ -469,6 +469,12 @@ class _GenericUI:
         draw_funcs = cls._dyn_ui_initialize()
         draw_funcs.insert(0, draw_func)
 
+    @classmethod
+    def remove(cls, draw_func):
+        """Remove a draw function that has been added to this menu"""
+        draw_funcs = cls._dyn_ui_initialize()
+        draw_funcs.remove(draw_func)
+
 
 class Panel(StructRNA, _GenericUI):
     __slots__ = ()
index bc47fe4179827061a50cfa5ce75dbcfd948399db..a8fd5cc3c1ff8a38385b513dfbf806823e6dc8a5 100644 (file)
@@ -600,14 +600,17 @@ class AddHuman(bpy.types.Operator):
         bpy.ops.object.mode_set(mode=mode_orig)
         return {'FINISHED'}
 
-# Register the operator
-bpy.types.register(AddHuman)
 
 # Add to a menu
 menu_func = (lambda self, context: self.layout.operator(AddHuman.bl_idname,
                     icon='OUTLINER_OB_ARMATURE', text="Human (Meta-Rig)"))
 
-bpy.types.INFO_MT_armature_add.append(menu_func)
 
-if __name__ == "__main__":
-    bpy.ops.mesh.armature_human_advanced_add()
+def register():
+    bpy.types.register(AddHuman)
+    bpy.types.INFO_MT_armature_add.append(menu_func)
+
+def unregister():
+    bpy.types.unregister(AddHuman)
+    bpy.types.INFO_MT_armature_add.remove(menu_func)
+
index 66b4e9ddf13af74f30858d0cba40e86ad9991ba3..56d4e3ee68711e6c7be94698499327fd5c961ce2 100644 (file)
@@ -157,14 +157,15 @@ class AddTorus(bpy.types.Operator):
         return {'FINISHED'}
 
 
-# Register the operator
-bpy.types.register(AddTorus)
-
 # Add to the menu
 menu_func = (lambda self, context: self.layout.operator(AddTorus.bl_idname,
                                         text="Torus", icon='MESH_DONUT'))
 
-bpy.types.INFO_MT_mesh_add.append(menu_func)
 
-if __name__ == "__main__":
-    bpy.ops.mesh.primitive_torus_add()
+def register():
+    bpy.types.register(AddTorus)
+    bpy.types.INFO_MT_mesh_add.append(menu_func)
+
+def unregister():
+    bpy.types.unregister(AddTorus)
+    bpy.types.INFO_MT_mesh_add.remove(menu_func)
index 6fd3ba394efe5453b042f0e3e542acef0555ef1d..dab4899b3e64e534482ca04acb5ea8db52a18390 100644 (file)
@@ -196,3 +196,9 @@ def banner(context):
     console.locals["C"] = bpy.context
 
     return {'FINISHED'}
+
+def register():
+    pass
+
+def unregister():
+    pass
index 8a96dde3ceeb4fe270db1d2269a29a639adc6aed..7e6f2847cdaf29bc71509877f6393b8e59dd80cf 100644 (file)
@@ -76,3 +76,10 @@ def banner(context):
     sc.prompt = os.getcwd() + PROMPT
 
     return {'FINISHED'}
+
+
+def register():
+    pass
+
+def unregister():
+    pass
index 030d3c54bacb8fc19d9c88c26c589f6707cca2c5..c472af6c8c404ad8902c70ea0a7f9437e3f4a9e0 100644 (file)
@@ -55,7 +55,11 @@ class DiscontFilterOp(bpy.types.Operator):
         main(context)
         return {'FINISHED'}
 
-bpy.types.register(DiscontFilterOp)
+def register():
+    bpy.types.register(DiscontFilterOp)
+
+def unregister():
+    bpy.types.unregister(DiscontFilterOp)
 
 if __name__ == "__main__":
     bpy.ops.graph.discont_filter()
index 37d2936f7af445854fc2711caf09af33116b1922..18a286ccf5b4e49ddcc5d0591e6e24046bb35ef8 100644 (file)
@@ -41,4 +41,9 @@ class SaveDirty(bpy.types.Operator):
                     image.save(path=path)
         return {'FINISHED'}
 
-bpy.types.register(SaveDirty)
\ No newline at end of file
+
+def register():
+    bpy.types.register(SaveDirty)
+
+def unregister():
+    bpy.types.unregister(SaveDirty)
index d8b28094e3a48b2eb3c526b3ba5a96289f9bb4e9..08363c838928e4988355a636143b815c7c5d8d4c 100644 (file)
@@ -173,10 +173,20 @@ class MeshMirrorUV(bpy.types.Operator):
 
         return {'FINISHED'}
 
+
 # Register the operator
-bpy.types.register(MeshSelectInteriorFaces)
-bpy.types.register(MeshMirrorUV)
+classes = [
+    MeshSelectInteriorFaces,
+    MeshMirrorUV]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
 
-if __name__ == "__main__":
-    # bpy.ops.mesh.faces_select_interior()
-    bpy.ops.mesh.faces_miror_uv()
index 4759d8e5082eba0e73fcca16b3965d8707ef4a02..b17f824b8a9fa22217370c6f66e4b692f559df81 100644 (file)
@@ -466,13 +466,23 @@ class MakeDupliFace(bpy.types.Operator):
         self._main(context)
         return {'FINISHED'}
 
-# if __name__ == "__main__":
-#     bpy.ops.uv.simple_operator()
 
+classes = [
+    SelectPattern,
+    SelectCamera,
+    SubdivisionSet,
+    ShapeTransfer,
+    JoinUVs,
+    MakeDupliFace]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
 
-bpy.types.register(SelectPattern)
-bpy.types.register(SelectCamera)
-bpy.types.register(SubdivisionSet)
-bpy.types.register(ShapeTransfer)
-bpy.types.register(JoinUVs)
-bpy.types.register(MakeDupliFace)
index 4ad5acc8cc97e3ff9359fe1094e15d6549e4dca0..35d8b2c1d07d93613ee1f6e68adeb8097aa91b4e 100644 (file)
@@ -197,11 +197,16 @@ class AlignObjects(bpy.types.Operator):
         return {'FINISHED'}
 
 
-bpy.types.register(AlignObjects)
-
 def menu_func(self, context):
     if context.mode == 'OBJECT':
         self.layout.operator(AlignObjects.bl_idname,
         text="Align Objects")
 
-bpy.types.VIEW3D_MT_transform.append(menu_func)
\ No newline at end of file
+
+def register():
+    bpy.types.register(AlignObjects)
+    bpy.types.VIEW3D_MT_transform.append(menu_func)
+
+def unregister():
+    bpy.types.unregister(AlignObjects)
+    bpy.types.VIEW3D_MT_transform.remove(menu_func)
index a33b2701b63458c2ef4e8791c66a0b5997f8205e..f44219469f2717da4872afa04444dced4a7a2a78 100644 (file)
@@ -134,13 +134,17 @@ class RandomizeLocRotSize(bpy.types.Operator):
         return {'FINISHED'}
 
 
-# Register the operator
-bpy.types.register(RandomizeLocRotSize)
-
-
 def menu_func(self, context):
     if context.mode == 'OBJECT':
         self.layout.operator(RandomizeLocRotSize.bl_idname,
         text="Randomize Transform")
 
-bpy.types.VIEW3D_MT_transform.append(menu_func)
+
+def register():
+    bpy.types.register(RandomizeLocRotSize)
+    bpy.types.VIEW3D_MT_transform.append(menu_func)
+
+def unregister():
+    bpy.types.unregister(RandomizeLocRotSize)
+    bpy.types.VIEW3D_MT_transform.remove(menu_func)
+
index d1e059622fca653c0f15b65561b341cc529ac662..0d220fe9c2bfcd99afd57422737b49dc34a15f43 100644 (file)
@@ -158,7 +158,20 @@ class AddPresetSunSky(AddPresetBase):
     preset_subdir = "sunsky"
 
 
-bpy.types.register(AddPresetRender)
-bpy.types.register(AddPresetSSS)
-bpy.types.register(AddPresetCloth)
-bpy.types.register(AddPresetSunSky)
+classes = [
+    AddPresetRender,
+    AddPresetSSS,
+    AddPresetCloth,
+    AddPresetSunSky]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
+
index 18843e41028b997162abfe3f9b6079706691f258..73b30b4e6acf286ca55e9fe848443f90f4651543 100644 (file)
@@ -114,4 +114,9 @@ class PlayRenderedAnim(bpy.types.Operator):
 
         return('FINISHED',)
 
-bpy.types.register(PlayRenderedAnim)
+
+def register():
+    bpy.types.register(PlayRenderedAnim)
+
+def unregister():
+    bpy.types.unregister(PlayRenderedAnim)
index 9d3ee4a7fd7254963945eec2c803ef8e35c42d31..3ce2aa87d84b28437810cddbda17614648461dbf 100644 (file)
@@ -70,7 +70,12 @@ class SequencerCrossfadeSounds(bpy.types.Operator):
             self.report({'ERROR'}, "The selected strips don't overlap.")
             return {'CANCELLED'}
 
-bpy.types.register(SequencerCrossfadeSounds)
+
+def register():
+    bpy.types.register(SequencerCrossfadeSounds)
+
+def unregister():
+    bpy.types.unregister(SequencerCrossfadeSounds)
 
 if __name__ == "__main__":
     bpy.ops.sequencer.crossfade_sounds()
index 1c425f6c451ec2ffc8ce328e5f13c8e723b125e7..95a234b9c79a8b689434fc7d5103839b0cae2a5d 100644 (file)
@@ -196,15 +196,16 @@ class ExportUVLayout(bpy.types.Operator):
         wm.add_fileselect(self)
         return {'RUNNING_MODAL'}
 
-# Register the operator
-bpy.types.register(ExportUVLayout)
-
 
 def menu_func(self, context):
     default_path = bpy.data.filename.replace(".blend", ".svg")
     self.layout.operator(ExportUVLayout.bl_idname).path = default_path
 
-bpy.types.IMAGE_MT_uvs.append(menu_func)
 
-#if __name__ == "__main__":
-#    bpy.ops.uv.export_layout(path="/home/ideasman42/foo.svg")
+def register():
+    bpy.types.register(ExportUVLayout)
+    bpy.types.IMAGE_MT_uvs.append(menu_func)
+
+def unreguster():
+    bpy.types.unregister(ExportUVLayout)
+    bpy.types.IMAGE_MT_uvs.remove(menu_func)
index baca4060e0ad1a481d7ad29e484f2617d6423e59..2abacfb081fd14b4abae991e800b2cd8ea2f11f2 100644 (file)
@@ -259,11 +259,16 @@ class FollowActiveQuads(bpy.types.Operator):
         main(context, self)
         return {'FINISHED'}
 
-bpy.types.register(FollowActiveQuads)
 
 # Add to a menu
 menu_func = (lambda self, context: self.layout.operator(FollowActiveQuads.bl_idname))
-bpy.types.VIEW3D_MT_uv_map.append(menu_func)
 
-if __name__ == '__main__':
-    bpy.ops.uv.follow_active_quads()
+
+def register():
+    bpy.types.register(FollowActiveQuads)
+    bpy.types.VIEW3D_MT_uv_map.append(menu_func)
+
+def unregister():
+    bpy.types.unregister(FollowActiveQuads)
+    bpy.types.VIEW3D_MT_uv_map.remove(menu_func)
+
index 1256358a32b8e5d1600432d08cc262fa27915ffc..85d1983d67c16e0b57086d73cb606a3a1f55cef2 100644 (file)
@@ -1134,13 +1134,16 @@ class SmartProject(bpy.types.Operator):
         main(context, self.properties.island_margin, self.properties.angle_limit)
         return {'FINISHED'}
 
-bpy.types.register(SmartProject)
 
 # Add to a menu
 menu_func = (lambda self, context: self.layout.operator(SmartProject.bl_idname,
                                         text="Smart Project"))
 
-bpy.types.VIEW3D_MT_uv_map.append(menu_func)
 
-if __name__ == '__main__':
-    bpy.ops.uv.smart_project()
+def register():
+    bpy.types.register(SmartProject)
+    bpy.types.VIEW3D_MT_uv_map.append(menu_func)
+    
+def unregister():
+    bpy.types.unregister(SmartProject)
+    bpy.types.VIEW3D_MT_uv_map.remove(menu_func)
index 030fed21ac2dc22bc067f1b609ceb013ca58ba3f..142563902e95f458b9ef65656d06bba79c5f8c86 100644 (file)
@@ -174,7 +174,10 @@ class VertexPaintDirt(bpy.types.Operator):
 
         return('FINISHED',)
 
-bpy.types.register(VertexPaintDirt)
 
-if __name__ == "__main__":
-    bpy.ops.mesh.vertex_paint_dirt()
+def register():
+    bpy.types.register(VertexPaintDirt)
+
+def unregister():
+    bpy.types.unregister(VertexPaintDirt)
+
index 077d633757a40c212aeae20c5a9d9f77c370ae8e..07c6bbf0c3685ef028a9080f608003d4c4b5f162 100644 (file)
@@ -418,26 +418,38 @@ class WM_OT_reload_scripts(bpy.types.Operator):
         return {'FINISHED'}
 
 
-bpy.types.register(MESH_OT_delete_edgeloop)
-
-bpy.types.register(WM_OT_context_set_boolean)
-bpy.types.register(WM_OT_context_set_int)
-bpy.types.register(WM_OT_context_set_float)
-bpy.types.register(WM_OT_context_set_string)
-bpy.types.register(WM_OT_context_set_enum)
-bpy.types.register(WM_OT_context_set_value)
-bpy.types.register(WM_OT_context_toggle)
-bpy.types.register(WM_OT_context_toggle_enum)
-bpy.types.register(WM_OT_context_cycle_enum)
-bpy.types.register(WM_OT_context_cycle_int)
-
-bpy.types.register(WM_OT_doc_view)
-bpy.types.register(WM_OT_doc_edit)
-
-bpy.types.register(WM_OT_reload_scripts)
-
-# experemental!
 import rna_prop_ui
-bpy.types.register(rna_prop_ui.WM_OT_properties_edit)
-bpy.types.register(rna_prop_ui.WM_OT_properties_add)
-bpy.types.register(rna_prop_ui.WM_OT_properties_remove)
+
+classes = [
+    MESH_OT_delete_edgeloop,
+
+    WM_OT_context_set_boolean,
+    WM_OT_context_set_int,
+    WM_OT_context_set_float,
+    WM_OT_context_set_string,
+    WM_OT_context_set_enum,
+    WM_OT_context_set_value,
+    WM_OT_context_toggle,
+    WM_OT_context_toggle_enum,
+    WM_OT_context_cycle_enum,
+    WM_OT_context_cycle_int,
+
+    WM_OT_doc_view,
+    WM_OT_doc_edit,
+
+    WM_OT_reload_scripts,
+
+    # experemental!
+    rna_prop_ui.WM_OT_properties_edit,
+    rna_prop_ui.WM_OT_properties_add,
+    rna_prop_ui.WM_OT_properties_remove]
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index 7954ac199dd8a3f3df1ddf96d5d0976c007f9884..556fe6f165d13ae92533adc774d7e7332be010fd 100644 (file)
@@ -157,8 +157,19 @@ class DATA_PT_motion_paths(MotionPathButtonsPanel):
         col.operator("pose.paths_clear", text="Clear Paths")
 
 
-
-#bpy.types.register(OBJECT_PT_onion_skinning)
-#bpy.types.register(DATA_PT_onion_skinning)
-bpy.types.register(OBJECT_PT_motion_paths)
-bpy.types.register(DATA_PT_motion_paths)
+classes = [
+    OBJECT_PT_motion_paths,
+    DATA_PT_motion_paths]
+
+# OBJECT_PT_onion_skinning
+# DATA_PT_onion_skinning
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index 43800955291a21cd497dd544ca2d2d693ecdd7c2..47d8c821952be5660886f8f07bbbf218c83b3f7c 100644 (file)
@@ -253,12 +253,22 @@ class DATA_PT_iksolver_itasc(DataButtonsPanel):
                 row.prop(itasc, "dampmax", text="Damp", slider=True)
                 row.prop(itasc, "dampeps", text="Eps", slider=True)
 
-
-bpy.types.register(DATA_PT_context_arm)
-bpy.types.register(DATA_PT_skeleton)
-bpy.types.register(DATA_PT_display)
-bpy.types.register(DATA_PT_bone_groups)
-bpy.types.register(DATA_PT_ghost)
-bpy.types.register(DATA_PT_iksolver_itasc)
-
-bpy.types.register(DATA_PT_custom_props_arm)
+classes = [
+    DATA_PT_context_arm,
+    DATA_PT_skeleton,
+    DATA_PT_display,
+    DATA_PT_bone_groups,
+    DATA_PT_ghost,
+    DATA_PT_iksolver_itasc,
+
+    DATA_PT_custom_props_arm]
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index de516cd8fd450c68d3743636a43349afca490685..e737bdfcf9f0dd11d538fb18bb3b20036ae4fd3f 100644 (file)
@@ -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)
index 1a57cb4052276dcae044511419dcf3a6e940952f..fbd9e7153199900c3dd1fcb357f767e8033dd3df 100644 (file)
@@ -387,13 +387,23 @@ class BONE_PT_deform(BoneButtonsPanel):
         col.label(text="Offset:")
         col.prop(bone, "cyclic_offset")
 
-
-bpy.types.register(BONE_PT_context_bone)
-bpy.types.register(BONE_PT_transform)
-bpy.types.register(BONE_PT_transform_locks)
-bpy.types.register(BONE_PT_relations)
-bpy.types.register(BONE_PT_display)
-bpy.types.register(BONE_PT_inverse_kinematics)
-bpy.types.register(BONE_PT_deform)
-
-bpy.types.register(BONE_PT_custom_props)
+classes = [
+    BONE_PT_context_bone,
+    BONE_PT_transform,
+    BONE_PT_transform_locks,
+    BONE_PT_relations,
+    BONE_PT_display,
+    BONE_PT_inverse_kinematics,
+    BONE_PT_deform,
+
+    BONE_PT_custom_props]
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index de2c7ef658adfc58b242319102cdc191d04a0ada..107d88bcaefb48ed90caea28bd0edc1981e25200 100644 (file)
@@ -150,8 +150,20 @@ class DATA_PT_camera_display(DataButtonsPanel):
         sub.prop(cam, "passepartout_alpha", text="Alpha", slider=True)
 
 
-bpy.types.register(DATA_PT_context_camera)
-bpy.types.register(DATA_PT_camera)
-bpy.types.register(DATA_PT_camera_display)
+classes = [
+    DATA_PT_context_camera,
+    DATA_PT_camera,
+    DATA_PT_camera_display,
 
-bpy.types.register(DATA_PT_custom_props_camera)
+    DATA_PT_custom_props_camera]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index 123bdf281e5a3d75f331b9f3408ee393254df412..f5a35dd1272dd55eadceafce4541410937f7a6b3 100644 (file)
@@ -383,13 +383,25 @@ class DATA_PT_textboxes(DataButtonsPanel):
             col.prop(box, "y", text="Y")
 
 
-bpy.types.register(DATA_PT_context_curve)
-bpy.types.register(DATA_PT_shape_curve)
-bpy.types.register(DATA_PT_geometry_curve)
-bpy.types.register(DATA_PT_pathanim)
-bpy.types.register(DATA_PT_active_spline)
-bpy.types.register(DATA_PT_font)
-bpy.types.register(DATA_PT_paragraph)
-bpy.types.register(DATA_PT_textboxes)
-
-bpy.types.register(DATA_PT_custom_props_curve)
+classes = [
+    DATA_PT_context_curve,
+    DATA_PT_shape_curve,
+    DATA_PT_geometry_curve,
+    DATA_PT_pathanim,
+    DATA_PT_active_spline,
+    DATA_PT_font,
+    DATA_PT_paragraph,
+    DATA_PT_textboxes,
+
+    DATA_PT_custom_props_curve]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index e3c1a83c74a3d6cbc26a0d54d21cc566d50c116a..3288ce39de6c89d03a6988d26d9471003dd95b74 100644 (file)
@@ -47,4 +47,16 @@ class DATA_PT_empty(DataButtonsPanel):
 
         layout.prop(ob, "empty_draw_size", text="Size")
 
-bpy.types.register(DATA_PT_empty)
+
+classes = [
+    DATA_PT_empty]
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index 54d7142ba2d3777cd08ff2c5f0e9c479d5455922..429d78c651ac83f6b43a3164cdf2a150b1e41519 100644 (file)
@@ -391,15 +391,27 @@ class DATA_PT_falloff_curve(DataButtonsPanel):
         self.layout.template_curve_mapping(lamp, "falloff_curve")
 
 
-bpy.types.register(LAMP_MT_sunsky_presets)
-
-bpy.types.register(DATA_PT_context_lamp)
-bpy.types.register(DATA_PT_preview)
-bpy.types.register(DATA_PT_lamp)
-bpy.types.register(DATA_PT_falloff_curve)
-bpy.types.register(DATA_PT_area)
-bpy.types.register(DATA_PT_spot)
-bpy.types.register(DATA_PT_shadow)
-bpy.types.register(DATA_PT_sunsky)
-
-bpy.types.register(DATA_PT_custom_props_lamp)
+classes = [
+    LAMP_MT_sunsky_presets,
+
+    DATA_PT_context_lamp,
+    DATA_PT_preview,
+    DATA_PT_lamp,
+    DATA_PT_falloff_curve,
+    DATA_PT_area,
+    DATA_PT_spot,
+    DATA_PT_shadow,
+    DATA_PT_sunsky,
+
+    DATA_PT_custom_props_lamp]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index c64462bd97047556cb81f21517cec4a3f8be7e5f..75496815c5267f6cd9ebf4745c371ca8976b60f6 100644 (file)
@@ -96,7 +96,19 @@ class DATA_PT_lattice(DataButtonsPanel):
         layout.prop(lat, "outside")
 
 
-bpy.types.register(DATA_PT_context_lattice)
-bpy.types.register(DATA_PT_lattice)
+classes = [
+    DATA_PT_context_lattice,
+    DATA_PT_lattice,
 
-bpy.types.register(DATA_PT_custom_props_lattice)
+    DATA_PT_custom_props_lattice]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index b80c56ea6a5259d22ccf6817989935ebf19055fe..a800a8f3d9a4647021a5393aad46795d80eadb2f 100644 (file)
@@ -304,15 +304,28 @@ class DATA_PT_vertex_colors(DataButtonsPanel):
         if lay:
             layout.prop(lay, "name")
 
-bpy.types.register(MESH_MT_vertex_group_specials)
-bpy.types.register(MESH_MT_shape_key_specials)
-
-bpy.types.register(DATA_PT_context_mesh)
-bpy.types.register(DATA_PT_normals)
-bpy.types.register(DATA_PT_settings)
-bpy.types.register(DATA_PT_vertex_groups)
-bpy.types.register(DATA_PT_shape_keys)
-bpy.types.register(DATA_PT_uv_texture)
-bpy.types.register(DATA_PT_vertex_colors)
-
-bpy.types.register(DATA_PT_custom_props_mesh)
+
+classes = [
+    MESH_MT_vertex_group_specials,
+    MESH_MT_shape_key_specials,
+
+    DATA_PT_context_mesh,
+    DATA_PT_normals,
+    DATA_PT_settings,
+    DATA_PT_vertex_groups,
+    DATA_PT_shape_keys,
+    DATA_PT_uv_texture,
+    DATA_PT_vertex_colors,
+
+    DATA_PT_custom_props_mesh]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index b249ceba0883092747f9503e7f5227cd1631c160..4a6aab0cc2a31fb1241f10a57d0522d568ca72b4 100644 (file)
@@ -135,8 +135,21 @@ class DATA_PT_metaball_element(DataButtonsPanel):
             col.prop(metaelem, "size_x", text="X")
             col.prop(metaelem, "size_y", text="Y")
 
-bpy.types.register(DATA_PT_context_metaball)
-bpy.types.register(DATA_PT_metaball)
-bpy.types.register(DATA_PT_metaball_element)
 
-bpy.types.register(DATA_PT_custom_props_metaball)
+classes = [
+    DATA_PT_context_metaball,
+    DATA_PT_metaball,
+    DATA_PT_metaball_element,
+
+    DATA_PT_custom_props_metaball]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index eb91a4dc70cb473a35b0d347ded27e6ac9a0a5ec..10d499115d757e1f114f37e878532e66211a67d8 100644 (file)
@@ -729,4 +729,17 @@ class DATA_PT_modifiers(DataButtonsPanel):
         col.prop(md, "width", slider=True)
         col.prop(md, "narrowness", slider=True)
 
-bpy.types.register(DATA_PT_modifiers)
+
+classes = [
+    DATA_PT_modifiers]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index afed8f14bc4a2a1e45c8018f3329e8807c4a5abf..626c246535a4dabfad31d0bb0a81651c9cd238ee 100644 (file)
@@ -196,10 +196,6 @@ class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel):
         col.prop(game, "collision_compound", text="Compound")
 
 
-bpy.types.register(PHYSICS_PT_game_physics)
-bpy.types.register(PHYSICS_PT_game_collision_bounds)
-
-
 class RenderButtonsPanel(bpy.types.Panel):
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
@@ -386,13 +382,6 @@ class RENDER_PT_game_sound(RenderButtonsPanel):
         layout.prop(scene, "speed_of_sound", text="Speed")
         layout.prop(scene, "doppler_factor")
 
-bpy.types.register(RENDER_PT_game)
-bpy.types.register(RENDER_PT_game_player)
-bpy.types.register(RENDER_PT_game_stereo)
-bpy.types.register(RENDER_PT_game_shading)
-bpy.types.register(RENDER_PT_game_performance)
-bpy.types.register(RENDER_PT_game_sound)
-
 
 class WorldButtonsPanel(bpy.types.Panel):
     bl_space_type = 'PROPERTIES'
@@ -521,7 +510,30 @@ class WORLD_PT_game_physics(WorldButtonsPanel):
             col.label(text="Logic Steps:")
             col.prop(gs, "logic_step_max", text="Max")
 
-bpy.types.register(WORLD_PT_game_context_world)
-bpy.types.register(WORLD_PT_game_world)
-bpy.types.register(WORLD_PT_game_mist)
-bpy.types.register(WORLD_PT_game_physics)
+
+classes = [
+    PHYSICS_PT_game_physics,
+    PHYSICS_PT_game_collision_bounds,
+
+    RENDER_PT_game,
+    RENDER_PT_game_player,
+    RENDER_PT_game_stereo,
+    RENDER_PT_game_shading,
+    RENDER_PT_game_performance,
+    RENDER_PT_game_sound,
+
+    WORLD_PT_game_context_world,
+    WORLD_PT_game_world,
+    WORLD_PT_game_mist,
+    WORLD_PT_game_physics]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index 88611766dd6230f36909de1861b0c4b84d30e2d3..cf705c8d693688ca180101638b41b76bb05d29fe 100644 (file)
@@ -773,22 +773,6 @@ class MATERIAL_PT_flare(MaterialButtonsPanel):
         col.prop(halo, "flares_sub", text="Subflares")
         col.prop(halo, "flare_subsize", text="Subsize")
 
-bpy.types.register(MATERIAL_PT_context_material)
-bpy.types.register(MATERIAL_PT_preview)
-bpy.types.register(MATERIAL_PT_diffuse)
-bpy.types.register(MATERIAL_PT_specular)
-bpy.types.register(MATERIAL_PT_shading)
-bpy.types.register(MATERIAL_PT_transp)
-bpy.types.register(MATERIAL_PT_mirror)
-bpy.types.register(MATERIAL_PT_sss)
-bpy.types.register(MATERIAL_PT_halo)
-bpy.types.register(MATERIAL_PT_flare)
-bpy.types.register(MATERIAL_PT_physics)
-bpy.types.register(MATERIAL_PT_strand)
-bpy.types.register(MATERIAL_PT_options)
-bpy.types.register(MATERIAL_PT_shadow)
-bpy.types.register(MATERIAL_PT_transp_game)
-
 
 class VolumeButtonsPanel(bpy.types.Panel):
     bl_space_type = 'PROPERTIES'
@@ -927,14 +911,43 @@ class MATERIAL_PT_volume_integration(VolumeButtonsPanel):
         col.label()
         col.prop(vol, "depth_cutoff")
 
-bpy.types.register(MATERIAL_MT_sss_presets)
-bpy.types.register(MATERIAL_MT_specials)
-
-bpy.types.register(MATERIAL_PT_volume_density)
-bpy.types.register(MATERIAL_PT_volume_shading)
-bpy.types.register(MATERIAL_PT_volume_lighting)
-bpy.types.register(MATERIAL_PT_volume_transp)
-
-bpy.types.register(MATERIAL_PT_volume_integration)
 
-bpy.types.register(MATERIAL_PT_custom_props)
+classes = [
+    MATERIAL_PT_context_material,
+    MATERIAL_PT_preview,
+    MATERIAL_PT_diffuse,
+    MATERIAL_PT_specular,
+    MATERIAL_PT_shading,
+    MATERIAL_PT_transp,
+    MATERIAL_PT_mirror,
+    MATERIAL_PT_sss,
+    MATERIAL_PT_halo,
+    MATERIAL_PT_flare,
+    MATERIAL_PT_physics,
+    MATERIAL_PT_strand,
+    MATERIAL_PT_options,
+    MATERIAL_PT_shadow,
+    MATERIAL_PT_transp_game,
+
+    MATERIAL_MT_sss_presets,
+    MATERIAL_MT_specials,
+
+    MATERIAL_PT_volume_density,
+    MATERIAL_PT_volume_shading,
+    MATERIAL_PT_volume_lighting,
+    MATERIAL_PT_volume_transp,
+
+    MATERIAL_PT_volume_integration,
+
+    MATERIAL_PT_custom_props]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index 6a36e899570fbaf1fc11b7c736645c88de1f963f..c50edccbab598bf742a897d12eb61d896a829871 100644 (file)
@@ -305,13 +305,25 @@ class OBJECT_PT_animation(ObjectButtonsPanel):
         row.active = (ob.parent is not None)
 
 
-bpy.types.register(OBJECT_PT_context_object)
-bpy.types.register(OBJECT_PT_transform)
-bpy.types.register(OBJECT_PT_transform_locks)
-bpy.types.register(OBJECT_PT_relations)
-bpy.types.register(OBJECT_PT_groups)
-bpy.types.register(OBJECT_PT_display)
-bpy.types.register(OBJECT_PT_duplication)
-bpy.types.register(OBJECT_PT_animation)
-
-bpy.types.register(OBJECT_PT_custom_props)
+classes = [
+    OBJECT_PT_context_object,
+    OBJECT_PT_transform,
+    OBJECT_PT_transform_locks,
+    OBJECT_PT_relations,
+    OBJECT_PT_groups,
+    OBJECT_PT_display,
+    OBJECT_PT_duplication,
+    OBJECT_PT_animation,
+
+    OBJECT_PT_custom_props]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index 8ad9634b682bdcb6462543b4978f0eb3cebba23e..3ec647cda0c84926249bd88c82e47a95e0922aa8 100644 (file)
@@ -754,5 +754,18 @@ class BONE_PT_constraints(ConstraintButtonsPanel):
         for con in context.pose_bone.constraints:
             self.draw_constraint(context, con)
 
-bpy.types.register(OBJECT_PT_constraints)
-bpy.types.register(BONE_PT_constraints)
+
+classes = [
+    OBJECT_PT_constraints,
+    BONE_PT_constraints]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index 093494befdd0cf0508a1ce1ed5589a54d26cdc13..88e2ef7d264e232bd2595842078dc8c449bf5c58 100644 (file)
@@ -998,19 +998,32 @@ class PARTICLE_PT_vertexgroups(ParticleButtonsPanel):
         row.prop_object(psys, "vertex_group_field", ob, "vertex_groups", text="Field")
         row.prop(psys, "vertex_group_field_negate", text="")
 
-bpy.types.register(PARTICLE_PT_context_particles)
-bpy.types.register(PARTICLE_PT_hair_dynamics)
-bpy.types.register(PARTICLE_PT_cache)
-bpy.types.register(PARTICLE_PT_emission)
-bpy.types.register(PARTICLE_PT_velocity)
-bpy.types.register(PARTICLE_PT_rotation)
-bpy.types.register(PARTICLE_PT_physics)
-bpy.types.register(PARTICLE_PT_boidbrain)
-bpy.types.register(PARTICLE_PT_render)
-bpy.types.register(PARTICLE_PT_draw)
-bpy.types.register(PARTICLE_PT_children)
-bpy.types.register(PARTICLE_PT_field_weights)
-bpy.types.register(PARTICLE_PT_force_fields)
-bpy.types.register(PARTICLE_PT_vertexgroups)
-
-bpy.types.register(PARTICLE_PT_custom_props)
+
+classes = [
+    PARTICLE_PT_context_particles,
+    PARTICLE_PT_hair_dynamics,
+    PARTICLE_PT_cache,
+    PARTICLE_PT_emission,
+    PARTICLE_PT_velocity,
+    PARTICLE_PT_rotation,
+    PARTICLE_PT_physics,
+    PARTICLE_PT_boidbrain,
+    PARTICLE_PT_render,
+    PARTICLE_PT_draw,
+    PARTICLE_PT_children,
+    PARTICLE_PT_field_weights,
+    PARTICLE_PT_force_fields,
+    PARTICLE_PT_vertexgroups,
+
+    PARTICLE_PT_custom_props]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index 5b205e74c268dd1f9f3d09041147e9212f17c005..49db6e34bf19653bad8646f6f837816e55f944e9 100644 (file)
@@ -228,10 +228,23 @@ class PHYSICS_PT_cloth_field_weights(PhysicButtonsPanel):
         cloth = context.cloth.settings
         effector_weights_ui(self, context, cloth.effector_weights)
 
-bpy.types.register(CLOTH_MT_presets)
 
-bpy.types.register(PHYSICS_PT_cloth)
-bpy.types.register(PHYSICS_PT_cloth_cache)
-bpy.types.register(PHYSICS_PT_cloth_collision)
-bpy.types.register(PHYSICS_PT_cloth_stiffness)
-bpy.types.register(PHYSICS_PT_cloth_field_weights)
+classes = [
+    CLOTH_MT_presets,
+
+    PHYSICS_PT_cloth,
+    PHYSICS_PT_cloth_cache,
+    PHYSICS_PT_cloth_collision,
+    PHYSICS_PT_cloth_stiffness,
+    PHYSICS_PT_cloth_field_weights]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index dab4cc27a8dfac4b58605197a34f67d616007510..bf77004d298e793d854c31bc845880ce394eae0d 100644 (file)
@@ -210,3 +210,10 @@ def basic_force_field_falloff_ui(self, context, field):
     sub = col.column()
     sub.active = field.use_max_distance
     sub.prop(field, "maximum_distance", text="Distance")
+
+
+def register():
+    pass
+
+def unregister():
+    pass
index fdedcd440ec7516bc64b37e4609437c328477075..a336d2a7c04e44acc59d4f0e36a44c8c14dc5cab 100644 (file)
@@ -242,5 +242,18 @@ class PHYSICS_PT_collision(PhysicButtonsPanel):
             col.label(text="Force Fields:")
             col.prop(settings, "absorption", text="Absorption")
 
-bpy.types.register(PHYSICS_PT_field)
-bpy.types.register(PHYSICS_PT_collision)
+
+classes = [
+    PHYSICS_PT_field,
+    PHYSICS_PT_collision]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index 1a841baf5b34ea57a04ad00dce160b756d6d9443..ff8080d450abb7a20539b61f14c0e10134300ebb 100644 (file)
@@ -291,7 +291,20 @@ class PHYSICS_PT_domain_particles(PhysicButtonsPanel):
         col.prop(fluid, "tracer_particles")
         col.prop(fluid, "generate_particles")
 
-bpy.types.register(PHYSICS_PT_fluid)
-bpy.types.register(PHYSICS_PT_domain_gravity)
-bpy.types.register(PHYSICS_PT_domain_boundary)
-bpy.types.register(PHYSICS_PT_domain_particles)
+
+classes = [
+    PHYSICS_PT_fluid,
+    PHYSICS_PT_domain_gravity,
+    PHYSICS_PT_domain_boundary,
+    PHYSICS_PT_domain_particles]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index 2cba19dc8dcfb0409f1d6bcc395b432592327296..5fcb7f9cc2226df59bb578775480aeab72613f76 100644 (file)
@@ -238,9 +238,22 @@ class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel):
         domain = context.smoke.domain_settings
         effector_weights_ui(self, context, domain.effector_weights)
 
-bpy.types.register(PHYSICS_PT_smoke)
-bpy.types.register(PHYSICS_PT_smoke_field_weights)
-bpy.types.register(PHYSICS_PT_smoke_cache)
-bpy.types.register(PHYSICS_PT_smoke_highres)
-bpy.types.register(PHYSICS_PT_smoke_groups)
-bpy.types.register(PHYSICS_PT_smoke_cache_highres)
+
+classes = [
+    PHYSICS_PT_smoke,
+    PHYSICS_PT_smoke_field_weights,
+    PHYSICS_PT_smoke_cache,
+    PHYSICS_PT_smoke_highres,
+    PHYSICS_PT_smoke_groups,
+    PHYSICS_PT_smoke_cache_highres]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index f0c7b2617a45936b933a23908a8f842a8009a3bb..1166afd67ba2fc911f5780631d5bef17dab43e6f 100644 (file)
@@ -280,10 +280,23 @@ class PHYSICS_PT_softbody_field_weights(PhysicButtonsPanel):
 
         effector_weights_ui(self, context, softbody.effector_weights)
 
-bpy.types.register(PHYSICS_PT_softbody)
-bpy.types.register(PHYSICS_PT_softbody_cache)
-bpy.types.register(PHYSICS_PT_softbody_goal)
-bpy.types.register(PHYSICS_PT_softbody_edge)
-bpy.types.register(PHYSICS_PT_softbody_collision)
-bpy.types.register(PHYSICS_PT_softbody_solver)
-bpy.types.register(PHYSICS_PT_softbody_field_weights)
+
+classes = [
+    PHYSICS_PT_softbody,
+    PHYSICS_PT_softbody_cache,
+    PHYSICS_PT_softbody_goal,
+    PHYSICS_PT_softbody_edge,
+    PHYSICS_PT_softbody_collision,
+    PHYSICS_PT_softbody_solver,
+    PHYSICS_PT_softbody_field_weights]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index d5fb9672518b6f9ea30bea8ab16f3d3315f2f480..c630c0992ceea83db07724b5148c3543870194e0 100644 (file)
@@ -624,16 +624,28 @@ class RENDER_PT_bake(RenderButtonsPanel):
         sub.prop(rd, "bake_bias")
 
 
-bpy.types.register(RENDER_MT_presets)
-bpy.types.register(RENDER_PT_render)
-bpy.types.register(RENDER_PT_layers)
-bpy.types.register(RENDER_PT_dimensions)
-bpy.types.register(RENDER_PT_antialiasing)
-bpy.types.register(RENDER_PT_motion_blur)
-bpy.types.register(RENDER_PT_shading)
-bpy.types.register(RENDER_PT_output)
-bpy.types.register(RENDER_PT_encoding)
-bpy.types.register(RENDER_PT_performance)
-bpy.types.register(RENDER_PT_post_processing)
-bpy.types.register(RENDER_PT_stamp)
-bpy.types.register(RENDER_PT_bake)
+classes = [
+    RENDER_MT_presets,
+    RENDER_PT_render,
+    RENDER_PT_layers,
+    RENDER_PT_dimensions,
+    RENDER_PT_antialiasing,
+    RENDER_PT_motion_blur,
+    RENDER_PT_shading,
+    RENDER_PT_output,
+    RENDER_PT_encoding,
+    RENDER_PT_performance,
+    RENDER_PT_post_processing,
+    RENDER_PT_stamp,
+    RENDER_PT_bake]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index eb9cb1b7836fd000e475586576dc8a8e62f1e1bb..dc7c24b2b376b1772999e2aec44b5f91cc10f7af 100644 (file)
@@ -215,22 +215,11 @@ class SCENE_PT_simplify(SceneButtonsPanel):
             col = split.column()
         col.prop(rd, "simplify_shadow_samples", text="Shadow Samples")
         col.prop(rd, "simplify_ao_sss", text="AO and SSS")
-        
-        
-
-bpy.types.register(SCENE_PT_scene)
-bpy.types.register(SCENE_PT_unit)
-bpy.types.register(SCENE_PT_keying_sets)
-bpy.types.register(SCENE_PT_keying_set_paths)
-bpy.types.register(SCENE_PT_physics)
-bpy.types.register(SCENE_PT_simplify)
 
-bpy.types.register(SCENE_PT_custom_props)
-
-################################
 
 from bpy.props import *
 
+
 class ANIM_OT_keying_set_export(bpy.types.Operator):
     "Export Keying Set to a python script."
     bl_idname = "anim.keying_set_export"
@@ -340,4 +329,17 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
         wm.add_fileselect(self)
         return {'RUNNING_MODAL'}
 
-bpy.types.register(ANIM_OT_keying_set_export)
+
+classes = [
+    ANIM_OT_keying_set_export]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index a07bf2ff69e9748b8fa85346cafa54a23a0bc57a..89d653a0e801d9fc180ebe315ccf002a0d58aa37 100644 (file)
@@ -956,29 +956,42 @@ class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel):
         col.prop(pd, "turbulence_depth")
         col.prop(pd, "turbulence_strength")
 
-bpy.types.register(TEXTURE_PT_context_texture)
-bpy.types.register(TEXTURE_PT_preview)
-
-bpy.types.register(TEXTURE_PT_clouds) # Texture Type Panels
-bpy.types.register(TEXTURE_PT_wood)
-bpy.types.register(TEXTURE_PT_marble)
-bpy.types.register(TEXTURE_PT_magic)
-bpy.types.register(TEXTURE_PT_blend)
-bpy.types.register(TEXTURE_PT_stucci)
-bpy.types.register(TEXTURE_PT_image)
-bpy.types.register(TEXTURE_PT_image_sampling)
-bpy.types.register(TEXTURE_PT_image_mapping)
-bpy.types.register(TEXTURE_PT_plugin)
-bpy.types.register(TEXTURE_PT_envmap)
-bpy.types.register(TEXTURE_PT_musgrave)
-bpy.types.register(TEXTURE_PT_voronoi)
-bpy.types.register(TEXTURE_PT_distortednoise)
-bpy.types.register(TEXTURE_PT_voxeldata)
-bpy.types.register(TEXTURE_PT_pointdensity)
-bpy.types.register(TEXTURE_PT_pointdensity_turbulence)
-
-bpy.types.register(TEXTURE_PT_colors)
-bpy.types.register(TEXTURE_PT_mapping)
-bpy.types.register(TEXTURE_PT_influence)
-
-bpy.types.register(TEXTURE_PT_custom_props)
+
+classes = [
+    TEXTURE_PT_context_texture,
+    TEXTURE_PT_preview,
+
+    TEXTURE_PT_clouds, # Texture Type Panels
+    TEXTURE_PT_wood,
+    TEXTURE_PT_marble,
+    TEXTURE_PT_magic,
+    TEXTURE_PT_blend,
+    TEXTURE_PT_stucci,
+    TEXTURE_PT_image,
+    TEXTURE_PT_image_sampling,
+    TEXTURE_PT_image_mapping,
+    TEXTURE_PT_plugin,
+    TEXTURE_PT_envmap,
+    TEXTURE_PT_musgrave,
+    TEXTURE_PT_voronoi,
+    TEXTURE_PT_distortednoise,
+    TEXTURE_PT_voxeldata,
+    TEXTURE_PT_pointdensity,
+    TEXTURE_PT_pointdensity_turbulence,
+
+    TEXTURE_PT_colors,
+    TEXTURE_PT_mapping,
+    TEXTURE_PT_influence,
+
+    TEXTURE_PT_custom_props]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index a53aeec2c17c1b711c0fee2edab5ee03f77d12cc..5902c70b2e7391db7b3c39fd56cc5b528d53aee5 100644 (file)
@@ -267,14 +267,27 @@ class WORLD_PT_gather(WorldButtonsPanel):
             col.prop(light, "pixel_cache")
             col.prop(light, "correction")
 
-bpy.types.register(WORLD_PT_context_world)
-bpy.types.register(WORLD_PT_preview)
-bpy.types.register(WORLD_PT_world)
-bpy.types.register(WORLD_PT_ambient_occlusion)
-bpy.types.register(WORLD_PT_environment_lighting)
-bpy.types.register(WORLD_PT_indirect_lighting)
-bpy.types.register(WORLD_PT_gather)
-bpy.types.register(WORLD_PT_mist)
-bpy.types.register(WORLD_PT_stars)
-
-bpy.types.register(WORLD_PT_custom_props)
+
+classes = [
+    WORLD_PT_context_world,
+    WORLD_PT_preview,
+    WORLD_PT_world,
+    WORLD_PT_ambient_occlusion,
+    WORLD_PT_environment_lighting,
+    WORLD_PT_indirect_lighting,
+    WORLD_PT_gather,
+    WORLD_PT_mist,
+    WORLD_PT_stars,
+
+    WORLD_PT_custom_props]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index de5b77ec9cc89456cb69175f59882e9b476a6746..24d1a2577141ab8eeddb72b01dd40dc8e981dd5b 100644 (file)
@@ -51,5 +51,18 @@ class Buttons_MT_view(bpy.types.Menu):
         col = layout.column()
         col.prop(so, "panel_alignment", expand=True)
 
-bpy.types.register(Buttons_HT_header)
-bpy.types.register(Buttons_MT_view)
+
+classes = [
+    Buttons_HT_header,
+    Buttons_MT_view]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index 992a087a554f28ae7cf9cc2b4eeebbc8490a851b..6e0cc9ceba8b5412ff04fac8721e7c82ad7bfac4 100644 (file)
@@ -198,15 +198,27 @@ class ConsoleLanguage(bpy.types.Operator):
         return {'FINISHED'}
 
 
-bpy.types.register(CONSOLE_HT_header)
-bpy.types.register(CONSOLE_MT_console)
-bpy.types.register(CONSOLE_MT_report)
-bpy.types.register(CONSOLE_MT_language)
-
-# Stubs that call the language operators
-bpy.types.register(ConsoleExec)
-bpy.types.register(ConsoleAutocomplete)
-bpy.types.register(ConsoleBanner)
-
-# Set the language and call the banner
-bpy.types.register(ConsoleLanguage)
+classes = [
+    CONSOLE_HT_header,
+    CONSOLE_MT_console,
+    CONSOLE_MT_report,
+    CONSOLE_MT_language,
+
+    # Stubs that call the language operators
+    ConsoleExec,
+    ConsoleAutocomplete,
+    ConsoleBanner,
+
+    # Set the language and call the banner
+    ConsoleLanguage]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index 1d2d475486165903fa9f1c471f5b2d53bd927ce8..2eb9b82a766c2ef512886daf7ab1967d39e6e7c7 100644 (file)
@@ -191,9 +191,21 @@ class DOPESHEET_MT_key_transform(bpy.types.Menu):
         layout.operator("transform.resize", text="Scale")
 
 
-bpy.types.register(DOPESHEET_HT_header) # header/menu classes
-bpy.types.register(DOPESHEET_MT_view)
-bpy.types.register(DOPESHEET_MT_select)
-bpy.types.register(DOPESHEET_MT_channel)
-bpy.types.register(DOPESHEET_MT_key)
-bpy.types.register(DOPESHEET_MT_key_transform)
+classes = [
+    DOPESHEET_HT_header, # header/menu classes
+    DOPESHEET_MT_view,
+    DOPESHEET_MT_select,
+    DOPESHEET_MT_channel,
+    DOPESHEET_MT_key,
+    DOPESHEET_MT_key_transform]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index 01f6f111812da38e9091235beebc32cd73f19e17..85a8295dbcfff9ee2a37857fba7ea0043160bbe5 100644 (file)
@@ -64,4 +64,17 @@ class FILEBROWSER_HT_header(bpy.types.Header):
         row.prop(params, "filter_sound", text="")
         row.prop(params, "filter_text", text="")
 
-bpy.types.register(FILEBROWSER_HT_header)
+
+classes = [
+    FILEBROWSER_HT_header]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index 16a615d2be7c997f03b11456f0d64cce31760109..fa8d607e4ff078d1a69f8ae4dc98c9bdfd13abea 100644 (file)
@@ -198,9 +198,21 @@ class GRAPH_MT_key_transform(bpy.types.Menu):
         layout.operator("transform.resize", text="Scale")
 
 
-bpy.types.register(GRAPH_HT_header) # header/menu classes
-bpy.types.register(GRAPH_MT_view)
-bpy.types.register(GRAPH_MT_select)
-bpy.types.register(GRAPH_MT_channel)
-bpy.types.register(GRAPH_MT_key)
-bpy.types.register(GRAPH_MT_key_transform)
+classes = [
+    GRAPH_HT_header, # header/menu classes
+    GRAPH_MT_view,
+    GRAPH_MT_select,
+    GRAPH_MT_channel,
+    GRAPH_MT_key,
+    GRAPH_MT_key_transform]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index 61e5b481d6ffea12be8ff76c506e7465086c3e29..b879aff7f139e0497218055c94a02eeda1fb4046 100644 (file)
@@ -570,20 +570,33 @@ class IMAGE_PT_paint_curve(bpy.types.Panel):
         layout.template_curve_mapping(brush, "curve")
         layout.operator_menu_enum("brush.curve_preset", property="shape")
 
-bpy.types.register(IMAGE_MT_view)
-bpy.types.register(IMAGE_MT_select)
-bpy.types.register(IMAGE_MT_image)
-bpy.types.register(IMAGE_MT_uvs_showhide)
-bpy.types.register(IMAGE_MT_uvs_transform)
-bpy.types.register(IMAGE_MT_uvs_snap)
-bpy.types.register(IMAGE_MT_uvs_mirror)
-bpy.types.register(IMAGE_MT_uvs_weldalign)
-bpy.types.register(IMAGE_MT_uvs)
-bpy.types.register(IMAGE_HT_header)
-bpy.types.register(IMAGE_PT_image_properties)
-bpy.types.register(IMAGE_PT_paint)
-bpy.types.register(IMAGE_PT_paint_stroke)
-bpy.types.register(IMAGE_PT_paint_curve)
-bpy.types.register(IMAGE_PT_game_properties)
-bpy.types.register(IMAGE_PT_view_properties)
-bpy.types.register(IMAGE_PT_view_histogram)
+
+classes = [
+    IMAGE_MT_view,
+    IMAGE_MT_select,
+    IMAGE_MT_image,
+    IMAGE_MT_uvs_showhide,
+    IMAGE_MT_uvs_transform,
+    IMAGE_MT_uvs_snap,
+    IMAGE_MT_uvs_mirror,
+    IMAGE_MT_uvs_weldalign,
+    IMAGE_MT_uvs,
+    IMAGE_HT_header,
+    IMAGE_PT_image_properties,
+    IMAGE_PT_paint,
+    IMAGE_PT_paint_stroke,
+    IMAGE_PT_paint_curve,
+    IMAGE_PT_game_properties,
+    IMAGE_PT_view_properties,
+    IMAGE_PT_view_histogram]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index 84bfc5a9b1e8db54b9b08af10ca7ac0aaca82e07..24b080d80df3c8df450c752aafa0bfbcf2e49f18 100644 (file)
@@ -293,18 +293,6 @@ class INFO_MT_help(bpy.types.Menu):
         layout.operator("help.python_api", icon='URL')
         layout.operator("help.operator_cheat_sheet")
 
-bpy.types.register(INFO_HT_header)
-bpy.types.register(INFO_MT_file)
-bpy.types.register(INFO_MT_file_open_recent)
-bpy.types.register(INFO_MT_file_import)
-bpy.types.register(INFO_MT_file_export)
-bpy.types.register(INFO_MT_file_external_data)
-bpy.types.register(INFO_MT_add)
-bpy.types.register(INFO_MT_mesh_add)
-bpy.types.register(INFO_MT_armature_add)
-bpy.types.register(INFO_MT_game)
-bpy.types.register(INFO_MT_render)
-bpy.types.register(INFO_MT_help)
 
 # Help operators
 
@@ -397,12 +385,38 @@ class HELP_OT_operator_cheat_sheet(bpy.types.Operator):
         self.report({'INFO'}, "See OperatorList.txt textblock")
         return {'FINISHED'}
 
-bpy.types.register(HELP_OT_manual)
-bpy.types.register(HELP_OT_release_logs)
-bpy.types.register(HELP_OT_blender_website)
-bpy.types.register(HELP_OT_blender_eshop)
-bpy.types.register(HELP_OT_developer_community)
-bpy.types.register(HELP_OT_user_community)
-bpy.types.register(HELP_OT_report_bug)
-bpy.types.register(HELP_OT_python_api)
-bpy.types.register(HELP_OT_operator_cheat_sheet)
+
+classes = [
+    INFO_HT_header,
+    INFO_MT_file,
+    INFO_MT_file_open_recent,
+    INFO_MT_file_import,
+    INFO_MT_file_export,
+    INFO_MT_file_external_data,
+    INFO_MT_add,
+    INFO_MT_mesh_add,
+    INFO_MT_armature_add,
+    INFO_MT_game,
+    INFO_MT_render,
+    INFO_MT_help,
+
+    HELP_OT_manual,
+    HELP_OT_release_logs,
+    HELP_OT_blender_website,
+    HELP_OT_blender_eshop,
+    HELP_OT_developer_community,
+    HELP_OT_user_community,
+    HELP_OT_report_bug,
+    HELP_OT_python_api,
+    HELP_OT_operator_cheat_sheet]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index 001a947b330328782c59438693c04552ea5369d0..29fd1114c2693888a95c98bf5c58c2519ec89b13 100644 (file)
@@ -46,4 +46,17 @@ class LOGIC_PT_properties(bpy.types.Panel):
             row.prop(prop, "debug", text="", toggle=True, icon='INFO')
             row.operator("object.game_property_remove", text="", icon='X').index = i
 
-bpy.types.register(LOGIC_PT_properties)
+
+classes = [
+    LOGIC_PT_properties]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index 3f133b1eb2ce28f1b5c5a6d736b6788a92fa9172..63297c1989e3a1f9c0a4ae3bc2868d5790127c44 100644 (file)
@@ -159,9 +159,21 @@ class NLA_MT_edit_transform(bpy.types.Menu):
         layout.operator("transform.resize", text="Scale")
 
 
-bpy.types.register(NLA_HT_header) # header/menu classes
-bpy.types.register(NLA_MT_view)
-bpy.types.register(NLA_MT_select)
-bpy.types.register(NLA_MT_edit)
-bpy.types.register(NLA_MT_add)
-bpy.types.register(NLA_MT_edit_transform)
+classes = [
+    NLA_HT_header, # header/menu classes
+    NLA_MT_view,
+    NLA_MT_select,
+    NLA_MT_edit,
+    NLA_MT_add,
+    NLA_MT_edit_transform]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index 455011046330ed1f824f17f7e67b294329b76058..4ed66582178388d1337866dd9f093787d110be13 100644 (file)
@@ -139,7 +139,20 @@ class NODE_MT_node(bpy.types.Menu):
 
         layout.operator("node.show_cyclic_dependencies")
 
-bpy.types.register(NODE_HT_header)
-bpy.types.register(NODE_MT_view)
-bpy.types.register(NODE_MT_select)
-bpy.types.register(NODE_MT_node)
+
+classes = [
+    NODE_HT_header,
+    NODE_MT_view,
+    NODE_MT_select,
+    NODE_MT_node]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index 34a519c119e2bf5986d5ef50fb537a268e5d2759..ea6354b6e6e93e1599922a7f6c59775da624e41a 100644 (file)
@@ -99,6 +99,19 @@ class OUTLINER_MT_edit_datablocks(bpy.types.Menu):
         col.operator("outliner.drivers_add_selected")
         col.operator("outliner.drivers_delete_selected")
 
-bpy.types.register(OUTLINER_HT_header)
-bpy.types.register(OUTLINER_MT_view)
-bpy.types.register(OUTLINER_MT_edit_datablocks)
+
+classes = [
+    OUTLINER_HT_header,
+    OUTLINER_MT_view,
+    OUTLINER_MT_edit_datablocks]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index a2f4a28d6916e0cbf0a08011db526a50aadc01be..7dd37cc54570b18cb060fdde4b6aad9dd0fccc21 100644 (file)
@@ -665,21 +665,34 @@ class SEQUENCER_PT_view(SequencerButtonsPanel_Output):
         col.prop(st, "draw_overexposed") # text="Zebra"
         col.prop(st, "draw_safe_margin")
 
-bpy.types.register(SEQUENCER_HT_header) # header/menu classes
-bpy.types.register(SEQUENCER_MT_view)
-bpy.types.register(SEQUENCER_MT_view_toggle)
-bpy.types.register(SEQUENCER_MT_select)
-bpy.types.register(SEQUENCER_MT_marker)
-bpy.types.register(SEQUENCER_MT_add)
-bpy.types.register(SEQUENCER_MT_add_effect)
-bpy.types.register(SEQUENCER_MT_strip)
-
-bpy.types.register(SEQUENCER_PT_edit) # sequencer panels
-bpy.types.register(SEQUENCER_PT_effect)
-bpy.types.register(SEQUENCER_PT_input)
-bpy.types.register(SEQUENCER_PT_sound)
-bpy.types.register(SEQUENCER_PT_scene)
-bpy.types.register(SEQUENCER_PT_filter)
-bpy.types.register(SEQUENCER_PT_proxy)
-
-bpy.types.register(SEQUENCER_PT_view) # view panels
+
+classes = [
+    SEQUENCER_HT_header, # header/menu classes
+    SEQUENCER_MT_view,
+    SEQUENCER_MT_view_toggle,
+    SEQUENCER_MT_select,
+    SEQUENCER_MT_marker,
+    SEQUENCER_MT_add,
+    SEQUENCER_MT_add_effect,
+    SEQUENCER_MT_strip,
+
+    SEQUENCER_PT_edit, # sequencer panels
+    SEQUENCER_PT_effect,
+    SEQUENCER_PT_input,
+    SEQUENCER_PT_sound,
+    SEQUENCER_PT_scene,
+    SEQUENCER_PT_filter,
+    SEQUENCER_PT_proxy,
+
+    SEQUENCER_PT_view] # view panels
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index 8e972cc31fba695a94267ebba5784ecafc8a135c..cbc7ce9244b688ad281b41146779aa2767f47c1c 100644 (file)
@@ -273,14 +273,27 @@ class TEXT_MT_edit(bpy.types.Menu):
 
         layout.menu("TEXT_MT_edit_to3d")
 
-bpy.types.register(TEXT_HT_header)
-bpy.types.register(TEXT_PT_properties)
-bpy.types.register(TEXT_PT_find)
-bpy.types.register(TEXT_MT_text)
-bpy.types.register(TEXT_MT_templates)
-bpy.types.register(TEXT_MT_format)
-bpy.types.register(TEXT_MT_edit)
-bpy.types.register(TEXT_MT_edit_view)
-bpy.types.register(TEXT_MT_edit_select)
-bpy.types.register(TEXT_MT_edit_markers)
-bpy.types.register(TEXT_MT_edit_to3d)
+
+classes = [
+    TEXT_HT_header,
+    TEXT_PT_properties,
+    TEXT_PT_find,
+    TEXT_MT_text,
+    TEXT_MT_templates,
+    TEXT_MT_format,
+    TEXT_MT_edit,
+    TEXT_MT_edit_view,
+    TEXT_MT_edit_select,
+    TEXT_MT_edit_markers,
+    TEXT_MT_edit_to3d]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index 947929ae776a6f14e54ae74d8a2b2219a051edee..b5be1b5da567ff5b8413b2b9a4991ea29806ee1f 100644 (file)
@@ -167,8 +167,20 @@ class TIME_MT_autokey(bpy.types.Menu):
         layout.prop_enum(tools, "autokey_mode", 'ADD_REPLACE_KEYS')
         layout.prop_enum(tools, "autokey_mode", 'REPLACE_KEYS')
 
-bpy.types.register(TIME_HT_header)
-bpy.types.register(TIME_MT_view)
-bpy.types.register(TIME_MT_frame)
-bpy.types.register(TIME_MT_autokey)
-bpy.types.register(TIME_MT_playback)
+classes = [
+    TIME_HT_header,
+    TIME_MT_view,
+    TIME_MT_frame,
+    TIME_MT_autokey,
+    TIME_MT_playback]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index b1f7f10a70e55575a10e1e5e1d845794957a29d1..f05f9246adec67573b5068e4fe03c53cb949869c 100644 (file)
@@ -1348,14 +1348,6 @@ class USERPREF_PT_input(bpy.types.Panel):
 
         #print("runtime", time.time() - start)
 
-bpy.types.register(USERPREF_HT_header)
-bpy.types.register(USERPREF_PT_tabs)
-bpy.types.register(USERPREF_PT_interface)
-bpy.types.register(USERPREF_PT_theme)
-bpy.types.register(USERPREF_PT_edit)
-bpy.types.register(USERPREF_PT_system)
-bpy.types.register(USERPREF_PT_file)
-bpy.types.register(USERPREF_PT_input)
 
 from bpy.props import *
 
@@ -1755,12 +1747,34 @@ class WM_OT_keyconfig_remove(bpy.types.Operator):
         wm.remove_keyconfig(keyconfig)
         return {'FINISHED'}
 
-bpy.types.register(WM_OT_keyconfig_export)
-bpy.types.register(WM_OT_keyconfig_import)
-bpy.types.register(WM_OT_keyconfig_test)
-bpy.types.register(WM_OT_keyconfig_remove)
-bpy.types.register(WM_OT_keymap_edit)
-bpy.types.register(WM_OT_keymap_restore)
-bpy.types.register(WM_OT_keyitem_add)
-bpy.types.register(WM_OT_keyitem_remove)
-bpy.types.register(WM_OT_keyitem_restore)
+
+classes = [
+    USERPREF_HT_header,
+    USERPREF_PT_tabs,
+    USERPREF_PT_interface,
+    USERPREF_PT_theme,
+    USERPREF_PT_edit,
+    USERPREF_PT_system,
+    USERPREF_PT_file,
+    USERPREF_PT_input,
+
+    WM_OT_keyconfig_export,
+    WM_OT_keyconfig_import,
+    WM_OT_keyconfig_test,
+    WM_OT_keyconfig_remove,
+    WM_OT_keymap_edit,
+    WM_OT_keymap_restore,
+    WM_OT_keyitem_add,
+    WM_OT_keyitem_remove,
+    WM_OT_keyitem_restore]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index 96c98f1376d953df262d7b15d2f37b978225a0e7..2f20dc08e10ade9385df22ffa386e7321753b9e3 100644 (file)
@@ -2101,105 +2101,115 @@ class VIEW3D_PT_context_properties(bpy.types.Panel):
             # Draw with no edit button
             rna_prop_ui.draw(self.layout, context, member, False)
 
-
-bpy.types.register(VIEW3D_OT_edit_mesh_extrude_move) # detects constraints setup and extrude region
-bpy.types.register(VIEW3D_OT_edit_mesh_extrude_individual_move) 
-
-bpy.types.register(VIEW3D_HT_header) # Header
-
-bpy.types.register(VIEW3D_MT_view) #View Menus
-bpy.types.register(VIEW3D_MT_view_navigation)
-bpy.types.register(VIEW3D_MT_view_align)
-bpy.types.register(VIEW3D_MT_view_align_selected)
-bpy.types.register(VIEW3D_MT_view_cameras)
-
-bpy.types.register(VIEW3D_MT_select_object) # Select Menus
-bpy.types.register(VIEW3D_MT_select_pose)
-bpy.types.register(VIEW3D_MT_select_particle)
-bpy.types.register(VIEW3D_MT_select_edit_mesh)
-bpy.types.register(VIEW3D_MT_select_edit_curve)
-bpy.types.register(VIEW3D_MT_select_edit_surface)
-bpy.types.register(VIEW3D_MT_select_edit_metaball)
-bpy.types.register(VIEW3D_MT_select_edit_lattice)
-bpy.types.register(VIEW3D_MT_select_edit_armature)
-bpy.types.register(VIEW3D_MT_select_face) # XXX todo
-
-bpy.types.register(VIEW3D_MT_transform) # Object/Edit Menus
-bpy.types.register(VIEW3D_MT_mirror) # Object/Edit Menus
-bpy.types.register(VIEW3D_MT_snap) # Object/Edit Menus
-bpy.types.register(VIEW3D_MT_uv_map) # Edit Menus
-
-bpy.types.register(VIEW3D_MT_object) # Object Menu
-bpy.types.register(VIEW3D_MT_object_apply)
-bpy.types.register(VIEW3D_MT_object_clear)
-bpy.types.register(VIEW3D_MT_object_parent)
-bpy.types.register(VIEW3D_MT_object_track)
-bpy.types.register(VIEW3D_MT_object_group)
-bpy.types.register(VIEW3D_MT_object_constraints)
-bpy.types.register(VIEW3D_MT_object_showhide)
-bpy.types.register(VIEW3D_MT_make_single_user)
-bpy.types.register(VIEW3D_MT_make_links)
-
-bpy.types.register(VIEW3D_MT_hook)
-bpy.types.register(VIEW3D_MT_vertex_group)
-
-bpy.types.register(VIEW3D_MT_sculpt) # Sculpt Menu
-bpy.types.register(VIEW3D_MT_paint_vertex)
-bpy.types.register(VIEW3D_MT_paint_weight)
-
-bpy.types.register(VIEW3D_MT_particle)# Particle Menu
-bpy.types.register(VIEW3D_MT_particle_specials)
-bpy.types.register(VIEW3D_MT_particle_showhide)
-
-bpy.types.register(VIEW3D_MT_pose) # POSE Menu
-bpy.types.register(VIEW3D_MT_pose_transform)
-bpy.types.register(VIEW3D_MT_pose_pose)
-bpy.types.register(VIEW3D_MT_pose_motion)
-bpy.types.register(VIEW3D_MT_pose_group)
-bpy.types.register(VIEW3D_MT_pose_ik)
-bpy.types.register(VIEW3D_MT_pose_constraints)
-bpy.types.register(VIEW3D_MT_pose_showhide)
-
-bpy.types.register(VIEW3D_MT_edit_mesh)
-bpy.types.register(VIEW3D_MT_edit_mesh_specials) # Only as a menu for keybindings
-bpy.types.register(VIEW3D_MT_edit_mesh_selection_mode) # Only as a menu for keybindings
-bpy.types.register(VIEW3D_MT_edit_mesh_vertices)
-bpy.types.register(VIEW3D_MT_edit_mesh_edges)
-bpy.types.register(VIEW3D_MT_edit_mesh_faces)
-bpy.types.register(VIEW3D_MT_edit_mesh_normals)
-bpy.types.register(VIEW3D_MT_edit_mesh_showhide)
-bpy.types.register(VIEW3D_MT_edit_mesh_extrude) # use with VIEW3D_OT_edit_mesh_extrude_menu
-
-bpy.types.register(VIEW3D_MT_edit_curve)
-bpy.types.register(VIEW3D_MT_edit_curve_ctrlpoints)
-bpy.types.register(VIEW3D_MT_edit_curve_segments)
-bpy.types.register(VIEW3D_MT_edit_curve_specials)
-bpy.types.register(VIEW3D_MT_edit_curve_showhide)
-
-bpy.types.register(VIEW3D_MT_edit_surface)
-
-bpy.types.register(VIEW3D_MT_edit_text)
-bpy.types.register(VIEW3D_MT_edit_text_chars)
-
-bpy.types.register(VIEW3D_MT_edit_meta)
-bpy.types.register(VIEW3D_MT_edit_meta_showhide)
-
-bpy.types.register(VIEW3D_MT_edit_lattice)
-
-bpy.types.register(VIEW3D_MT_edit_armature)
-bpy.types.register(VIEW3D_MT_edit_armature_parent)
-bpy.types.register(VIEW3D_MT_edit_armature_roll)
-
-bpy.types.register(VIEW3D_MT_armature_specials) # Only as a menu for keybindings
-
- # Panels
-bpy.types.register(VIEW3D_PT_3dview_properties)
-bpy.types.register(VIEW3D_PT_3dview_display)
-bpy.types.register(VIEW3D_PT_3dview_name)
-bpy.types.register(VIEW3D_PT_3dview_meshdisplay)
-bpy.types.register(VIEW3D_PT_3dview_curvedisplay)
-bpy.types.register(VIEW3D_PT_background_image)
-bpy.types.register(VIEW3D_PT_transform_orientations)
-bpy.types.register(VIEW3D_PT_etch_a_ton)
-
-bpy.types.register(VIEW3D_PT_context_properties)
+classes = [
+    VIEW3D_OT_edit_mesh_extrude_move, # detects constraints setup and extrude region
+    VIEW3D_OT_edit_mesh_extrude_individual_move,
+
+    VIEW3D_HT_header, # Header
+
+    VIEW3D_MT_view, #View Menus
+    VIEW3D_MT_view_navigation,
+    VIEW3D_MT_view_align,
+    VIEW3D_MT_view_align_selected,
+    VIEW3D_MT_view_cameras,
+
+    VIEW3D_MT_select_object, # Select Menus
+    VIEW3D_MT_select_pose,
+    VIEW3D_MT_select_particle,
+    VIEW3D_MT_select_edit_mesh,
+    VIEW3D_MT_select_edit_curve,
+    VIEW3D_MT_select_edit_surface,
+    VIEW3D_MT_select_edit_metaball,
+    VIEW3D_MT_select_edit_lattice,
+    VIEW3D_MT_select_edit_armature,
+    VIEW3D_MT_select_face, # XXX todo
+
+    VIEW3D_MT_transform, # Object/Edit Menus
+    VIEW3D_MT_mirror, # Object/Edit Menus
+    VIEW3D_MT_snap, # Object/Edit Menus
+    VIEW3D_MT_uv_map, # Edit Menus
+
+    VIEW3D_MT_object, # Object Menu
+    VIEW3D_MT_object_apply,
+    VIEW3D_MT_object_clear,
+    VIEW3D_MT_object_parent,
+    VIEW3D_MT_object_track,
+    VIEW3D_MT_object_group,
+    VIEW3D_MT_object_constraints,
+    VIEW3D_MT_object_showhide,
+    VIEW3D_MT_make_single_user,
+    VIEW3D_MT_make_links,
+
+    VIEW3D_MT_hook,
+    VIEW3D_MT_vertex_group,
+
+    VIEW3D_MT_sculpt, # Sculpt Menu
+    VIEW3D_MT_paint_vertex,
+    VIEW3D_MT_paint_weight,
+
+    VIEW3D_MT_particle, # Particle Menu
+    VIEW3D_MT_particle_specials,
+    VIEW3D_MT_particle_showhide,
+
+    VIEW3D_MT_pose, # POSE Menu
+    VIEW3D_MT_pose_transform,
+    VIEW3D_MT_pose_pose,
+    VIEW3D_MT_pose_motion,
+    VIEW3D_MT_pose_group,
+    VIEW3D_MT_pose_ik,
+    VIEW3D_MT_pose_constraints,
+    VIEW3D_MT_pose_showhide,
+
+    VIEW3D_MT_edit_mesh,
+    VIEW3D_MT_edit_mesh_specials, # Only as a menu for keybindings
+    VIEW3D_MT_edit_mesh_selection_mode, # Only as a menu for keybindings
+    VIEW3D_MT_edit_mesh_vertices,
+    VIEW3D_MT_edit_mesh_edges,
+    VIEW3D_MT_edit_mesh_faces,
+    VIEW3D_MT_edit_mesh_normals,
+    VIEW3D_MT_edit_mesh_showhide,
+    VIEW3D_MT_edit_mesh_extrude, # use with VIEW3D_OT_edit_mesh_extrude_menu
+
+    VIEW3D_MT_edit_curve,
+    VIEW3D_MT_edit_curve_ctrlpoints,
+    VIEW3D_MT_edit_curve_segments,
+    VIEW3D_MT_edit_curve_specials,
+    VIEW3D_MT_edit_curve_showhide,
+
+    VIEW3D_MT_edit_surface,
+
+    VIEW3D_MT_edit_text,
+    VIEW3D_MT_edit_text_chars,
+
+    VIEW3D_MT_edit_meta,
+    VIEW3D_MT_edit_meta_showhide,
+
+    VIEW3D_MT_edit_lattice,
+
+    VIEW3D_MT_edit_armature,
+    VIEW3D_MT_edit_armature_parent,
+    VIEW3D_MT_edit_armature_roll,
+
+    VIEW3D_MT_armature_specials, # Only as a menu for keybindings
+
+   # Panels
+    VIEW3D_PT_3dview_properties,
+    VIEW3D_PT_3dview_display,
+    VIEW3D_PT_3dview_name,
+    VIEW3D_PT_3dview_meshdisplay,
+    VIEW3D_PT_3dview_curvedisplay,
+    VIEW3D_PT_background_image,
+    VIEW3D_PT_transform_orientations,
+    VIEW3D_PT_etch_a_ton,
+    VIEW3D_PT_context_properties]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index 98ea4c67b851241d96162ab2bc7b4d3b5ca43529..243c9304ae49ef12ee6315a01516452b934e410f 100644 (file)
@@ -903,28 +903,27 @@ class VIEW3D_PT_tools_projectpaint(View3DPanel):
         sub = col.column()
         sub.prop(ipaint, "seam_bleed")
 
-    class VIEW3D_MT_tools_projectpaint_clone(bpy.types.Menu):
-        bl_label = "Clone Layer"
 
-        def draw(self, context):
-            layout = self.layout
-            for i, tex in enumerate(context.active_object.data.uv_textures):
-                prop = layout.operator("wm.context_set_int", text=tex.name)
-                prop.path = "active_object.data.uv_texture_clone_index"
-                prop.value = i
+class VIEW3D_MT_tools_projectpaint_clone(bpy.types.Menu):
+    bl_label = "Clone Layer"
+
+    def draw(self, context):
+        layout = self.layout
+        for i, tex in enumerate(context.active_object.data.uv_textures):
+            prop = layout.operator("wm.context_set_int", text=tex.name)
+            prop.path = "active_object.data.uv_texture_clone_index"
+            prop.value = i
 
-    class VIEW3D_MT_tools_projectpaint_stencil(bpy.types.Menu):
-        bl_label = "Mask Layer"
 
-        def draw(self, context):
-            layout = self.layout
-            for i, tex in enumerate(context.active_object.data.uv_textures):
-                prop = layout.operator("wm.context_set_int", text=tex.name)
-                prop.path = "active_object.data.uv_texture_stencil_index"
-                prop.value = i
+class VIEW3D_MT_tools_projectpaint_stencil(bpy.types.Menu):
+    bl_label = "Mask Layer"
 
-    bpy.types.register(VIEW3D_MT_tools_projectpaint_clone)
-    bpy.types.register(VIEW3D_MT_tools_projectpaint_stencil)
+    def draw(self, context):
+        layout = self.layout
+        for i, tex in enumerate(context.active_object.data.uv_textures):
+            prop = layout.operator("wm.context_set_int", text=tex.name)
+            prop.path = "active_object.data.uv_texture_stencil_index"
+            prop.value = i
 
 
 class VIEW3D_PT_tools_particlemode(View3DPanel):
@@ -990,26 +989,43 @@ class VIEW3D_PT_tools_particlemode(View3DPanel):
         sub.active = pe.fade_time
         sub.prop(pe, "fade_frames", slider=True)
 
-bpy.types.register(VIEW3D_PT_tools_weightpaint)
-bpy.types.register(VIEW3D_PT_tools_objectmode)
-bpy.types.register(VIEW3D_PT_tools_meshedit)
-bpy.types.register(VIEW3D_PT_tools_meshedit_options)
-bpy.types.register(VIEW3D_PT_tools_curveedit)
-bpy.types.register(VIEW3D_PT_tools_surfaceedit)
-bpy.types.register(VIEW3D_PT_tools_textedit)
-bpy.types.register(VIEW3D_PT_tools_armatureedit)
-bpy.types.register(VIEW3D_PT_tools_armatureedit_options)
-bpy.types.register(VIEW3D_PT_tools_mballedit)
-bpy.types.register(VIEW3D_PT_tools_latticeedit)
-bpy.types.register(VIEW3D_PT_tools_posemode)
-bpy.types.register(VIEW3D_PT_tools_posemode_options)
-bpy.types.register(VIEW3D_PT_tools_brush)
-bpy.types.register(VIEW3D_PT_tools_brush_texture)
-bpy.types.register(VIEW3D_PT_tools_brush_tool)
-bpy.types.register(VIEW3D_PT_tools_brush_stroke)
-bpy.types.register(VIEW3D_PT_tools_brush_curve)
-bpy.types.register(VIEW3D_PT_sculpt_options)
-bpy.types.register(VIEW3D_PT_tools_vertexpaint)
-bpy.types.register(VIEW3D_PT_tools_weightpaint_options)
-bpy.types.register(VIEW3D_PT_tools_projectpaint)
-bpy.types.register(VIEW3D_PT_tools_particlemode)
+
+classes = [
+    VIEW3D_PT_tools_weightpaint,
+    VIEW3D_PT_tools_objectmode,
+    VIEW3D_PT_tools_meshedit,
+    VIEW3D_PT_tools_meshedit_options,
+    VIEW3D_PT_tools_curveedit,
+    VIEW3D_PT_tools_surfaceedit,
+    VIEW3D_PT_tools_textedit,
+    VIEW3D_PT_tools_armatureedit,
+    VIEW3D_PT_tools_armatureedit_options,
+    VIEW3D_PT_tools_mballedit,
+    VIEW3D_PT_tools_latticeedit,
+    VIEW3D_PT_tools_posemode,
+    VIEW3D_PT_tools_posemode_options,
+    VIEW3D_PT_tools_brush,
+    VIEW3D_PT_tools_brush_texture,
+    VIEW3D_PT_tools_brush_tool,
+    VIEW3D_PT_tools_brush_stroke,
+    VIEW3D_PT_tools_brush_curve,
+    VIEW3D_PT_sculpt_options,
+    VIEW3D_PT_tools_vertexpaint,
+    VIEW3D_PT_tools_weightpaint_options,
+
+    VIEW3D_PT_tools_projectpaint,
+    VIEW3D_MT_tools_projectpaint_clone,
+    VIEW3D_MT_tools_projectpaint_stencil,
+
+    VIEW3D_PT_tools_particlemode]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
index 9a2d6782979844117e57a8c50c2f15b17cdc5b01..961b7ab3dab5fc19ce990349c06f22bf611125f7 100644 (file)
@@ -3881,7 +3881,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
                                Py_DECREF(py_arg_count);
 
                                if (arg_count != func_arg_count) {
-                                       PyErr_Format( PyExc_AttributeError, "expected %.200s, %.200s class \"%.200s\" function to have %d args", class_type, py_class_name, RNA_function_identifier(func), func_arg_count);
+                                       PyErr_Format( PyExc_AttributeError, "expected %.200s, %.200s class \"%.200s\" function to have %d args, found %d", class_type, py_class_name, RNA_function_identifier(func), func_arg_count, arg_count);
                                        return -1;
                                }
                        }
@@ -4165,6 +4165,11 @@ PyObject *pyrna_basetype_register(PyObject *self, PyObject *py_class)
        PyObject *item;
        const char *identifier= "";
 
+    if(PyDict_GetItemString(((PyTypeObject*)py_class)->tp_dict, "bl_rna")) {
+               PyErr_SetString(PyExc_AttributeError, "Alredy registered as a subclass.");
+               return NULL;
+    }
+
        srna= pyrna_struct_as_srna(py_class);
        if(srna==NULL)
                return NULL;