IndexError: list index out of range while importing wrl file #51334

Closed
opened 2017-04-27 14:23:37 +02:00 by Fabrizio Pelosi · 20 comments

System Information
Windows 10 and Windows 7 (Intel GPU)

Blender Version
Broken: 2.78c

Short description of error
Addon: Import VRML/X3D
IndexError: list index out of range while importing wrl file

Exact steps for others to reproduce the error
Traceback (most recent call last):

File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\io_scene_x3d\__init__.py", line 81, in execute
  return import_x3d.load(context, **keywords)
File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\io_scene_x3d\import_x3d.py", line 3601, in load
  global_matrix=global_matrix,
File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\io_scene_x3d\import_x3d.py", line 3498, in load_web3d
  importShape(bpyscene, node, ancestry, global_matrix)
File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\io_scene_x3d\import_x3d.py", line 3122, in importShape
  bpydata = geom_fn(geom, ancestry, bpyima)
File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\io_scene_x3d\import_x3d.py", line 1982, in importMesh_IndexedFaceSet
  cco = [cco for (i, f) in enumerate(faces) for j in f
File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\io_scene_x3d\import_x3d.py", line 1983, in <listcomp>
  for cco in rgb[i]]

IndexError: list index out of range

location: :-1

With MeshLab 2016.12 I can open the file.

unita65_XXX.wrl

**System Information** Windows 10 and Windows 7 (Intel GPU) **Blender Version** Broken: 2.78c **Short description of error** Addon: Import VRML/X3D IndexError: list index out of range while importing wrl file **Exact steps for others to reproduce the error** Traceback (most recent call last): ``` File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\io_scene_x3d\__init__.py", line 81, in execute return import_x3d.load(context, **keywords) File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\io_scene_x3d\import_x3d.py", line 3601, in load global_matrix=global_matrix, File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\io_scene_x3d\import_x3d.py", line 3498, in load_web3d importShape(bpyscene, node, ancestry, global_matrix) File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\io_scene_x3d\import_x3d.py", line 3122, in importShape bpydata = geom_fn(geom, ancestry, bpyima) File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\io_scene_x3d\import_x3d.py", line 1982, in importMesh_IndexedFaceSet cco = [cco for (i, f) in enumerate(faces) for j in f File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\io_scene_x3d\import_x3d.py", line 1983, in <listcomp> for cco in rgb[i]] ``` IndexError: list index out of range location: <unknown location>:-1 With MeshLab 2016.12 I can open the file. [unita65_XXX.wrl](https://archive.blender.org/developer/F574589/unita65_XXX.wrl)

Changed status to: 'Open'

Changed status to: 'Open'

Added subscriber: @FabrizioPelosi

Added subscriber: @FabrizioPelosi

Added subscribers: @mont29, @ideasman42, @Sergey

Added subscribers: @mont29, @ideasman42, @Sergey
Campbell Barton was assigned by Sergey Sharybin 2017-05-22 15:51:39 +02:00

@ideasman42, guess this one is again for you? Or maybe @mont29? :)

@ideasman42, guess this one is again for you? Or maybe @mont29? :)
Member

Added subscriber: @BrendonMurphy

Added subscriber: @BrendonMurphy
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Member

no activity 2017, closing as archived

no activity 2017, closing as archived

Added subscriber: @davidbgh

Added subscriber: @davidbgh

[exported from SolidWorks 2013] [VRML 97] [Blender 2.83.2]
This happens for me, if the .wrl contains only one object/part. (if the solidworks assembly contains only one part then it fails, but succeed when contains two)

[exported from SolidWorks 2013] [VRML 97] [Blender 2.83.2] This happens for me, if the .wrl contains only one object/part. (if the solidworks assembly contains only one part then it fails, but succeed when contains two)

Added subscriber: @ilya.methot.3ds

Added subscriber: @ilya.methot.3ds

I have this exact same problem and it has made it impossible to import any of my VRML files

I have this exact same problem and it has made it impossible to import any of my VRML files

Changed status from 'Archived' to: 'Needs Triage'

Changed status from 'Archived' to: 'Needs Triage'

Re-opening, because lack of activity was from the developer team.

We should not ship addon which can not handle simple files import. We should either fix the code, or remove support of legacy files which are not supported due to issues in the code anyway.

@BrendonMurphy, Could you please help evaluating the state of this addon?

Re-opening, because lack of activity was from the developer team. We should not ship addon which can not handle simple files import. We should either fix the code, or remove support of legacy files which are not supported due to issues in the code anyway. @BrendonMurphy, Could you please help evaluating the state of this addon?

Added subscriber: @rjg

Added subscriber: @rjg

The issue appears to be that there is only a single color defined while there are a number of faces. Trying to enumerate the faces and using the index of the face to access a color is therefore expected to fail. While I have only taken a quick look at the the X3D and VRML specification, I think the file is potentially invalid.

The issue appears to be that there is only a single color defined while there are a number of faces. Trying to enumerate the faces and using the index of the face to access a color is therefore expected to fail. While I have only taken a quick look at the the X3D and VRML specification, I think the file is potentially invalid.

Changed status from 'Needs Triage' to: 'Archived'

Changed status from 'Needs Triage' to: 'Archived'

Based on the following section of the specification about the IndexedFaceSet the file is invalid:

If colorPerVertex is FALSE, colors are applied to each face, as follows:

  • If the colorIndex field is not empty, then they are used to choose one color for each face of the IndexedFaceSet. There must be at least as many indices in the colorIndex field as there are faces in the IndexedFaceSet. If the greatest index in the colorIndex field is N, then there must be N+1 colors in the Color node. The colorIndex field must not contain any negative entries.
  • If the colorIndex field is empty, then the colors are applied to each face of the IndexedFaceSet in order. There must be at least as many colors in the Color node as there are faces.

The file contains an IndexedFaceSet , the colorPerVertex is set to FALSE, yet there is only one color defined:

geometry IndexedFaceSet {
color Color {
color [
 0.792157 0.819608 0.933333
]
}
Based on the following [section ](http://www.graphics.stanford.edu/courses/cs248-98-fall/Assignments/Assignment3/VRML2_Specification/spec/part1/nodesRef.html#IndexedFaceSet) of the specification about the `IndexedFaceSet` the file is invalid: > If colorPerVertex is FALSE, colors are applied to each face, as follows: > - If the colorIndex field is not empty, then they are used to choose one color for each face of the IndexedFaceSet. There must be at least as many indices in the colorIndex field as there are faces in the IndexedFaceSet. If the greatest index in the colorIndex field is N, then there must be N+1 colors in the Color node. The colorIndex field must not contain any negative entries. > - **If the colorIndex field is empty, then the colors are applied to each face of the IndexedFaceSet in order. There must be at least as many colors in the Color node as there are faces.** The file contains an `IndexedFaceSet `, the `colorPerVertex` is set to `FALSE`, yet there is only one color defined: ``` geometry IndexedFaceSet { color Color { color [ 0.792157 0.819608 0.933333 ] } ```

For the record, PR #1 will fix the issue and load this invalid file.

For the record, PR #1 will fix the issue and load this invalid file.

@Hombre57 What exact PR you're referring to? The current link to it appears to be broken.

@Hombre57 What exact PR you're referring to? The current link to it appears to be broken.

Hi @Sergey, I finally find out how to make a proper link to a subproject PR : extensions/io_scene_x3d#1 Sorry for the inconvenience.

Hi @Sergey, I finally find out how to make a proper link to a subproject PR : extensions/io_scene_x3d#1 Sorry for the inconvenience.
Sign in to join this conversation.
No Milestone
No project
No Assignees
7 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#51334
No description provided.