]> git.tdb.fi Git - libs/gl.git/blobdiff - blender/io_mesh_mspgl/__init__.py
Add a Blender 2.5 port of the exporter
[libs/gl.git] / blender / io_mesh_mspgl / __init__.py
diff --git a/blender/io_mesh_mspgl/__init__.py b/blender/io_mesh_mspgl/__init__.py
new file mode 100644 (file)
index 0000000..1445ff4
--- /dev/null
@@ -0,0 +1,36 @@
+import bpy
+from io_utils import ExportHelper
+
+class ExportMspGL(bpy.types.Operator, ExportHelper):
+       bl_idname = "export.mspgl"
+       bl_label = "Export Msp GL data"
+
+       filename_ext = ".mesh"
+
+       use_strips = bpy.props.BoolProperty(name="Use strips", description="Combine faces into triangle strips", default=True)
+       use_degen_tris = bpy.props.BoolProperty(name="Use degen tris", description="Concatenate triangle strips with degenerate triangles", default=False)
+       max_strip_len = bpy.props.IntProperty(name="Max strip length", description="Maximum length for a triangle strip", default=1024, min=4, max=16384)
+       optimize_cache = bpy.props.BoolProperty(name="Optimize cache", description="Optimize element order for vertex cache", default=True)
+       cache_size = bpy.props.IntProperty(name="Cache size", description="Simulated vertex cache size used in optimization", default=64, min=8, max=1024)
+       export_lines = bpy.props.BoolProperty(name="Export lines", description="Export edges without faces as lines", default=False)
+       tbn_vecs = bpy.props.BoolProperty(name="TBN vectors", description="Compute tangent and binormal vectors for vertices", default=False)
+       compound = bpy.props.BoolProperty(name="Compound", description="Combine all selected objects into one for exporting", default=False)
+       object = bpy.props.BoolProperty(name="Object", description="Export an object instead of a mesh", default=False)
+       material_tex = bpy.props.BoolProperty(name="Material texture", description="Generate a texture based on material colors", default=False)
+
+       def execute(self, context):
+               from . import export_mspgl
+               exporter = export_mspgl.Exporter()
+               for k, v in self.as_keywords().items():
+                       setattr(exporter, k, v)
+               exporter.export(context, self.filepath)
+               return {"FINISHED"}
+
+def menu_func_export(self, context):
+       self.layout.operator(ExportMspGL.bl_idname, text="Msp GL")
+
+def register():
+       bpy.types.INFO_MT_file_export.append(menu_func_export)
+
+if __name__=="__main__":
+       register()