update templates for registration changes
authorCampbell Barton <ideasman42@gmail.com>
Sat, 12 Feb 2011 08:04:32 +0000 (08:04 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 12 Feb 2011 08:04:32 +0000 (08:04 +0000)
release/scripts/templates/addon_add_object.py
release/scripts/templates/builtin_keyingset.py
release/scripts/templates/operator_export.py
release/scripts/templates/operator_mesh_add.py
release/scripts/templates/operator_modal.py
release/scripts/templates/operator_modal_draw.py
release/scripts/templates/operator_modal_view3d.py
release/scripts/templates/operator_simple.py
release/scripts/templates/operator_uv.py
release/scripts/templates/panel_simple.py

index 00db3a5..f4f1185 100644 (file)
@@ -65,10 +65,12 @@ def add_object_button(self, context):
 
 
 def register():
+    bpy.utils.register_class(OBJECT_OT_add_object)
     bpy.types.INFO_MT_mesh_add.append(add_object_button)
 
 
 def unregister():
+    bpy.utils.unregister_class(OBJECT_OT_add_object)
     bpy.types.INFO_MT_mesh_add.remove(add_object_button)
 
 
index 715b77d..0b808e9 100644 (file)
@@ -25,5 +25,14 @@ class BUILTIN_KSI_hello(bpy.types.KeyingSetInfo):
 
         ks.paths.add(id_block, "show_x_ray", group_method='NONE')
 
-# manually register
-bpy.utils.register_class(BUILTIN_KSI_hello)
+
+def register():
+    bpy.utils.register_class(BUILTIN_KSI_hello)
+
+
+def unregister():
+    bpy.utils.unregister_class(BUILTIN_KSI_hello)
+
+
+if __name__ == '__main__':
+    register()
index 4f950b1..5390d32 100644 (file)
@@ -48,7 +48,19 @@ class ExportSomeData(bpy.types.Operator, ExportHelper):
 def menu_func_export(self, context):
     self.layout.operator(ExportSomeData.bl_idname, text="Text Export Operator")
 
-bpy.types.INFO_MT_file_export.append(menu_func_export)
+
+def register():
+    bpy.utils.register_class(ExportSomeData)
+    bpy.types.INFO_MT_file_export.append(menu_func_export)
+
+
+def unregister():
+    bpy.utils.unregister_class(ExportSomeData)
+    bpy.types.INFO_MT_file_export.remove(menu_func_export)
+
 
 if __name__ == "__main__":
+    register()
+
+    # test call
     bpy.ops.export.some_data('INVOKE_DEFAULT')
index db614f3..77d172b 100644 (file)
@@ -91,11 +91,16 @@ def menu_func(self, context):
 
 
 def register():
+    bpy.utils.register_class(AddBox)
     bpy.types.INFO_MT_mesh_add.append(menu_func)
 
 
 def unregister():
+    bpy.utils.unregister_class(AddBox)
     bpy.types.INFO_MT_mesh_add.remove(menu_func)
 
 if __name__ == "__main__":
+    register()
+
+    # test call
     bpy.ops.mesh.primitive_box_add()
index 026b5fd..6eb3843 100644 (file)
@@ -35,5 +35,16 @@ class ModalOperator(bpy.types.Operator):
             return {'CANCELLED'}
 
 
+def register():
+    bpy.utils.register_class(ModalOperator)
+
+
+def unregister():
+    bpy.utils.unregister_class(ModalOperator)
+
+
 if __name__ == "__main__":
+    register()
+
+    # test call
     bpy.ops.object.modal_operator()
index 52259e4..e7a1f6e 100644 (file)
@@ -65,3 +65,14 @@ class ModalDrawOperator(bpy.types.Operator):
         else:
             self.report({'WARNING'}, "View3D not found, cannot run operator")
             return {'CANCELLED'}
+
+
+def register():
+    bpy.utils.register_class(ModalDrawOperator)
+
+
+def unregister():
+    bpy.utils.unregister_class(ModalDrawOperator)
+
+if __name__ == "__main__":
+    register()
index eacd335..c494f12 100644 (file)
@@ -54,3 +54,15 @@ class ViewOperator(bpy.types.Operator):
         else:
             self.report({'WARNING'}, "Active space must be a View3d")
             return {'CANCELLED'}
+
+
+def register():
+    bpy.utils.register_class(ViewOperator)
+
+
+def unregister():
+    bpy.utils.unregister_class(ViewOperator)
+
+
+if __name__ == "__main__":
+    register()
index 6a887a7..8348c7a 100644 (file)
@@ -20,5 +20,16 @@ class SimpleOperator(bpy.types.Operator):
         return {'FINISHED'}
 
 
+def register():
+    bpy.utils.register_class(SimpleOperator)
+
+
+def unregister():
+    bpy.utils.unregister_class(SimpleOperator)
+
+
 if __name__ == "__main__":
+    register()
+
+    # test call
     bpy.ops.object.simple_operator()
index 7339246..93fec11 100644 (file)
@@ -41,5 +41,16 @@ class UvOperator(bpy.types.Operator):
         return {'FINISHED'}
 
 
+def register():
+    bpy.utils.register_class(UvOperator)
+
+
+def unregister():
+    bpy.utils.unregister_class(UvOperator)
+
+
 if __name__ == "__main__":
+    register()
+
+    # test call
     bpy.ops.uv.simple_operator()
index 160bd1e..ddbd4eb 100644 (file)
@@ -19,3 +19,15 @@ class OBJECT_PT_hello(bpy.types.Panel):
         row.label(text="Active object is: " + obj.name)
         row = layout.row()
         row.prop(obj, "name")
+
+
+def register():
+    bpy.utils.register_class(OBJECT_PT_hello)
+
+
+def unregister():
+    bpy.utils.unregister_class(OBJECT_PT_hello)    
+
+
+if __name__ == "__main__":
+    register()