+ for face in mesh.faces:
+ if not face.sel:
+ continue
+
+ self.file.write("<polygon points=\"")
+
+ for v in face:
+ p = self._calcCanvasCoord(v)
+ self.file.write("%g,%g " % (p[0], p[1]))
+
+ # get rid of the last blank space, just cosmetics here.
+ self.file.seek(-1, 1)
+ self.file.write("\"\n")
+
+ # take as face color the first vertex color
+ # TODO: the average of vetrex colors?
+ if face.col:
+ fcol = face.col[0]
+ color = [fcol.r, fcol.g, fcol.b, fcol.a]
+ else:
+ color = [255, 255, 255, 255]
+
+ # use the stroke property to alleviate the "adjacent edges" problem,
+ # we simulate polygon expansion using borders,
+ # see http://www.antigrain.com/svg/index.html for more info
+ stroke_col = color
+ stroke_width = 0.5
+
+ # Convert the color to the #RRGGBB form
+ str_col = "#%02X%02X%02X" % (color[0], color[1], color[2])
+
+ self.file.write("\tstyle=\"fill:" + str_col + ";")
+ if POLYGON_EXPANSION_TRICK:
+ self.file.write(" stroke:" + str_col + ";")
+ self.file.write(" stroke-width:" + str(stroke_width) + ";\n")
+ self.file.write(" stroke-linecap:round;stroke-linejoin:round")
+ self.file.write("\"/>\n")
+
+ self.file.write("</g>\n")
+
+ def _printEdges(self, mesh, showHiddenEdges=False):
+ """Print the wireframe using mesh edges.