From 80e85c10be4165181e658f06956e9138d3f5c6a1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 24 Dec 2010 04:27:21 +0000 Subject: 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. --- release/scripts/op/io_scene_x3d/export_x3d.py | 32 ++++----------------------- 1 file changed, 4 insertions(+), 28 deletions(-) (limited to 'release') diff --git a/release/scripts/op/io_scene_x3d/export_x3d.py b/release/scripts/op/io_scene_x3d/export_x3d.py index 62c819b92d8..72c69152d54 100644 --- a/release/scripts/op/io_scene_x3d/export_x3d.py +++ b/release/scripts/op/io_scene_x3d/export_x3d.py @@ -514,22 +514,16 @@ class x3d_class: 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 @@ class x3d_class: self.writeIndented("") self.writeIndented("\n", -1) @@ -580,23 +574,10 @@ class x3d_class: if self.writingcolor == 0: self.file.write("colorPerVertex=\"false\" ") elif mesh.vertex_colors.active: - # else: self.writeIndented(" 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 @@ class x3d_class: 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), -- cgit v1.2.3