[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [885] trunk/py/scripts/addons: update addons to work with new register/unregister method,

Campbell Barton ideasman42 at gmail.com
Mon Aug 2 13:53:48 CEST 2010


Revision: 885
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=885
Author:   campbellbarton
Date:     2010-08-02 13:53:48 +0200 (Mon, 02 Aug 2010)

Log Message:
-----------
update addons to work with new register/unregister method,
These scritps still need changes related to parent classes
- mesh_surface_sketch.py
- render_renderfarmfi.py
- space_view3d_align_tools.py
- object_cloud_gen.py

Modified Paths:
--------------
    trunk/py/scripts/addons/add_curve_aceous_galore.py
    trunk/py/scripts/addons/add_curve_torus_knots.py
    trunk/py/scripts/addons/add_mesh_3d_function_surface.py
    trunk/py/scripts/addons/add_mesh_BoltFactory/__init__.py
    trunk/py/scripts/addons/add_mesh_ant_landscape.py
    trunk/py/scripts/addons/add_mesh_extras.py
    trunk/py/scripts/addons/add_mesh_gears.py
    trunk/py/scripts/addons/add_mesh_gemstones.py
    trunk/py/scripts/addons/add_mesh_pipe_joint.py
    trunk/py/scripts/addons/add_mesh_solid.py
    trunk/py/scripts/addons/add_mesh_twisted_torus.py
    trunk/py/scripts/addons/curve_simplify.py
    trunk/py/scripts/addons/io_anim_camera.py
    trunk/py/scripts/addons/io_export_directx_x.py
    trunk/py/scripts/addons/io_export_unreal_psk_psa.py
    trunk/py/scripts/addons/io_import_images_as_planes.py
    trunk/py/scripts/addons/io_import_scene_mhx.py
    trunk/py/scripts/addons/io_import_scene_unreal_psk.py
    trunk/py/scripts/addons/io_mesh_raw/__init__.py
    trunk/py/scripts/addons/io_mesh_stl/__init__.py
    trunk/py/scripts/addons/mesh_relax.py
    trunk/py/scripts/addons/mesh_surface_sketch.py
    trunk/py/scripts/addons/object_add_chain.py
    trunk/py/scripts/addons/object_cloud_gen.py
    trunk/py/scripts/addons/object_fracture/__init__.py
    trunk/py/scripts/addons/render_povray/__init__.py
    trunk/py/scripts/addons/render_povray/render.py
    trunk/py/scripts/addons/render_povray/ui.py
    trunk/py/scripts/addons/render_renderfarmfi.py
    trunk/py/scripts/addons/space_view3d_align_tools.py
    trunk/py/scripts/addons/space_view3d_materials_utils.py
    trunk/py/scripts/addons/space_view3d_panel_measure.py
    trunk/py/scripts/addons/space_view3d_property_chart.py
    trunk/py/scripts/addons/space_view3d_spacebar_menu.py

Modified: trunk/py/scripts/addons/add_curve_aceous_galore.py
===================================================================
--- trunk/py/scripts/addons/add_curve_aceous_galore.py	2010-08-02 02:46:53 UTC (rev 884)
+++ trunk/py/scripts/addons/add_curve_aceous_galore.py	2010-08-02 11:53:48 UTC (rev 885)
@@ -1105,25 +1105,14 @@
 ################################################################################
 ##### REGISTER #####
 
-Curveaceous_galore_button = (lambda self, context: self.layout.operator
-            (Curveaceous_galore.bl_idname, text="curvatures gallore", icon="PLUGIN"))
+def Curveaceous_galore_button(self, context):
+    self.layout.operator(Curveaceous_galore.bl_idname, text="curvatures gallore", icon="PLUGIN")
 
-classes = [
-Curveaceous_galore
-    ]
 
 def register():
-    register = bpy.types.register
-    for cls in classes:
-        register(cls)
-
     bpy.types.INFO_MT_curve_add.append(Curveaceous_galore_button)
 
 def unregister():
-    unregister = bpy.types.unregister
-    for cls in classes:
-        unregister(cls)
-
     bpy.types.INFO_MT_curve_add.remove(Curveaceous_galore_button)
 
 if __name__ == "__main__":

Modified: trunk/py/scripts/addons/add_curve_torus_knots.py
===================================================================
--- trunk/py/scripts/addons/add_curve_torus_knots.py	2010-08-02 02:46:53 UTC (rev 884)
+++ trunk/py/scripts/addons/add_curve_torus_knots.py	2010-08-02 11:53:48 UTC (rev 885)
@@ -338,25 +338,14 @@
 ################################################################################
 ##### REGISTER #####
 
-torus_knot_plus_button = (lambda self, context: self.layout.operator
-            (torus_knot_plus.bl_idname, text="Torus Knot +", icon="PLUGIN"))
+def torus_knot_plus_button(self, context):
+    self.layout.operator(torus_knot_plus.bl_idname, text="Torus Knot +", icon="PLUGIN")
 
-classes = [
-torus_knot_plus
-    ]
 
 def register():
-    register = bpy.types.register
-    for cls in classes:
-        register(cls)
-
     bpy.types.INFO_MT_curve_add.append(torus_knot_plus_button)
 
 def unregister():
-    unregister = bpy.types.unregister
-    for cls in classes:
-        unregister(cls)
-
     bpy.types.INFO_MT_curve_add.remove(torus_knot_plus_button)
 
 if __name__ == "__main__":

Modified: trunk/py/scripts/addons/add_mesh_3d_function_surface.py
===================================================================
--- trunk/py/scripts/addons/add_mesh_3d_function_surface.py	2010-08-02 02:46:53 UTC (rev 884)
+++ trunk/py/scripts/addons/add_mesh_3d_function_surface.py	2010-08-02 11:53:48 UTC (rev 885)
@@ -615,31 +615,20 @@
 import space_info
 
 # Define "3D Function Surface" menu
-menu_func_z = (lambda self, context: self.layout.operator(
-    AddZFunctionSurface.bl_idname,
-    text="Z Function Surface",
-    icon="PLUGIN"))
-menu_func_xyz = (lambda self, context: self.layout.operator(
-    AddXYZFunctionSurface.bl_idname,
-    text="X,Y,Z Function Surface",
-    icon="PLUGIN"))
+def menu_func_z(self, context):
+    self.layout.operator(AddZFunctionSurface.bl_idname, text="Z Function Surface", icon="PLUGIN")
 
+def menu_func_xyz(self, context):
+    self.layout.operator(AddXYZFunctionSurface.bl_idname, text="X,Y,Z Function Surface", icon="PLUGIN")
 
-def register():
-    # Register the operators/menus.
-    bpy.types.register(AddZFunctionSurface)
-    bpy.types.register(AddXYZFunctionSurface)
 
+def register():
     # Add menus to the "Add Mesh" menu
     space_info.INFO_MT_mesh_add.append(menu_func_z)
     space_info.INFO_MT_mesh_add.append(menu_func_xyz)
 
 
 def unregister():
-    # Unregister the operators/menus.
-    bpy.types.unregister(AddZFunctionSurface)
-    bpy.types.unregister(AddXYZFunctionSurface)
-
     # Remove menus from the "Add Mesh" menu.
     space_info.INFO_MT_mesh_add.remove(menu_func_z)
     space_info.INFO_MT_mesh_add.remove(menu_func_xyz)

Modified: trunk/py/scripts/addons/add_mesh_BoltFactory/__init__.py
===================================================================
--- trunk/py/scripts/addons/add_mesh_BoltFactory/__init__.py	2010-08-02 02:46:53 UTC (rev 884)
+++ trunk/py/scripts/addons/add_mesh_BoltFactory/__init__.py	2010-08-02 11:53:48 UTC (rev 885)
@@ -28,31 +28,28 @@
     'category': 'Add Mesh'}
 
 import bpy
