提交 66ad3492 编写于 作者: A alteredq

Added workaround to OBJ converter for unnamed materials.

上级 91450ee4
......@@ -368,8 +368,11 @@ def parse_mtl(fname):
# Material start
# newmtl identifier
if chunks[0] == "newmtl" and len(chunks) == 2:
identifier = chunks[1]
if chunks[0] == "newmtl":
if len(chunks) > 1:
identifier = chunks[1]
else:
identifier = ""
if not identifier in materials:
materials[identifier] = {}
......@@ -490,6 +493,7 @@ def parse_obj(fname):
faces = []
materials = {}
material = ""
mcounter = 0
mcurrent = 0
......@@ -536,7 +540,7 @@ def parse_obj(fname):
uv_index = []
normal_index = []
# Precompute vert / normal / uv lists
# for negative index lookup
vertlen = len(vertices) + 1
......@@ -581,8 +585,11 @@ def parse_obj(fname):
mtllib = chunks[1]
# Material
if chunks[0] == "usemtl" and len(chunks) == 2:
material = chunks[1]
if chunks[0] == "usemtl":
if len(chunks) > 1:
material = chunks[1]
else:
material = ""
if not material in materials:
mcurrent = mcounter
materials[material] = mcounter
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册