[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33881] trunk/blender/release/scripts/op/ io_scene_x3d/export_x3d.py: bugfix [#25364] Export to X3D generates objects with black color
Campbell Barton
ideasman42 at gmail.com
Fri Dec 24 05:27:22 CET 2010
Revision: 33881
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33881
Author: campbellbarton
Date: 2010-12-24 05:27:21 +0100 (Fri, 24 Dec 2010)
Log Message:
-----------
bugfix [#25364] Export to X3D generates objects with black color
was dividing color by 255 when it was already from 0-1.
also use slicing for getting tuples from vectors & colors.
Modified Paths:
--------------
trunk/blender/release/scripts/op/io_scene_x3d/export_x3d.py
Modified: trunk/blender/release/scripts/op/io_scene_x3d/export_x3d.py
===================================================================
--- trunk/blender/release/scripts/op/io_scene_x3d/export_x3d.py 2010-12-24 04:24:33 UTC (rev 33880)
+++ trunk/blender/release/scripts/op/io_scene_x3d/export_x3d.py 2010-12-24 04:27:21 UTC (rev 33881)
@@ -514,22 +514,16 @@
if self.writingcoords == 0:
self.file.write('coordIndex="')
for face in mesh.faces:
- fv = face.vertices
- # fv = face.v
+ fv = face.vertices[:]
if len(fv)==3:
- # if len(face)==3:
self.file.write("%i %i %i -1, " % (fv[0], fv[1], fv[2]))
- # self.file.write("%i %i %i -1, " % (fv[0].index, fv[1].index, fv[2].index))
else:
if EXPORT_TRI:
self.file.write("%i %i %i -1, " % (fv[0], fv[1], fv[2]))
- # self.file.write("%i %i %i -1, " % (fv[0].index, fv[1].index, fv[2].index))
self.file.write("%i %i %i -1, " % (fv[0], fv[2], fv[3]))
- # self.file.write("%i %i %i -1, " % (fv[0].index, fv[2].index, fv[3].index))
else:
self.file.write("%i %i %i %i -1, " % (fv[0], fv[1], fv[2], fv[3]))
- # self.file.write("%i %i %i %i -1, " % (fv[0].index, fv[1].index, fv[2].index, fv[3].index))
self.file.write("\">\n")
else:
@@ -538,7 +532,7 @@
self.writeIndented("<Coordinate DEF=\"%s%s\" \n" % ("coord_",meshName), 1)
self.file.write("\t\t\t\tpoint=\"")
for v in mesh.vertices:
- self.file.write("%.6f %.6f %.6f, " % tuple(v.co))
+ self.file.write("%.6f %.6f %.6f, " % v.co[:])
self.file.write("\" />")
self.writeIndented("\n", -1)
@@ -580,23 +574,10 @@
if self.writingcolor == 0:
self.file.write("colorPerVertex=\"false\" ")
elif mesh.vertex_colors.active:
- # else:
self.writeIndented("<Color color=\"", 1)
for face in mesh.vertex_colors.active.data:
- c = face.color1
- if self.verbose > 2:
- print("Debug: face.col r=%d g=%d b=%d" % (c[0], c[1], c[2]))
- # print("Debug: face.col r=%d g=%d b=%d" % (c.r, c.g, c.b))
- aColor = self.rgbToFS(c)
- self.file.write("%s, " % aColor)
-
- # for face in mesh.faces:
- # if face.col:
- # c=face.col[0]
- # if self.verbose > 2:
- # print("Debug: face.col r=%d g=%d b=%d" % (c.r, c.g, c.b))
- # aColor = self.rgbToFS(c)
- # self.file.write("%s, " % aColor)
+ # XXX, 1 color per face, only
+ self.file.write("%.3f %.3f %.3f, " % face.color1[:])
self.file.write("\" />")
self.writeIndented("\n",-1)
@@ -920,11 +901,6 @@
print("Debug: mesh.faces=%d" % len(mesh.faces))
print("Debug: mesh.materials=%d" % len(mesh.materials))
- def rgbToFS(self, c):
- s="%s %s %s" % (round(c[0]/255.0,self.cp),
- round(c[1]/255.0,self.cp),
- round(c[2]/255.0,self.cp))
-
# s="%s %s %s" % (
# round(c.r/255.0,self.cp),
# round(c.g/255.0,self.cp),
More information about the Bf-blender-cvs
mailing list