-from add_mesh_BoltFactory.Boltfactory import add_mesh_bolt
 
+try:
+    init_data
+
+    reload(Boltfactory)
+except:
+    from add_mesh_BoltFactory import Boltfactory
+
+init_data = True
+
 ################################################################################
 ##### REGISTER #####
 
-add_mesh_bolt_button = (lambda self, context: self.layout.operator
-            (add_mesh_bolt.bl_idname, text="BOLT", icon="PLUGIN"))
+def add_mesh_bolt_button(self, context):
+    self.layout.operator(Boltfactory.add_mesh_bolt.bl_idname, text="BOLT", icon="PLUGIN")
 
-classes = [
-add_mesh_bolt
-    ]
 
 def register():
-    register = bpy.types.register
-    for cls in classes:
-        register(cls)
-
     bpy.types.INFO_MT_mesh_add.append(add_mesh_bolt_button)
     #bpy.types.VIEW3D_PT_tools_objectmode.prepend(add_mesh_bolt_button) #just for testing
 
 def unregister():
-    unregister = bpy.types.unregister
-    for cls in classes:
-        unregister(cls)
-
     bpy.types.INFO_MT_mesh_add.remove(add_mesh_bolt_button)
     #bpy.types.VIEW3D_PT_tools_objectmode.remove(add_mesh_bolt_button) #just for testing
     

