Skip to content

Commit

Permalink
Fix writing to OBJ file with no material. (Half of #2)
Browse files Browse the repository at this point in the history
  • Loading branch information
jterrace committed Jul 10, 2014
1 parent c4ae78c commit b52501d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions meshtool/filters/save_filters/save_obj_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ def write_obj(mesh, mtlfilename, f):
f.write("\n")

# Start using the right material
f.write("usemtl %s\n" % boundprim.material.id)
if boundprim.material:
f.write("usemtl %s\n" % boundprim.material.id)

if emit_normals and emit_texcoords:
format_string = "f %d/%d/%d %d/%d/%d %d/%d/%d"
Expand All @@ -131,4 +132,4 @@ def write_obj(mesh, mtlfilename, f):
tc_offset += boundprim.texcoordset[0].shape[0]

f.write("\n")


0 comments on commit b52501d

Please sign in to comment.