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 00db3a5529157aebae6a9bfd6c244e12adaadf0d..f4f1185e282e86593b8ddf3f42e5cb423dd2c5f8 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 715b77d3dbd7ff4b0f5d5ccc334f849abf2f929a..0b808e9cd26cc93d61d0ae85d6249424149257a7 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 4f950b11d0158ecd51f3c388011aa2f2c89bbd02..5390d32aeffa7a77837d462f55c04f0040afa5c0 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 db614f3a74c6f3ea4767c6aed96ffa796fc80d52..77d172b3068cde22f38f0b23633992470c1466b5 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 026b5fd2d16e69ecae357ae53d16bccf9bb46604..6eb3843d6a641602e16af02bb6257c645149f2a8 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 52259e4b8e75b25c154ccd2ce7b7019f1a724ef0..e7a1f6e4ffeafc573437d3f9de263610bd504f76 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 eacd335c1daa0ed0244d360830cdffed3a2af32c..c494f121017e2660c4acd779eccdbaf5aa2c6bbb 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 6a887a70bdcf66b71832570c769d0f937ca6b0b2..8348c7a95b13a17b0dd42210cc6d5de6e8e2e863 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 73392466aa739dbdcb06478a22b3e76a1008abb5..93fec117fa10bb2be1bef26ccbae9eb79c450923 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 160bd1ef0bf228ffacda7b8d8e5791eb6b48a47c..ddbd4eb7aa489465bda1773e855c2bfaa2e9e3d6 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()