Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Letwory <nathan@mcneel.com>2014-09-19 11:41:33 +0400
committerNathan Letwory <nathan@mcneel.com>2014-09-19 11:44:42 +0400
commitd04e4882730ddea67af1a92d492da1f969c9e243 (patch)
tree35600a261734f7e9c91c8c837d48a379820ab750
parent1c8d9cc4a923c0b0d8cc5f2ec10347b1db3b789c (diff)
Add texture coordinate export.
-rw-r--r--intern/cycles/app/io_export_cycles_xml.py21
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()
+