diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/app/io_export_cycles_xml.py | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/intern/cycles/app/io_export_cycles_xml.py b/intern/cycles/app/io_export_cycles_xml.py index e310d928b26..ad8fb9d3dd3 100644 --- a/intern/cycles/app/io_export_cycles_xml.py +++ b/intern/cycles/app/io_export_cycles_xml.py @@ -111,19 +111,29 @@ class ExportCyclesXML(bpy.types.Operator, ExportHelper): # generate mesh node nverts = "" verts = "" + uvs = "" P = "" for v in mesh.vertices: P += "%f %f %f " % (v.co[0], v.co[1], v.co[2]) - for i, f in enumerate(mesh.tessfaces): - nverts += str(len(f.vertices)) + " " + verts_and_uvs = zip(mesh.tessfaces, mesh.tessface_uv_textures.active.data) + + for f, uvf in verts_and_uvs: + vcount = len(f.vertices) + nverts += str(vcount) + " " for v in f.vertices: verts += str(v) + " " - verts += " " - - node = etree.Element('mesh', attrib={'nverts': nverts, 'verts': verts, 'P': P}) + + uvs += str(uvf.uv1[0]) + " " + str(uvf.uv1[1]) + " " + uvs += str(uvf.uv2[0]) + " " + str(uvf.uv2[1]) + " " + uvs += str(uvf.uv3[0]) + " " + str(uvf.uv3[1]) + " " + if vcount==4: + uvs += " " + str(uvf.uv4[0]) + " " + str(uvf.uv4[1]) + " " + + + node = etree.Element('mesh', attrib={'nverts': nverts.strip(), 'verts': verts.strip(), 'P': P, 'UV' : uvs.strip()}) # write to file write(node, filepath) @@ -139,3 +149,4 @@ def unregister(): if __name__ == "__main__": register() + |