Skip to content
Snippets Groups Projects
Commit fa601f6a authored by Halvor Smedås's avatar Halvor Smedås
Browse files

Updated Export tool to read UVs

parent 87aa4de4
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -32,8 +32,8 @@ def writeVertices(outfile, vertices, uvs):
vc.normal[0],
vc.normal[1],
vc.normal[2],
uvs[vc.index][0],
uvs[vc.index][1],
uvs.get(vc.index, [0,0])[0],
uvs.get(vc.index, [0,0])[1],
255, 255, 255, 255))
......@@ -66,20 +66,18 @@ if __name__ == "__main__":
print("len(polygons[0].vertices) != 3, triangulating mesh....")
triangulate(active_object)
uvDict = {}
loops = mesh.loops
active_layer = mesh.uv_layers.active
if active_layer:
uv_layer = mesh.uv_layers.active.data
uvDict = {}
for poly in polygons:
for li in poly.loop_indices:
vi = loops[li].vertex_index
uvDict[vi] = uv_layer[li].uv
print("uvList:", uvDict);
print("uvItem:", uvDict[0]);
# @debug info
print("Active name:", active_object.name)
print("Vertexcount: ", len(vertices))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment