change python scripts so modules which register with blender have a register() functi...
[blender.git] / release / scripts / op / add_mesh_torus.py
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)