2 from io_utils import ExportHelper
4 class ExportMspGL(bpy.types.Operator, ExportHelper):
5 bl_idname = "export.mspgl"
6 bl_label = "Export Msp GL data"
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 export_uv = bpy.props.EnumProperty(name="Export UV", description="Export UV coordinates", default="UNIT0",
17 items=(("NONE", "None", "No UV coordinates are exported"),
18 ("UNIT0", "Unit 0", "UV coordinates for unit 0 are exported"),
19 ("ALL", "All", "All UV coordinates are exported")))
20 tbn_vecs = bpy.props.BoolProperty(name="TBN vectors", description="Compute tangent and binormal vectors for vertices", default=False)
21 tbn_uvtex = bpy.props.StringProperty(name="TBN UV layer", description="UV layer to use as basis for TBN vectors", default="")
22 compound = bpy.props.BoolProperty(name="Compound", description="Combine all selected objects into one for exporting", default=False)
23 object = bpy.props.BoolProperty(name="Object", description="Export an object instead of a mesh", default=False)
24 material_tex = bpy.props.BoolProperty(name="Material texture", description="Generate a texture based on material colors", default=False)
25 smoothing = bpy.props.EnumProperty(name="Smoothing", description="Smoothing method to use", default="MSPGL",
26 items=(("NONE", "None", "No smoothing"),
27 ("BLENDER", "Blender", "Use Blender's vertex normals"),
28 ("MSPGL", "MspGL", "Compute vertex normals internally")))
30 def execute(self, context):
31 from . import export_mspgl
32 exporter = export_mspgl.Exporter()
33 for k, v in self.as_keywords().items():
34 setattr(exporter, k, v)
35 exporter.export(context, self.filepath)
38 def menu_func_export(self, context):
39 self.layout.operator(ExportMspGL.bl_idname, text="Msp GL")
42 bpy.types.INFO_MT_file_export.append(menu_func_export)
44 if __name__=="__main__":