]> git.tdb.fi Git - libs/gl.git/blobdiff - blender/io_mspgl/export_object.py
Refactor writing files in the Blender exporter
[libs/gl.git] / blender / io_mspgl / export_object.py
index 5b81ace45e6cce1a01416e3acb49f4e51d331a78..6cc0be31bf93217d90014c83e8ef95311615757b 100644 (file)
@@ -80,13 +80,8 @@ class ObjectExporter:
                                numbers[ext] = n+1
 
                for r in refs:
-                       with open(os.path.join(path, r.name), "w") as out_file:
-                               for s in r.statements:
-                                       s.write_to_file(out_file)
-
-               with open(out_fn, "w") as out_file:
-                       for s in obj_res.statements:
-                               s.write_to_file(out_file)
+                       r.write_to_file(os.path.join(path, r.name))
+               obj_res.write_to_file(out_fn)
 
        def export_object_resources(self, context, obj, resources, progress, material_maps=None):
                if material_maps is None:
@@ -149,7 +144,7 @@ class ObjectExporter:
                lods = self.collect_object_lods(obj)
 
                from .datafile import Resource, Statement
-               obj_res = Resource(obj.name+".object")
+               obj_res = Resource(obj.name+".object", "object")
                statements = obj_res.statements
 
                center, radius = self.compute_bounding_sphere(obj)
@@ -202,7 +197,7 @@ class ObjectExporter:
 
        def export_stub_technique(self):
                from .datafile import Resource, Statement
-               tech_res = Resource("stub.tech")
+               tech_res = Resource("stub.tech", "technique")
                pass_st = Statement("pass", "")
                tech_res.statements.append(pass_st)
                mat_st = Statement("material")