Page MenuHome

Can not import .obj or .fbx generated from Marvelous Designer
Closed, ResolvedPublic

Description

System Information
windows 10 , gtx 1060

Blender Version
Broken: 2.79 42a5624

Short description of error
as title,
here is the error information

Traceback (most recent call last):
  File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_fbx\__init__.py", line 234, in execute
    return import_fbx.load(self, context, **keywords)
  File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_fbx\import_fbx.py", line 2463, in load
    _(); del _
  File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_fbx\import_fbx.py", line 2462, in _
    fbx_item[1] = blen_read_geom(fbx_tmpl, fbx_obj, settings)
  File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_fbx\import_fbx.py", line 1131, in blen_read_geom
    elem_name_utf8 = elem_name_ensure_class(fbx_obj, b'Geometry')
  File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_fbx\import_fbx.py", line 127, in elem_name_ensure_class
    return elem_name.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xba in position 6: invalid start byte

location: <unknown location>:-1

importing .obj file gives similar error.
Exact steps for others to reproduce the error
Based on a (as simple as possible) attached .blend file with minimum amount of steps

Event Timeline

Could you add obj file instead of fbx?

As a temporary workaround you can change line 127 and forward in import_fbx.py (see the path of the error) to this:

try:
    return elem_name.decode('utf-8')
except UnicodeDecodeError:
    return str(elem_name)  # utf-8 couldn't be decoded, export garbled name instead of failing

this is the .obj file

OBJ importer works for me though (it is using above method - using a replacement character - already btw...)

Regarding OBJ file, I guess we have no issues here because we do not have the MTL file associated with it (its path is the only textual info in an OBJ file I think…).

FBX is another topic, as stated by the official doc, FBX uses utf8 unicode encoding internally. This means that that FBX file is seriously broken imho. Will add the 'replace' option from D3012, won't hurt probably, but this should absolutely not be needed. At all. Suggest you report the issue to Marvelous Designer team (and as a side question, does this FBX file loads OK in e.g. Maya or 3DSMax?).

I dont have maya or 3ds max. this fbx is ok with windows 3d painter and daz studio. I tried to open in daz and save again to work around but it introduced some daz studio things not needed. I suspect that the reason it cannot be opened in blender is that I put chinese character in file name when I saved it in marvelous designer. Marvelous Designer uses fbx sdk, it should be ok with maya and 3ds max in my opinion.

Then it means that FBX SDK does not even respect its own documentation (what a surprise…)

Anyway, fix is committed, Blender shall now be resilient to badly encoded strings.

Btw, Chinese characters are not an issue in themselves, here issue is that the strings are not encoded in valid utf8 as expected (no idea what's used instead, could be some Windows-specific Chinese encoding …).