diff options
author | Willian Padovani Germano <wpgermano@gmail.com> | 2007-02-01 04:34:51 +0300 |
---|---|---|
committer | Willian Padovani Germano <wpgermano@gmail.com> | 2007-02-01 04:34:51 +0300 |
commit | 1f4af00c943ad63cb21686762f31bd522bafc229 (patch) | |
tree | f08613355faddd1f42f13473705d96240ea28a8f /release/scripts/ac3d_import.py | |
parent | 53150249e958a1be148357d611a0aaea5d7eb8ee (diff) |
Scripts:
- Making the ac3d importer discard bad faces in the imported model (faces that reference a vertex index more than once). Thanks Melchior Franz for reporting this one, too.
Diffstat (limited to 'release/scripts/ac3d_import.py')
-rw-r--r-- | release/scripts/ac3d_import.py | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/release/scripts/ac3d_import.py b/release/scripts/ac3d_import.py index 9ba664f9c5d..c8dad75f2a7 100644 --- a/release/scripts/ac3d_import.py +++ b/release/scripts/ac3d_import.py @@ -381,19 +381,22 @@ class AC3DImport: face = [edges[-1][-1], edges[0][0]] edges.append(face) - else: - while len(face) > 4: - cut = face[:4] - cutuv = fuv[:4] - face = face[3:] - fuv = fuv[3:] - face.insert(0, cut[0]) - fuv.insert(0, cutuv[0]) - faces.append(cut) - fuvs.append(cutuv) - - faces.append(face) - fuvs.append(fuv) + else: # polygon + + # check for bad face, that references same vertex more than once + if sum(map(face.count, face)) == len(face): + while len(face) > 4: + cut = face[:4] + cutuv = fuv[:4] + face = face[3:] + fuv = fuv[3:] + face.insert(0, cut[0]) + fuv.insert(0, cutuv[0]) + faces.append(cut) + fuvs.append(cutuv) + + faces.append(face) + fuvs.append(fuv) obj.flist_cfg.extend([[mat, is_smooth, twoside]] * len(faces)) obj.flist_v.extend(faces) @@ -580,7 +583,7 @@ class AC3DImport: mesh.faceUV = True - # checking if the .ac file had duplicate faces (Blender ignores them): + # checking if the .ac file had duplicate faces (Blender ignores them) if facesnum != len(obj.flist_v): # it has, ugh. Let's clean the uv list: lenfl = len(obj.flist_v) @@ -590,7 +593,7 @@ class AC3DImport: for f in flist: f.sort() fi = lenfl - while fi > 0: + while fi > 0: # remove data related to duplicates fi -= 1 if flist[fi] in flist[:fi]: uvlist.pop(fi) |