Description
When exporting from Blender to ZBrush, the export fails with an IndexError if an object's mesh-level vertex group data (me.vertices[vert].groups) references a group index that is out of range of obj.vertex_groups.
Error
File "GoB.py / gob_export.py", line ~1092, in exportGoZ
if vg.weight >= prefs().export_weight_threshold and obj.vertex_groups[vg.group].name.lower() != 'mask':
IndexError: bpy_prop_collection[index]: index 0 out of range, size 0
Affected versions
Confirmed in GoB-4_0_2 and GoB-4_2_3 (latest). In v4_2_3 this is in gob_export.py line 401.
Fix
Add a bounds check before the index access:
# Before
if vg.weight >= prefs().export_weight_threshold and obj.vertex_groups[vg.group].name.lower() != 'mask':
# After
if vg.weight >= prefs().export_weight_threshold and vg.group < len(obj.vertex_groups) and obj.vertex_groups[vg.group].name.lower() != 'mask':
This short-circuits safely when vg.group is out of range of the object's vertex groups collection.
Description
When exporting from Blender to ZBrush, the export fails with an
IndexErrorif an object's mesh-level vertex group data (me.vertices[vert].groups) references a group index that is out of range ofobj.vertex_groups.Error
Affected versions
Confirmed in
GoB-4_0_2andGoB-4_2_3(latest). In v4_2_3 this is ingob_export.pyline 401.Fix
Add a bounds check before the index access:
This short-circuits safely when
vg.groupis out of range of the object's vertex groups collection.