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:
authorCampbell Barton <ideasman42@gmail.com>2012-11-05 09:59:33 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-11-05 09:59:33 +0400
commit55fc6729992e56a37035aee1c8506f073ac0e3b9 (patch)
tree021f9e26163ef301c3a32e900e0cbc98d2ebcf68
parentbbad0a24d9361dcd2cfd37b68426f87b3921ccb8 (diff)
fix [#33086] Empty vertex group causes list index out of range error on export OBJ
-rw-r--r--io_scene_obj/export_obj.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/io_scene_obj/export_obj.py b/io_scene_obj/export_obj.py
index c5fe57af..a5b00e8e 100644
--- a/io_scene_obj/export_obj.py
+++ b/io_scene_obj/export_obj.py
@@ -457,12 +457,12 @@ def write_file(filepath, objects, scene,
if EXPORT_POLYGROUPS:
# Retrieve the list of vertex groups
vertGroupNames = ob.vertex_groups.keys()
-
- currentVGroup = ''
- # Create a dictionary keyed by face id and listing, for each vertex, the vertex groups it belongs to
- vgroupsMap = [[] for _i in range(len(me_verts))]
- for v_idx, v_ls in enumerate(vgroupsMap):
- v_ls[:] = [(vertGroupNames[g.group], g.weight) for g in me_verts[v_idx].groups]
+ if vertGroupNames:
+ currentVGroup = ''
+ # Create a dictionary keyed by face id and listing, for each vertex, the vertex groups it belongs to
+ vgroupsMap = [[] for _i in range(len(me_verts))]
+ for v_idx, v_ls in enumerate(vgroupsMap):
+ v_ls[:] = [(vertGroupNames[g.group], g.weight) for g in me_verts[v_idx].groups]
for f, f_index in face_index_pairs:
f_smooth = f.use_smooth
@@ -480,7 +480,7 @@ def write_file(filepath, objects, scene,
# Write the vertex group
if EXPORT_POLYGROUPS:
- if ob.vertex_groups:
+ if vertGroupNames:
# find what vertext group the face belongs to
vgroup_of_face = findVertexGroupName(f, vgroupsMap)
if vgroup_of_face != currentVGroup: