Issue with pyggel.mesh.OBJ and texcoords

12 views
Skip to first unread message

Chad

unread,
Sep 2, 2009, 5:11:52 PM9/2/09
to PYGGEL-dev
Hey all,

I just downloaded pyggel and was receiving errors trying to load
an .obj file. I would get the following error:

File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/pyggel/mesh.py", line 78, in OBJ
fin.append(i.compile(vertices, normals, texcoords))
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/pyggel/mesh.py", line 107, in compile
ut.append(texcoords[t[i]-1])
IndexError: list index out of range

It looks like 'texcoords' was being used for the face definitions
locally and this was clobbering the version higher up that is meant to
hold the texture coordinates for the entire file. I'm not sure that
makes sense...

Here is a snippet that will fix the issue (~line 54 in mesh.py):

elif values[0] == 'f':
face = []
tcoords = []
norms = []
for v in values[1:]:
w = v.split('/')
face.append(int(w[0]))
if len(w) >= 2 and len(w[1]) > 0:
tcoords.append(int(w[1]))
else:
tcoords.append(0)
if len(w) >= 3 and len(w[2]) > 0:
norms.append(int(w[2]))
else:
norms.append(0)
objs[-1].faces.append((face, norms, tcoords))

Basically, replace 'texcoords' with something else in that elif
clause.

I can provide more detail if you'd like, I just thought I'd mention
this in case no one else had caught it.

Chad

RB[0]

unread,
Sep 2, 2009, 5:15:00 PM9/2/09
to pygge...@googlegroups.com
Well, I've found it on almost every one of my meshes in my pyweek entry :(
Unforunately I hadn't gotten a chance to track down the bug as yet - thank you for doing so :)
Reply all
Reply to author
Forward
0 new messages