bug fix for acc importer in blender. Was not properly handling triangle strips on tracks such as manton.acc

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@2511 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 47678e22b203cac4d7242ac30855908923ba3a93
Former-commit-id: 93986efb1b873039dfbc0ce260993ecea326137b
This commit is contained in:
briangr 2010-06-05 17:53:24 +00:00
parent 03755f3e13
commit ba32a8386a

View file

@ -378,9 +378,12 @@ class AC3DImport:
flags = lines[i].split()[1][2:]
flag = lines[i].split()[1]
tristrip = False
trifan = False
if ((flag=='0x14')|(flag=='0x24')|(flag=='0x34')):
tristrip = True
if flag =='0x30':
trifan = True;
if len(flags) > 1:
flaghigh = int(flags[0])
@ -421,6 +424,8 @@ class AC3DImport:
rfs -= 1
i += 1
#handle triangle strip convert into triangles
if tristrip==True:
index = 0
@ -485,7 +490,34 @@ class AC3DImport:
fuvs.append(fuvt)
fuvs2.append(fuvt2)
elif trifan==True:
index = 1
while index<refs-2:
facet = []
fuvt = []
fuvt2 = []
facet.append(face[0])
uv = fuv[0];
fuvt.append(uv)
if len(fuv2)>0:
uv2 = fuv2[0];
fuvt2.append(uv2)
facet.append(face[index])
uv = fuv[index];
fuvt.append(uv)
if len(fuv2)>0:
uv2 = fuv2[index];
fuvt2.append(uv2)
facet.append(face[index+1])
uv = fuv[index+1];
fuvt.append(uv)
if len(fuv2)>0:
uv2 = fuv2[index+1];
fuvt2.append(uv2)
index+=2
elif flaglow: # it's a line or closed line, not a polygon
while len(face) >= 2:
@ -497,6 +529,7 @@ class AC3DImport:
face = [edges[-1][-1], edges[0][0]]
edges.append(face)
else: # polygon
Blender.Draw.PupMenu('Polygon found')
@ -851,7 +884,7 @@ class AC3DImport:
basetex.setType('Image')
map1=Texture.MapTo.COL|Texture.MapTo.ALPHA
basetex.image = img
bl_textures[iname] = basetex;
bl_textures[iname] = basetex
basetex = bl_textures[iname]
m1.setTexture(0,basetex,Texture.TexCo.UV,map1)
@ -864,6 +897,9 @@ class AC3DImport:
map2=Texture.MapTo.COL
basetex2.image = img2
bl_textures[iname2] = basetex2
else:
map2=Texture.MapTo.COL
basetex2 = bl_textures[iname2]
m1.setTexture(1,basetex2,Texture.TexCo.UV,map2)