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:
authorWillian Padovani Germano <wpgermano@gmail.com>2007-02-13 20:37:32 +0300
committerWillian Padovani Germano <wpgermano@gmail.com>2007-02-13 20:37:32 +0300
commitcaa671c2c7265727d8f15815865b3eb0c246721d (patch)
tree5ffbfd57577e0b3ef981470a90b028b831b6b092
parentac06724418cd53132f0ff74b2f653a32f6d0ace6 (diff)
Scripts:
- 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.
-rw-r--r--release/scripts/ac3d_import.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/release/scripts/ac3d_import.py b/release/scripts/ac3d_import.py
index 252e861590c..fc169f0d6d7 100644
--- a/release/scripts/ac3d_import.py
+++ b/release/scripts/ac3d_import.py
@@ -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