Page MenuHome

OBJ file import fails for objects with vertex groups defined when polygroups option is selected
Closed, ResolvedPublic


System Information
Operating system: MS Windows 8.1
Graphics card: Nvidia GTX 980M

Blender Version
Broken: 2.80, 1fa527bfa3a

Worked: 2.79, 5bd8ac9

Short description of error

Attempting to import an OBJ file will fail when the object in the file has vertex groups defined, the 'Keep Vertex Order' button is selected and the Polygroups option checkbox is checked in the import options. See attached image for full error message.
Exact steps for others to reproduce the error

  1. In default startup, create a cube and subdivide 4 times to give a 4x4 cube.
  2. Define two vertex groups and assign half the vertices to one vertex group and the remaining vertices to the other.
  3. Export the cube to OBJ file, checking Keep Vertex Order and Polygroups options.
  4. Import the file exported at step 3, selecting Keep Vertex Order and Polygroups in the import options.
  5. The file is not imported and the error message appears.
  6. Attempt to import the file again, but deselect the Polygroups option, or do not select Keep Vertex Order and hence not Polygroups either. The import now succeeds.

The error can be circumvented by updating the file scripts/addons/io_scene_obj/ The penultimate line of the create_mesh function - on my system line 713 - reads:
group ='utf-8', "replace"))
Simply updating it to read:
group ='utf-8', "replace"))
This may of course not be a complete or indeed entirely correct solution.
seems to have solved the problem for me.