Modified: trunk/py/scripts/addons/add_mesh_ant_landscape.py
===================================================================
--- trunk/py/scripts/addons/add_mesh_ant_landscape.py	2010-08-02 02:46:53 UTC (rev 884)
+++ trunk/py/scripts/addons/add_mesh_ant_landscape.py	2010-08-02 11:53:48 UTC (rev 885)
@@ -749,18 +749,14 @@
 import space_info
 
 # Define "Landscape" menu
-menu_func_landscape = (lambda self, context: self.layout.operator(
-    landscape_add.bl_idname,
-    text="Landscape",
-    icon="PLUGIN"))
+def menu_func_landscape(self, context):
+    self.layout.operator(landscape_add.bl_idname, text="Landscape", icon="PLUGIN")
 
 def register():
-    bpy.types.register(landscape_add)
     space_info.INFO_MT_mesh_add.append(menu_func_landscape)
 
 def unregister():
-    bpy.types.unregister(landscape_add)
     space_info.INFO_MT_mesh_add.remove(menu_func_landscape)
 
 if __name__ == "__main__":
-    register()
\ No newline at end of file
+    register()

Modified: trunk/py/scripts/addons/add_mesh_extras.py
===================================================================
--- trunk/py/scripts/addons/add_mesh_extras.py	2010-08-02 02:46:53 UTC (rev 884)
+++ trunk/py/scripts/addons/add_mesh_extras.py	2010-08-02 11:53:48 UTC (rev 885)
@@ -758,32 +758,16 @@
 import space_info
 
 # Define "Gemstones" menu
-menu_func = (lambda self,
-    context: self.layout.menu("INFO_MT_mesh_extras_add", icon="PLUGIN"))
+def menu_func(self, context):
+    self.layout.menu("INFO_MT_mesh_extras_add", icon="PLUGIN")
 
 
 def register():
-    # Register the operators/menus.
-    bpy.types.register(AddSqorus)
-    bpy.types.register(AddWedge)
-    bpy.types.register(AddSpindle)
-    bpy.types.register(AddStar)
-    bpy.types.register(AddTrapezohedron)
-    bpy.types.register(INFO_MT_mesh_extras_add)
-
     # Add "Gemstones" menu to the "Add Mesh" menu
     space_info.INFO_MT_mesh_add.append(menu_func)
 
 
 def unregister():
