Skip to content

Commit

Permalink
added check to see if vertex colors is empty, before trying to use them.
Browse files Browse the repository at this point in the history
  • Loading branch information
pokepetter committed Mar 5, 2024
1 parent 743012b commit a84e193
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ursina/mesh_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,22 +285,22 @@ def obj_to_ursinamesh(path=application.compressed_models_folder, outpath=applica
tris.extend(tri)
if current_color:
vertex_colors.extend([current_color for i in range(3)])
else:
elif vertex_colors_packed:
vertex_colors.extend([vertex_colors_packed[idx] for idx in tri])

elif len(tri) == 4:
tris.extend((tri[0], tri[1], tri[2], tri[2], tri[3], tri[0]))
if current_color:
vertex_colors.extend([current_color for i in range(6)])
else:
elif vertex_colors_packed:
vertex_colors.extend([vertex_colors_packed[idx] for idx in (tri[0], tri[1], tri[2], tri[2], tri[3], tri[0])])

else: # ngon
for i in range(1, len(tri)-1):
tris.extend((tri[i], tri[i+1], tri[0]))
if current_color:
vertex_colors.extend([current_color for i in range(len(tri))])
else:
elif vertex_colors_packed:
for i in range(1, len(tri)-1):
vertex_colors.extend([vertex_colors_packed[idx] for idx in (tri[i], tri[i+1], tri[0])])

Expand Down

0 comments on commit a84e193

Please sign in to comment.