Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Oeser <info@graphics-engineer.com>2014-10-07 14:53:49 +0400
committerPhilipp Oeser <info@graphics-engineer.com>2014-10-07 14:53:49 +0400
commit36a8b39da392fa06f59af2cea29fe0ee36fc24f4 (patch)
treea749dce9ac65c572e7e288f4c70cc4531ca31e41 /mesh_f2.py
parent3d5cd1956ef4cc323037d103ca74d10a97ebef78 (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.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/mesh_f2.py b/mesh_f2.py
index 61786d10..4f85f3a0 100644
--- a/mesh_f2.py
+++ b/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)