-    # Unregister the operators/menus.
-    bpy.types.unregister(AddSqorus)
-    bpy.types.unregister(AddWedge)
-    bpy.types.unregister(AddSpindle)
-    bpy.types.unregister(AddStar)
-    bpy.types.unregister(AddTrapezohedron)
-    bpy.types.unregister(INFO_MT_mesh_extras_add)
-
     # Remove "Gemstones" menu from the "Add Mesh" menu.
     space_info.INFO_MT_mesh_add.remove(menu_func)
 

Modified: trunk/py/scripts/addons/add_mesh_gears.py
===================================================================
--- trunk/py/scripts/addons/add_mesh_gears.py	2010-08-02 02:46:53 UTC (rev 884)
+++ trunk/py/scripts/addons/add_mesh_gears.py	2010-08-02 11:53:48 UTC (rev 885)
@@ -924,24 +924,16 @@
 
 
 # Define "Gears" menu
-menu_func = (lambda self,
-    context: self.layout.menu("INFO_MT_mesh_gears_add", icon="PLUGIN"))
+def menu_func(self, context):
+    self.layout.menu("INFO_MT_mesh_gears_add", icon="PLUGIN")
 
 
 def register():
-    bpy.types.register(AddGear)
-    bpy.types.register(AddWormGear)
-    bpy.types.register(INFO_MT_mesh_gears_add)
-
     # Add "Gears" entry to the "Add Mesh" menu.
     bpy.types.INFO_MT_mesh_add.append(menu_func)
 
 
 def unregister():
-    bpy.types.unregister(AddGear)
-    bpy.types.unregister(AddWormGear)
-    bpy.types.unregister(INFO_MT_mesh_gears_add)
-
     # Remove "Gears" entry from the "Add Mesh" menu.
     bpy.types.INFO_MT_mesh_add.remove(menu_func)
 

Modified: trunk/py/scripts/addons/add_mesh_gemstones.py
===================================================================
--- trunk/py/scripts/addons/add_mesh_gemstones.py	2010-08-02 02:46:53 UTC (rev 884)
+++ trunk/py/scripts/addons/add_mesh_gemstones.py	2010-08-02 11:53:48 UTC (rev 885)
@@ -452,27 +452,18 @@
 # Register all operators and panels
 import space_info
 
+
 # Define "Gemstones" menu
-menu_func = (lambda self,
-    context: self.layout.menu("INFO_MT_mesh_gemstones_add", icon="PLUGIN"))
+def menu_func(self, context):
+    self.layout.menu("INFO_MT_mesh_gemstones_add", icon="PLUGIN")
 
 
 def register():
-    # Register the operators/menus.
-    bpy.types.register(AddDiamond)
-    bpy.types.register(AddGem)
-    bpy.types.register(INFO_MT_mesh_gemstones_add)
-
     # Add "Gemstones" menu to the "Add Mesh" menu
     space_info.INFO_MT_mesh_add.append(menu_func)
 
 
 def unregister():
-    # Unregister the operators/menus.
-    bpy.types.unregister(AddDiamond)
-    bpy.types.unregister(AddGem)
-    bpy.types.unregister(INFO_MT_mesh_gemstones_add)
-
     # Remove "Gemstones" menu from the "Add Mesh" menu.
     space_info.INFO_MT_mesh_add.remove(menu_func)
 

Modified: trunk/py/scripts/addons/add_mesh_pipe_joint.py
===================================================================
--- trunk/py/scripts/addons/add_mesh_pipe_joint.py	2010-08-02 02:46:53 UTC (rev 884)
+++ trunk/py/scripts/addons/add_mesh_pipe_joint.py	2010-08-02 11:53:48 UTC (rev 885)
@@ -1267,32 +1267,16 @@
 import space_info
 
 # Define "Pipe Joints" menu
-menu_func = (lambda self,
-    context: self.layout.menu("INFO_MT_mesh_pipe_joints_add", icon="PLUGIN"))
+def menu_func(self, context):
+    self.layout.menu("INFO_MT_mesh_pipe_joints_add", icon="PLUGIN")
 
 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list