Skip to content
Snippets Groups Projects
Commit 36a8b39d authored by Philipp Oeser's avatar Philipp Oeser
Browse files

Fix T41871: F2 addon throws error if there is a material slot with no

material assigned to it

Reviewed By: sergey
parent 3d5cd195
No related branches found
No related tags found
No related merge requests found
...@@ -50,14 +50,15 @@ def get_uv_layer(ob, bm, mat_index): ...@@ -50,14 +50,15 @@ def get_uv_layer(ob, bm, mat_index):
uv = me.uv_textures.active.name uv = me.uv_textures.active.name
else: else:
mat = ob.material_slots[mat_index].material mat = ob.material_slots[mat_index].material
slot = mat.texture_slots[mat.active_texture_index] if mat is not None:
if slot and slot.uv_layer: slot = mat.texture_slots[mat.active_texture_index]
uv = slot.uv_layer if slot and slot.uv_layer:
else: uv = slot.uv_layer
for tex_slot in mat.texture_slots: else:
if tex_slot and tex_slot.uv_layer: for tex_slot in mat.texture_slots:
uv = tex_slot.uv_layer if tex_slot and tex_slot.uv_layer:
break uv = tex_slot.uv_layer
break
if uv: if uv:
uv_layer = bm.loops.layers.uv.get(uv) uv_layer = bm.loops.layers.uv.get(uv)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment