class Mesh:
def __init__(self, mesh):
self._mesh = mesh
+ self.name = mesh.name
self.winding_test = mesh.winding_test
self.tbn_vecs = mesh.tbn_vecs
for g in v.groups:
g.group = group_index_map[g.group]
- def prepare_uv(self, obj, progress):
- if obj.material_tex and self.use_uv!='NONE':
- layer = UvLayer("material_tex")
-
- if self.use_uv=='UNIT0':
- self.uv_layers = [layer]
- layer.unit = 0
- else:
- self.uv_layers.append(layer)
- layer.unit = max((u.unit+1 for u in self.uv_layers if u.unit is not None), default=0)
-
- layer.uvs = [None]*len(self.loops)
- for f in self.faces:
- uv = mathutils.Vector(((f.material_index+0.5)/len(self.materials), 0.5))
- for i in f.loop_indices:
- layer.uvs[i] = uv
-
+ def prepare_uv(self, progress):
# Form a list of UV layers referenced by materials with the array atlas
# property set
array_uv_layers = [t.uv_layer for m in self.materials if m.array_atlas for t in m.texture_slots if t and t.texture_coords=='UV']
else:
mesh = me
+ mesh.name = obj.data.name
+
progress.set_task("Triangulating", 0.2, 0.3)
mesh.prepare_triangles(progress)
progress.set_task("Smoothing", 0.3, 0.5)
progress.set_task("Vertex groups", 0.5, 0.6)
mesh.prepare_vertex_groups(obj)
progress.set_task("Preparing UVs", 0.6, 0.8)
- mesh.prepare_uv(obj, progress)
+ mesh.prepare_uv(progress)
progress.set_task("Render sequence", 0.8, 1.0)
mesh.prepare_sequence(progress)