change python scripts so modules which register with blender have a register() function rather then making import automatically run the register functions (generally considered bad practice by python people)

This commit is contained in:
Campbell Barton
2010-02-14 11:21:21 +00:00
parent b02f78ed02
commit 39c04315e2
76 changed files with 1310 additions and 592 deletions

View 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