- A few imported .ac models had wrong uv's, as reported by Melchior Franz (thanks). Well known reason: the vertex indices order in new faces is rearranged if the 3rd or 4th vindex is equal to 0, because of how Blender checks for tris/quads.

Fixing with that old trick of adding a vertex at index 0 in mesh.verts, adding 1 to each face vertex index, then removing the extra vertex after the model has been imported.
This commit is contained in:
Willian Padovani Germano 2007-02-13 17:37:32 +00:00
parent ac06724418
commit caa671c2c7

@ -336,6 +336,9 @@ class AC3DImport:
n -= 1
i += 1
if vlist: # prepend a vertex at 1st position to deal with vindex 0 issues
vlist.insert(0, line)
self.i = i
def parse_surf(self, value):
@ -376,7 +379,7 @@ class AC3DImport:
while rfs:
line = lines[i].split()
v = int(line[0])
v = int(line[0]) + 1 # + 1 to avoid vindex == 0
uv = [float(line[1]), float(line[2])]
face.append(v)
fuv.append(Vector(uv))
@ -695,6 +698,9 @@ class AC3DImport:
mesh.faces[i].uv = fuv
# finally, delete the 1st vertex we added to prevent vindices == 0
mesh.verts.delete(0)
mesh.calcNormals()
mesh.mode = MESH_AUTOSMOOTH