]> git.tdb.fi Git - libs/gl.git/blob - blender/io_mesh_mspgl/__init__.py
1445ff40fff814e11e9a0e156b89440634ebc75b
[libs/gl.git] / blender / io_mesh_mspgl / __init__.py
1 import bpy
2 from io_utils import ExportHelper
3
4 class ExportMspGL(bpy.types.Operator, ExportHelper):
5         bl_idname = "export.mspgl"
6         bl_label = "Export Msp GL data"
7
8         filename_ext = ".mesh"
9
10         use_strips = bpy.props.BoolProperty(name="Use strips", description="Combine faces into triangle strips", default=True)
11         use_degen_tris = bpy.props.BoolProperty(name="Use degen tris", description="Concatenate triangle strips with degenerate triangles", default=False)
12         max_strip_len = bpy.props.IntProperty(name="Max strip length", description="Maximum length for a triangle strip", default=1024, min=4, max=16384)
13         optimize_cache = bpy.props.BoolProperty(name="Optimize cache", description="Optimize element order for vertex cache", default=True)
14         cache_size = bpy.props.IntProperty(name="Cache size", description="Simulated vertex cache size used in optimization", default=64, min=8, max=1024)
15         export_lines = bpy.props.BoolProperty(name="Export lines", description="Export edges without faces as lines", default=False)
16         tbn_vecs = bpy.props.BoolProperty(name="TBN vectors", description="Compute tangent and binormal vectors for vertices", default=False)
17         compound = bpy.props.BoolProperty(name="Compound", description="Combine all selected objects into one for exporting", default=False)
18         object = bpy.props.BoolProperty(name="Object", description="Export an object instead of a mesh", default=False)
19         material_tex = bpy.props.BoolProperty(name="Material texture", description="Generate a texture based on material colors", default=False)
20
21         def execute(self, context):
22                 from . import export_mspgl
23                 exporter = export_mspgl.Exporter()
24                 for k, v in self.as_keywords().items():
25                         setattr(exporter, k, v)
26                 exporter.export(context, self.filepath)
27                 return {"FINISHED"}
28
29 def menu_func_export(self, context):
30         self.layout.operator(ExportMspGL.bl_idname, text="Msp GL")
31
32 def register():
33         bpy.types.INFO_MT_file_export.append(menu_func_export)
34
35 if __name__=="__main__":
36         register()