]> git.tdb.fi Git - libs/gl.git/blobdiff - blender/io_mspgl/outfile.py
Some fixes for the scene exporter
[libs/gl.git] / blender / io_mspgl / outfile.py
index ca7abcf9de4855dcd3ac3fa8029b7d7c48a809aa..2c747a8713dbbb697007bc15f5fe671d0cfc986b 100644 (file)
@@ -2,6 +2,7 @@ import sys
 
 class OutFile:
        def __init__(self, fn):
+               self.filename = fn
                if fn==None:
                        self.file = sys.stdout
                else:
@@ -12,7 +13,7 @@ class OutFile:
                pstr = ""
                for p in params:
                        if type(p)==float:
-                               pstr += " %.6g"%p
+                               pstr += " %#.6g"%p
                        else:
                                pstr += " %s"%p
                return "%s%s"%(kwd, pstr)
@@ -28,3 +29,9 @@ class OutFile:
        def end(self):
                self.indent -= 1
                self.file.write("%s};\n"%('\t'*self.indent))
+
+
+def open_output(f):
+       if isinstance(f, OutFile):
+               return f
+       return OutFile(f)