Skip to content
Snippets Groups Projects
Commit 1ca8a257 authored by Jonas Johan Solsvik's avatar Jonas Johan Solsvik
Browse files

expport_many_mesh.py - tried to fix texture incorrect teture mapping but failed

parent 8270f723
No related branches found
No related tags found
No related merge requests found
......@@ -42,6 +42,7 @@ def write_vertices_header(outfile, meshes):
vertex_count += len(mesh.data.vertices)
outfile.write("vertices: {}\n".format(str(vertex_count)))
......@@ -58,11 +59,8 @@ def write_mesh_vertices(outfile, mesh):
# Get UV coordinates
uv_dict = {}
loops = mesh.data.loops
active_layer = False
if len(mesh.data.uv_layers):
active_layer = mesh.data.uv_layers[0]
if active_layer:
uv_layer = mesh.data.uv_layers.active.data
......@@ -72,6 +70,35 @@ def write_mesh_vertices(outfile, mesh):
uv_dict[vi] = uv_layer[li].uv
# @doc https://blender.stackexchange.com/q/4820 - 2018-05-10
# for poly in mesh.data.polygons:
# for vert, loop in zip(poly.vertices, poly.loop_indices):
# outfile.write("v: {:9.6f} {:9.6f} {:9.6f} {:6.3f} {:6.3f} {:6.3f} ".format(
# mesh.data.vertices[vert].co[0]*scale,
# mesh.data.vertices[vert].co[1]*scale,
# mesh.data.vertices[vert].co[2]*scale,
#
# mesh.data.vertices[vert].normal[0],
# mesh.data.vertices[vert].normal[1],
# mesh.data.vertices[vert].normal[2]))
# active_layer = False
# if len(mesh.data.uv_layers):
# active_layer = mesh.data.uv_layers[0]
# if active_layer:
# uv_layer = mesh.data.uv_layers.active.data
#
# outfile.write("{:6.3f} {:6.3f} ".format(
# mesh.data.uv_layers.active.data[loop].uv[0], #U
# mesh.data.uv_layers.active.data[loop].uv[1])) #V
# outfile.write("{:3} {:3} {:3} {:3}\n".format(255,255,255,255))
# write vertices
for vc in mesh.data.vertices:
outfile.write("v: {:9.6f} {:9.6f} {:9.6f} {:6.3f} {:6.3f} {:6.3f} {:6.3f} {:6.3f} {:3} {:3} {:3} {:3}\n".format(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment