Obj import will error if texture coordinates do not have 2 values #68249

Closed
opened 2019-08-05 08:46:40 +02:00 by Jcw87 · 5 comments

System Information
Operating system: Windows 10 version 1803
Graphics card: NVIDIA GeForce GTX1060 3GB

Blender Version
Broken: version: 2.80 (sub 75), branch: master, commit date: 2019-07-29 14:47, hash: f6cb5f54494e
Worked:

According to the OBJ spec, a texture coordinate is defined by the following:

vt u v w

It also says that v and w are optional, and have a default value of 0.

064c9f30c1/Specs/obj_spec.txt (L330-L348)

I've encountered an OBJ export library that will omit v and w if they are 0. When attempting to import files created by this exporter into blender, the importer throws a python error.

Traceback (most recent call last):

File "C:\Program Files\Blender Foundation\Blender\2.80\scripts\addons\io_scene_obj\__init__.py", line 145, in execute
  return import_obj.load(context, **keywords)
File "C:\Program Files\Blender Foundation\Blender\2.80\scripts\addons\io_scene_obj\import_obj.py", line 1243, in load
  dataname,
File "C:\Program Files\Blender Foundation\Blender\2.80\scripts\addons\io_scene_obj\import_obj.py", line 709, in create_mesh
  me.uv_layers[0].data.foreach_set("uv", loops_uv)

RuntimeError: internal error setting the array

Personally, I don't like that this library will omit the second coordinate, but I can't fault the developer for creating a file that technically follows the spec.

Exact steps for others to reproduce the error

  1. Open blender with the general startup file.
  2. Use the obj importer to import attached file
    cube.obj

I cheated a little bit with this file, as I actually exported it from blender, then changed it to match what the other exporter does. It throws the same error.

**System Information** Operating system: Windows 10 version 1803 Graphics card: NVIDIA GeForce GTX1060 3GB **Blender Version** Broken: version: 2.80 (sub 75), branch: master, commit date: 2019-07-29 14:47, hash: f6cb5f54494e Worked: According to the OBJ spec, a texture coordinate is defined by the following: vt u v w It also says that v and w are optional, and have a default value of 0. https://github.com/JeremyAnsel/JeremyAnsel.Media.WavefrontObj/blob/064c9f30c1e013df6d6b5946fd148f63cf974124/Specs/obj_spec.txt#L330-L348 I've encountered an OBJ export library that will omit v and w if they are 0. When attempting to import files created by this exporter into blender, the importer throws a python error. Traceback (most recent call last): ``` File "C:\Program Files\Blender Foundation\Blender\2.80\scripts\addons\io_scene_obj\__init__.py", line 145, in execute return import_obj.load(context, **keywords) File "C:\Program Files\Blender Foundation\Blender\2.80\scripts\addons\io_scene_obj\import_obj.py", line 1243, in load dataname, File "C:\Program Files\Blender Foundation\Blender\2.80\scripts\addons\io_scene_obj\import_obj.py", line 709, in create_mesh me.uv_layers[0].data.foreach_set("uv", loops_uv) ``` RuntimeError: internal error setting the array Personally, I don't like that this library will omit the second coordinate, but I can't fault the developer for creating a file that technically follows the spec. **Exact steps for others to reproduce the error** 1. Open blender with the general startup file. 2. Use the obj importer to import attached file [cube.obj](https://archive.blender.org/developer/F7649789/cube.obj) I cheated a little bit with this file, as I actually exported it from blender, then changed it to match what the other exporter does. It throws the same error.
Author

Added subscriber: @Jcw87

Added subscriber: @Jcw87
Jcw87 changed title from Obj import will error if vertex coordinates do not have 2 values to Obj import will error if texture coordinates do not have 2 values 2019-08-05 09:11:06 +02:00
Member

Added subscribers: @mont29, @lichtwerk

Added subscribers: @mont29, @lichtwerk
Bastien Montagne was assigned by Philipp Oeser 2019-08-05 09:52:08 +02:00
Member

Confirmed, should be supported I guess...
@mont29: mind checking?

Confirmed, should be supported I guess... @mont29: mind checking?

This issue was referenced by 19166e3172

This issue was referenced by 19166e3172c39a7231bdb885543c9665bbf254cc

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#68249
No description provided.