X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=blender%2Fio_mspgl%2Foutfile.py;h=2c747a8713dbbb697007bc15f5fe671d0cfc986b;hb=f9b23e69b63cbbeed8eeb605c0dc491002a4c23b;hp=ca7abcf9de4855dcd3ac3fa8029b7d7c48a809aa;hpb=fcdc70624618488c514676874006f5eddc4e63df;p=libs%2Fgl.git diff --git a/blender/io_mspgl/outfile.py b/blender/io_mspgl/outfile.py index ca7abcf9..2c747a87 100644 --- a/blender/io_mspgl/outfile.py +++ b/blender/io_mspgl/outfile.py @@ -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)