[Bf-committers] VRML exporter docs

Campbell Barton cbarton at metavr.com
Sat Apr 9 02:44:30 CEST 2005

replace line 834
if newName[0] in ['0','1','2','3','4','5','6','7','8','9']:
if newName[0].isdigit():

Why add a string at the end? Thats what string formatting is for. no 
biggie- but your doing it a lot.
self.writeIndented("groundColor [ %s %s %s" % (round(grd0,self.cp), 
round(grd1,self.cp), round(grd2,self.cp)) + ",")
self.writeIndented("groundColor [ %s %s %s," % (round(grd0,self.cp), 
round(grd1,self.cp), round(grd2,self.cp)) )

Probably the best way of indenting is this
indent = [""]
for i in xrange(40):
    indent.appden("%s\t" % indent[-1])

file.write("%sfoobar\n" % indent[3]) # Indents without string generation

if your paranoied that your going to get more then 40 indentatiuons, 
then do a .... Where i is the abbount your indenting
i+=blah blah some unknown indent.
file.write("%sfoobar\n" % indent[min(i, 40)])

This is slightly better then the code I posted on blender.org

- Cam

Bart wrote:

> Found a proper way exporting face and vertex color:
> http://www.neeneenee.de/blender/x3d/vrml97_export150.py.txt
> For this check out new help docs again (Textures and Materials)
> http://www.neeneenee.de/blender/x3d/exporting_web3d.html

Campbell J Barton

133 Hope Street
Geelong West, Victoria 3218 Australia

URL:    http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241

More information about the Bf-committers mailing list