Page MenuHome

Errors on OBJ import
Closed, ResolvedPublic

Description

System Information
Operating system: Windows 10 Pro 64Bit
Graphics card: Intel HD Graphics 530

Blender Version
Broken: 2.80, January 08, 01:07:30 - 91a155833e59
Worked: 2.79b

Short description of error
When I try to import my OBJ model, I get these errors in console:

(  0.0000 sec |   0.0000 sec) Importing OBJ 'C:\\cygwin64\\home\\user\\RendererAPI\\files\\renders\\render_794\\project.obj'...
  (  0.0010 sec |   0.0010 sec) Parsing OBJ file...
    (  1.3310 sec |   1.3301 sec) Done, loading materials and images...
WARNING, currently unsupported 'tr' translucency option, skipped.


Traceback (most recent call last):
  File "C:\Users\user\Desktop\blender-2.80.0-git.91a155833e59-windows64\2.80\scripts\addons\io_scene_obj\__init__.py", line 145, in execute
    return import_obj.load(context, **keywords)
  File "C:\Users\user\Desktop\blender-2.80.0-git.91a155833e59-windows64\2.80\scripts\addons\io_scene_obj\import_obj.py", line 1173, in load
    use_image_search, float_func)
  File "C:\Users\user\Desktop\blender-2.80.0-git.91a155833e59-windows64\2.80\scripts\addons\io_scene_obj\import_obj.py", line 397, in create_materials
    context_material_name, img_data, line, 'Kd')
  File "C:\Users\user\Desktop\blender-2.80.0-git.91a155833e59-windows64\2.80\scripts\addons\io_scene_obj\import_obj.py", line 139, in load_material_image
    _generic_tex_set(mat_wrap.base_color_texture, image, 'UV', map_offset, map_scale)
  File "C:\Users\user\Desktop\blender-2.80.0-git.91a155833e59-windows64\2.80\scripts\addons\io_scene_obj\import_obj.py", line 135, in _generic_tex_set
    nodetex.scale = scale
  File "C:\Users\user\Desktop\blender-2.80.0-git.91a155833e59-windows64\2.80\scripts\modules\bpy_extras\node_shader_utils.py", line 37, in wrapper
    return func(self, *args, **kwargs)
  File "C:\Users\user\Desktop\blender-2.80.0-git.91a155833e59-windows64\2.80\scripts\modules\bpy_extras\node_shader_utils.py", line 733, in scale_set
    self.node_mapping.scale = scale
TypeError: bpy_struct: item.attr = val: expected sequence items of type float, not bytes

location: <unknown location>:-1

location: <unknown location>:-1

I removed all "Tr" parameters from corresponding MTL file, but it didn't help much:

(  0.0000 sec |   0.0000 sec) Importing OBJ 'D:\\Render_Test\\project.obj'...
  (  0.0020 sec |   0.0020 sec) Parsing OBJ file...
    (  1.3280 sec |   1.3260 sec) Done, loading materials and images...
    (  1.3310 sec |   1.3290 sec) Done, building geometries (verts:98496 faces:32564 materials: 7 smoothgroups:0) ...
Error: Array length mismatch (expected 63072, got 63000)


Traceback (most recent call last):
  File "C:\Users\user\Desktop\blender-2.80.0-git.91a155833e59-windows64\2.80\scripts\addons\io_scene_obj\__init__.py", line 145, in execute
    return import_obj.load(context, **keywords)
  File "C:\Users\user\Desktop\blender-2.80.0-git.91a155833e59-windows64\2.80\scripts\addons\io_scene_obj\import_obj.py", line 1201, in load
    dataname,
  File "C:\Users\user\Desktop\blender-2.80.0-git.91a155833e59-windows64\2.80\scripts\addons\io_scene_obj\import_obj.py", line 674, in create_mesh
    me.uv_layers[0].data.foreach_set("uv", loops_uv)
RuntimeError: internal error setting the array

location: <unknown location>:-1

location: <unknown location>:-1

Exact steps for others to reproduce the error

  1. Download an attached model
  2. Open Blender 2.8
  3. Try to import the model as Wavefront (OBJ)

Details

Type
Bug

Event Timeline

Philipp Oeser (lichtwerk) triaged this task as Confirmed, Medium priority.Jan 10 2019, 9:43 AM

Regarding the translucency error: could you share the MTL without 'Tr' being removed?
[easier to repro and fix the first issue]

Can confirm the UV mismatch.
@Bastien Montagne (mont29) might know right away? (feel free to throw back at me and I will investigate more...)
[This might not be a bug but a broken OBJ though... where has this been exported from?]

note: this is coming in without errors in 2.79...

UV error comes from the fact that this .obj has two objects named the same ('_1'), I think… will check and fix that (2.79 seems to always fully merge those into a single mesh, while it looks like 2.8 does an hybrid work which generates that mismatch in UV numbers).

original report, the warning itself is nothing wrong, just some unsupported feature. the actual error I'll need unmodified MTL again to investigate.

Bastien Montagne (mont29) lowered the priority of this task from Confirmed, Medium to Needs Information from User.Jan 10 2019, 3:30 PM

UV part is fixed, marking as incomplete until we get original MTL to investigate material issue.

Here's a pure MTL file (as exported from a three.js app):

It seems that missing textures break the import. When I remove all Kd lines, the importer works fine. In 2.79b it wasn't a road-block.

Bastien Montagne (mont29) raised the priority of this task from Needs Information from User to Confirmed, Medium.

fixed in rBA5509187b4dc, thanks.