X3D/VRML2 Import failing on files that have Shape nodes with missing coord/coordIndex sections #87766

Open
opened 2021-04-24 00:12:55 +02:00 by Johannes Rauch · 2 comments

System Information
Operating system: Fedora WS 33
Graphics card: Nvidia Geforce GTX 1080 Ti, Nvidia Geforce GTX 980 Ti

Blender Version
Broken: 2.92 and earlier

Short description of error
X3D/VRML2 import fails on the supplied file (plate.wrl). Other VRML viewers/importers handle the file just fine.
The VRML2 file contains a few Shape nodes with geometry IndexedFaceSet blocks that are missing a coord and coordIndex Section (beginning at line 1062) . This leads to a failure on import as the importer expects the geometry block to have a coord section.

line 1893 in the importMesh_IndexedFaceSet function in import_x3d.py

coord = geom.getChildBySpec('Coordinate')

assumes it always gets a valid spec but getChildBySpec can return NoneType. So there need to be checks in place and it needs to be handled up the chain.

I have created a pull request on the github.com mirror of the blender addons that adds these checks and ignores the empty Shape nodes for now: https://github.com/blender/blender-addons/pull/7

Error itself:

Python: Traceback (most recent call last):
  File "/home/someuser/.local/blender-2.91.0-linux64/2.91/scripts/addons/io_scene_x3d/__init__.py", line 78, in execute
    return import_x3d.load(context, **keywords)
  File "/home/someuser/.local/blender-2.91.0-linux64/2.91/scripts/addons/io_scene_x3d/import_x3d.py", line 3639, in load
    global_matrix=global_matrix,
  File "/home/someuser/.local/blender-2.91.0-linux64/2.91/scripts/addons/io_scene_x3d/import_x3d.py", line 3535, in load_web3d
    importShape(bpycollection, node, ancestry, global_matrix)
  File "/home/someuser/.local/blender-2.91.0-linux64/2.91/scripts/addons/io_scene_x3d/import_x3d.py", line 3154, in importShape
    bpydata = geom_fn(geom, ancestry)
  File "/home/someuser/.local/blender-2.91.0-linux64/2.91/scripts/addons/io_scene_x3d/import_x3d.py", line 1894, in importMesh_IndexedFaceSet
    if coord.reference:
AttributeError: 'NoneType' object has no attribute 'reference'

Exact steps for others to reproduce the error
File >> Import >> X3D Extensible 3D (.x3d/.wrl)
Select supplied file (plate.wrl) >> Import X3d/VRML2

plate.wrl

**System Information** Operating system: Fedora WS 33 Graphics card: Nvidia Geforce GTX 1080 Ti, Nvidia Geforce GTX 980 Ti **Blender Version** Broken: 2.92 and earlier **Short description of error** X3D/VRML2 import fails on the supplied file (plate.wrl). Other VRML viewers/importers handle the file just fine. The VRML2 file contains a few Shape nodes with geometry IndexedFaceSet blocks that are missing a coord and coordIndex Section (beginning at line 1062) . This leads to a failure on import as the importer expects the geometry block to have a coord section. line 1893 in the importMesh_IndexedFaceSet function in import_x3d.py ``` coord = geom.getChildBySpec('Coordinate') ``` assumes it always gets a valid spec but *getChildBySpec* can return *NoneType*. So there need to be checks in place and it needs to be handled up the chain. I have created a pull request on the github.com mirror of the blender addons that adds these checks and ignores the empty Shape nodes for now: https://github.com/blender/blender-addons/pull/7 Error itself: ``` Python: Traceback (most recent call last): File "/home/someuser/.local/blender-2.91.0-linux64/2.91/scripts/addons/io_scene_x3d/__init__.py", line 78, in execute return import_x3d.load(context, **keywords) File "/home/someuser/.local/blender-2.91.0-linux64/2.91/scripts/addons/io_scene_x3d/import_x3d.py", line 3639, in load global_matrix=global_matrix, File "/home/someuser/.local/blender-2.91.0-linux64/2.91/scripts/addons/io_scene_x3d/import_x3d.py", line 3535, in load_web3d importShape(bpycollection, node, ancestry, global_matrix) File "/home/someuser/.local/blender-2.91.0-linux64/2.91/scripts/addons/io_scene_x3d/import_x3d.py", line 3154, in importShape bpydata = geom_fn(geom, ancestry) File "/home/someuser/.local/blender-2.91.0-linux64/2.91/scripts/addons/io_scene_x3d/import_x3d.py", line 1894, in importMesh_IndexedFaceSet if coord.reference: AttributeError: 'NoneType' object has no attribute 'reference' ``` **Exact steps for others to reproduce the error** File >> Import >> X3D Extensible 3D (.x3d/.wrl) Select supplied file (plate.wrl) >> Import X3d/VRML2 [plate.wrl](https://archive.blender.org/developer/F10034656/plate.wrl)
Author

Added subscriber: @Nidus

Added subscriber: @Nidus
Member

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

Changed status from 'Needs Triage' to: 'Confirmed'
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 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#87766
No description provided.