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:
authorCampbell Barton <ideasman42@gmail.com>2010-11-28 16:39:39 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-11-28 16:39:39 +0300
commit6b4e7e8defcaaef511539b33996a6a180d451c6d (patch)
tree5f7e9a2b18c9cbe8f44623c819035165bb246a71 /release
parent2840d524e05ebfdbce9d5edf569496a5d5ef91c8 (diff)
bugfix "Export UV Layout" stalls when saving file in 2.55b
remove duplicate UVs on export to avoid long ztransp filling times - common on faces which have no assigned UV coords.
Diffstat (limited to 'release')
-rw-r--r--release/scripts/op/uv.py40
1 files changed, 26 insertions, 14 deletions
diff --git a/release/scripts/op/uv.py b/release/scripts/op/uv.py
index 7e903c04421..79ce5fe5a1e 100644
--- a/release/scripts/op/uv.py
+++ b/release/scripts/op/uv.py
@@ -126,27 +126,39 @@ def write_png(fw, mesh_source, image_width, image_height, face_iter):
for f in mesh_source.faces:
tot_verts += len(f.vertices)
+
+ faces_source = mesh_source.faces
+
+ # get unique UV's incase there are many overlapping which slow down filling.
+ face_hash_3 = set()
+ face_hash_4 = set()
+ for i, uv in face_iter:
+ material_index = faces_source[i].material_index
+ if len(uv) == 3:
+ face_hash_3.add((uv[0][0], uv[0][1], uv[1][0], uv[1][1], uv[2][0], uv[2][1], material_index))
+ else:
+ face_hash_4.add((uv[0][0], uv[0][1], uv[1][0], uv[1][1], uv[2][0], uv[2][1], uv[3][0], uv[3][1], material_index))
+
# now set the faces coords and locations
# build mesh data
mesh_new_vertices = []
mesh_new_materials = []
mesh_new_face_vertices = []
-
-
+
+
current_vert = 0
- faces_source = mesh_source.faces
- for i, uv in face_iter:
- if len(uv) == 3:
- mesh_new_vertices.extend([uv[0][0], uv[0][1], 0.0, uv[1][0], uv[1][1], 0.0, uv[2][0], uv[2][1], 0.0])
- mesh_new_face_vertices.extend([current_vert, current_vert + 1, current_vert + 2, 0])
- current_vert += 3
- else:
- mesh_new_vertices.extend([uv[0][0], uv[0][1], 0.0, uv[1][0], uv[1][1], 0.0, uv[2][0], uv[2][1], 0.0, uv[3][0], uv[3][1], 0.0])
- mesh_new_face_vertices.extend([current_vert, current_vert + 1, current_vert + 2, current_vert + 3])
- current_vert += 4
- mesh_new_materials.append(faces_source[i].material_index)
-
+ for face_data in face_hash_3:
+ mesh_new_vertices.extend([face_data[0], face_data[1], 0.0, face_data[2], face_data[3], 0.0, face_data[4], face_data[5], 0.0])
+ mesh_new_face_vertices.extend([current_vert, current_vert + 1, current_vert + 2, 0])
+ mesh_new_materials.append(face_data[6])
+ current_vert += 3
+ for face_data in face_hash_4:
+ mesh_new_vertices.extend([face_data[0], face_data[1], 0.0, face_data[2], face_data[3], 0.0, face_data[4], face_data[5], 0.0, face_data[6], face_data[7], 0.0])
+ mesh_new_face_vertices.extend([current_vert, current_vert + 1, current_vert + 2, current_vert + 3])
+ mesh_new_materials.append(face_data[8])
+ current_vert += 4
+
mesh.vertices.add(len(mesh_new_vertices) // 3)
mesh.faces.add(len(mesh_new_face_vertices) // 4)