]> git.tdb.fi Git - libs/gl.git/blobdiff - blender/io_mspgl/export_camera.py
Refactor writing files in the Blender exporter
[libs/gl.git] / blender / io_mspgl / export_camera.py
index 1594423a6ee3722faa3c1a70572d890a09c77efe..fb45535b199c77f600b8bb43e758570264ffb3ab 100644 (file)
@@ -7,16 +7,14 @@ class CameraExporter:
 
                resource = self.export_camera(obj)
 
-               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_camera(self, obj):
                if obj.type!='CAMERA':
                        raise Exception("Object is not a camera")
 
                from .datafile import Resource, Statement
-               resource = Resource(obj.name+".camera")
+               resource = Resource(obj.name+".camera", "camera")
 
                position = obj.matrix_world*mathutils.Vector((0, 0, 0))
                resource.statements.append(Statement("position", position[0], position[1], position[2]))