diff options
author | Willian Padovani Germano <wpgermano@gmail.com> | 2007-02-06 22:40:13 +0300 |
---|---|---|
committer | Willian Padovani Germano <wpgermano@gmail.com> | 2007-02-06 22:40:13 +0300 |
commit | 0bbe1b393e011366a4b6239b1b25953d1290c854 (patch) | |
tree | 14534038e9c074e76406f44938ce0df03178d29b /release/scripts/ac3d_import.py | |
parent | 7d3e392cbf6ae952e55269e79cb962237887ad4e (diff) |
Scripts:
-Another update to the ac3d importer to handle models with wrong face data. Thanks Melchior Franz for reporting.
Diffstat (limited to 'release/scripts/ac3d_import.py')
-rw-r--r-- | release/scripts/ac3d_import.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/release/scripts/ac3d_import.py b/release/scripts/ac3d_import.py index c8dad75f2a7..7aa8d8ab8ba 100644 --- a/release/scripts/ac3d_import.py +++ b/release/scripts/ac3d_import.py @@ -338,6 +338,8 @@ class AC3DImport: numsurf = int(value) NUMSURF = numsurf + badface_notpoly = badface_multirefs = 0 + while numsurf: flags = lines[i].split()[1][2:] if len(flags) > 1: @@ -384,7 +386,14 @@ class AC3DImport: else: # polygon # check for bad face, that references same vertex more than once - if sum(map(face.count, face)) == len(face): + lenface = len(face) + if lenface < 3: + # less than 3 vertices, not a face + badface_notpoly += 1 + elif sum(map(face.count, face)) != lenface: + # multiple references to the same vertex + badface_multirefs += 1 + else: # ok, seems fine while len(face) > 4: cut = face[:4] cutuv = fuv[:4] @@ -405,6 +414,13 @@ class AC3DImport: numsurf -= 1 + if badface_notpoly or badface_multirefs: + inform('Object "%s" - ignoring bad faces:' % obj.name) + if badface_notpoly: + inform('\t%d face(s) with less than 3 vertices.' % badface_notpoly) + if badface_multirefs: + inform('\t%d face(s) with multiple references to a same vertex.' % badface_multirefs) + self.i = i def parse_file(self): |