- Fixing another bug in the ac3d import script, thanks again Melchior Franz for testing and reporting.
This commit is contained in:
Willian Padovani Germano 2007-01-30 20:12:30 +00:00
parent f0e18a8b94
commit 2d14f8c224

@ -339,10 +339,14 @@ class AC3DImport:
NUMSURF = numsurf NUMSURF = numsurf
while numsurf: while numsurf:
flags = lines[i].split() flags = lines[i].split()[1][2:]
flaglow = 0 if len(flags) > 1:
if len(flags[1]) > 3: flaglow = int(flags[1][3]) flaghigh = int(flags[0])
flaghigh = int(flags[1][2]) flaglow = int(flags[1])
else:
flaghigh = 0
flaglow = int(flags[0])
is_smooth = flaghigh & 1 is_smooth = flaghigh & 1
twoside = flaghigh & 2 twoside = flaghigh & 2
mat = lines[i+1].split() mat = lines[i+1].split()
@ -366,14 +370,14 @@ class AC3DImport:
fuv.append(Vector(uv)) fuv.append(Vector(uv))
rfs -= 1 rfs -= 1
i += 1 i += 1
if flaglow: # it's a line or closed line, not a polygon if flaglow: # it's a line or closed line, not a polygon
while len(face) >= 2: while len(face) >= 2:
cut = face[:2] cut = face[:2]
edges.append(cut) edges.append(cut)
face = face[1:] face = face[1:]
if flaglow == 1 and edges: if flaglow == 1 and edges: # closed line
face = [edges[-1][-1], edges[0][0]] face = [edges[-1][-1], edges[0][0]]
edges.append(face) edges.append(face)
@ -568,10 +572,14 @@ class AC3DImport:
if obj.flist_v: if obj.flist_v:
mesh.faces.extend(obj.flist_v) mesh.faces.extend(obj.flist_v)
mesh.faceUV = True
facesnum = len(mesh.faces) facesnum = len(mesh.faces)
if facesnum == 0: # shouldn't happen, of course
continue
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): if facesnum != len(obj.flist_v):
# it has, ugh. Let's clean the uv list: # it has, ugh. Let's clean the uv list: