bugfix: allow "newmtl" directive; handle missing texture/normal indices
This commit is contained in:
parent
b90283942c
commit
b1872c089e
3
wfobj.py
3
wfobj.py
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user