bugfix: allow "newmtl" directive; handle missing texture/normal indices

This commit is contained in:
Josh Holtrop 2012-07-15 18:59:28 -04:00
parent b90283942c
commit b1872c089e

View File

@ -29,7 +29,7 @@ class WFObj(object):
def add_face(*vrefs):
def split_vref(vref):
parts = map(int, vref.split('/'))
parts = map(lambda x: 0 if x == '' else int(x), vref.split('/'))
while len(parts) < 3:
parts.append(0)
return parts
@ -133,6 +133,7 @@ class WFObj(object):
material = self.Material()
material_name = parts[1]
self.materials[material_name] = material
continue
else:
if material is None:
raise ValueError('Material directive preceeding "newmtl" on line %d' % lineno)