]> git.tdb.fi Git - libs/math.git/blob - blender/io_mspmath/__init__.py
Add a Blender operator to export shapes
[libs/math.git] / blender / io_mspmath / __init__.py
1 bl_info = {
2         "name": "Msp math datafiles",
3         "author": "Mikko Rasa",
4         "location": "File > Export",
5         "description": "Export Msp math data",
6         "category": "Import-Export" }
7
8 if "bpy" in locals():
9         import imp
10         for sub in "export_shape", "outfile", "properties":
11                 if sub in locals():
12                         imp.reload(locals()[sub])
13
14 import bpy
15 from bpy_extras.io_utils import ExportHelper
16
17 class ExportMspMathShape(bpy.types.Operator, ExportHelper):
18         bl_idname = "export_mesh.mspmath_shape"
19         bl_label = "Export Msp math shape"
20
21         filename_ext = ".shape"
22
23         def execute(self, context):
24                 from .export_shape import ShapeExporter
25                 exporter = ShapeExporter()
26                 exporter.export(context, self.filepath)
27                 return {"FINISHED"}
28
29 def menu_func_export(self, context):
30         self.layout.operator(ExportMspMathShape.bl_idname, text="Msp math shape")
31
32 from .properties import MspMathObjectProperties
33
34 def register():
35         bpy.utils.register_module(__name__)
36
37         bpy.types.INFO_MT_file_export.append(menu_func_export)
38
39         from .properties import register_properties
40         register_properties();
41
42 def unregister():
43         bpy.utils.unregister_module(__name__)
44
45         bpy.types.INFO_MT_file_export.remove(menu_func_export)
46
47 if __name__=="__main__":
48         register()