]> git.tdb.fi Git - libs/gl.git/blobdiff - blender/io_mspgl/export_mesh.py
Refactor writing files in the Blender exporter
[libs/gl.git] / blender / io_mspgl / export_mesh.py
index e620b86f22ab9f0ebe155eb8ed50d3bcd9615789..0bf7b83af6fb6be4581f0dcfcbebd04674ddc17b 100644 (file)
@@ -34,9 +34,7 @@ class MeshExporter:
                progress.push_task("", 0.0, 0.95)
                resource = self.export_mesh(context, obj, progress)
 
-               with open(out_fn, "w") as out_file:
-                       for s in resource.statements:
-                               s.write_to_file(out_file)
+               resource.write_to_file(out_fn)
 
        def export_mesh(self, context, mesh_or_obj, progress):
                from .mesh import Mesh, create_mesh_from_object
@@ -49,7 +47,7 @@ class MeshExporter:
                        progress.pop_task()
 
                from .datafile import Resource, Statement, Token
-               resource = Resource(mesh.name+".mesh")
+               resource = Resource(mesh.name+".mesh", "mesh")
                statements = resource.statements
 
                st = Statement("vertices", Token("NORMAL3"))