]> git.tdb.fi Git - libs/math.git/blobdiff - blender/io_mspmath/__init__.py
Add a Blender operator to export shapes
[libs/math.git] / blender / io_mspmath / __init__.py
diff --git a/blender/io_mspmath/__init__.py b/blender/io_mspmath/__init__.py
new file mode 100644 (file)
index 0000000..1490ce6
--- /dev/null
@@ -0,0 +1,48 @@
+bl_info = {
+       "name": "Msp math datafiles",
+       "author": "Mikko Rasa",
+       "location": "File > Export",
+       "description": "Export Msp math data",
+       "category": "Import-Export" }
+
+if "bpy" in locals():
+       import imp
+       for sub in "export_shape", "outfile", "properties":
+               if sub in locals():
+                       imp.reload(locals()[sub])
+
+import bpy
+from bpy_extras.io_utils import ExportHelper
+
+class ExportMspMathShape(bpy.types.Operator, ExportHelper):
+       bl_idname = "export_mesh.mspmath_shape"
+       bl_label = "Export Msp math shape"
+
+       filename_ext = ".shape"
+
+       def execute(self, context):
+               from .export_shape import ShapeExporter
+               exporter = ShapeExporter()
+               exporter.export(context, self.filepath)
+               return {"FINISHED"}
+
+def menu_func_export(self, context):
+       self.layout.operator(ExportMspMathShape.bl_idname, text="Msp math shape")
+
+from .properties import MspMathObjectProperties
+
+def register():
+       bpy.utils.register_module(__name__)
+
+       bpy.types.INFO_MT_file_export.append(menu_func_export)
+
+       from .properties import register_properties
+       register_properties();
+
+def unregister():
+       bpy.utils.unregister_module(__name__)
+
+       bpy.types.INFO_MT_file_export.remove(menu_func_export)
+
+if __name__=="__main__":
+       register()