diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2014-10-07 14:53:49 +0400 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2014-10-07 14:53:49 +0400 |
commit | 36a8b39da392fa06f59af2cea29fe0ee36fc24f4 (patch) | |
tree | a749dce9ac65c572e7e288f4c70cc4531ca31e41 /mesh_f2.py | |
parent | 3d5cd1956ef4cc323037d103ca74d10a97ebef78 (diff) |
Fix T41871: F2 addon throws error if there is a material slot with no
material assigned to it
Reviewed By: sergey
Diffstat (limited to 'mesh_f2.py')
-rw-r--r-- | mesh_f2.py | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -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) |