提交 f7bf54ac 编写于 作者: B Ben Houston

support exports even when some materials are not valid.

上级 412044d2
......@@ -342,9 +342,11 @@ def faces(mesh, options, material_list=None):
face_data.append(mat_index)
break
else:
error = ("Could not map the material index "
"for face %d" % face.index)
raise exceptions.MaterialError(error)
face_data.append(0) # default to index zero if there's a bad material
#################################
# IMPORTANT:
# this fix is to foolproof the export, might not be necessary to send it to THREE.js
#################################
if uv_indices:
for index, uv_layer in enumerate(uv_indices):
......@@ -525,6 +527,9 @@ def materials(mesh, options):
logger.info("Vertex colours set to %s", use_colors)
for mat, index in material_sets:
if mat == None: # undefined material for a specific index is skipped
continue
try:
dbg_color = constants.DBG_COLORS[index]
except IndexError:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册