Fix T41871: F2 addon throws error if there is a material slot with no
material assigned to it Reviewed By: sergey
This commit is contained in:
parent
3d5cd1956e
commit
36a8b39da3
Notes:
blender-bot
2023-02-14 20:03:09 +01:00
Referenced by issue #41871, F2 addon crash
17
mesh_f2.py
17
mesh_f2.py
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue