self.normal = face.normal
self.use_smooth = face.use_smooth
self.material_index = face.material_index
- self.uvs = []
self.flag = False
def __cmp__(self, other):
n = self.vertices.index(v)
return [(n+i)%len(self.vertices) for i in range(len(self.vertices))]
+ def get_loop_index(self, v):
+ return self.loop_indices[self.vertices.index(v)]
+
def get_edge(self, v1, v2):
key = make_edge_key(v1.index, v2.index)
for e in self.edges:
for i in f.loop_indices:
l.uvs[i] = mathutils.Vector((*l.uvs[i], layer))
- # Copy UVs from layers to faces
- for f in self.faces:
- for u in self.uv_layers:
- f.uvs.append([u.uvs[i] for i in f.loop_indices])
-
prog_count = len(self.uv_layers)
prog_step = 0
progress.pop_task()
prog_step += 1
- # Copy UVs from faces to vertices
+ # Copy UVs from layers to vertices
for v in self.vertices:
if v.faces:
# All faces still connected to the vertex have the same UV value
f = v.faces[0]
- i = f.vertices.index(v)
- v.uvs = [u[i] for u in f.uvs]
+ i = f.get_loop_index(v)
+ v.uvs = [u.uvs[i] for u in self.uv_layers]
else:
v.uvs = [(0.0, 0.0)]*len(self.uv_layers)
return group
def find_uv_group(self, vertex, face, index):
- uv = face.uvs[index][face.vertices.index(vertex)]
+ layer = self.uv_layers[index]
+ uv = layer.uvs[face.get_loop_index(vertex)]
face.flag = True
group = [face]
for f in vertex.faces:
- if not f.flag and f.uvs[index][f.vertices.index(vertex)]==uv:
+ if not f.flag and layer.uvs[f.get_loop_index(vertex)]==uv:
f.flag = True
group.append(f)