[Bf-extensions-cvs] [36a8b39] master: Fix T41871: F2 addon throws error if there is a material slot with no material assigned to it
Philipp Oeser
noreply at git.blender.org
Tue Oct 7 12:57:59 CEST 2014
Commit: 36a8b39da392fa06f59af2cea29fe0ee36fc24f4
Author: Philipp Oeser
Date: Tue Oct 7 12:53:49 2014 +0200
Branches: master
https://developer.blender.org/rBA36a8b39da392fa06f59af2cea29fe0ee36fc24f4
Fix T41871: F2 addon throws error if there is a material slot with no
material assigned to it
Reviewed By: sergey
===================================================================
M mesh_f2.py
===================================================================
diff --git a/mesh_f2.py b/mesh_f2.py
index 61786d1..4f85f3a 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)
More information about the Bf-extensions-cvs
mailing list