Skip to content

Commit

Permalink
Fix T41871: F2 addon throws error if there is a material slot with no
Browse files Browse the repository at this point in the history
material assigned to it

Reviewed By: sergey
  • Loading branch information
lichtwerk committed Oct 7, 2014
1 parent 3d5cd19 commit 36a8b39
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions mesh_f2.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,15 @@ def get_uv_layer(ob, bm, mat_index):
uv = me.uv_textures.active.name
else:
mat = ob.material_slots[mat_index].material
slot = mat.texture_slots[mat.active_texture_index]
if slot and slot.uv_layer:
uv = slot.uv_layer
else:
for tex_slot in mat.texture_slots:
if tex_slot and tex_slot.uv_layer:
uv = tex_slot.uv_layer
break
if mat is not None:
slot = mat.texture_slots[mat.active_texture_index]
if slot and slot.uv_layer:
uv = slot.uv_layer
else:
for tex_slot in mat.texture_slots:
if tex_slot and tex_slot.uv_layer:
uv = tex_slot.uv_layer
break
if uv:
uv_layer = bm.loops.layers.uv.get(uv)

Expand Down

0 comments on commit 36a8b39

Please sign in to comment.