Page MenuHome

Fix .X3D/.WRL importer crashing with empty IndexedFaceSets
ClosedPublic

Authored by Max Schlecht (Bobbe) on Mar 27 2022, 9:31 PM.

Details

Summary

When importing a .x3d file containing an empty IndexedFaceSet, like this for example:

Shape {
  geometry IndexedFaceSet {
    coord Coordinate {
      point [

      ]
    }
    coordIndex [

    ]
  }
}

import_x3d.py throws an exception, because x_min, x_max, ... are not initialized/still set to None.
This fixes the issue by initializing the mentioned variables to inf/-inf respectively and also further simplifies the code by utlizing the min and max builtins.

Diff Detail

Event Timeline

Max Schlecht (Bobbe) requested review of this revision.Mar 27 2022, 9:31 PM
Max Schlecht (Bobbe) created this revision.
Bastien Montagne (mont29) requested changes to this revision.Mar 28 2022, 9:00 AM

Thanks for the patch, looks good besides picky note below.

io_scene_x3d/import_x3d.py
2026–2027

would rather use math.inf (and -math.inf for negative one below).

This revision now requires changes to proceed.Mar 28 2022, 9:00 AM

Use math.inf instead of float("inf").

Thanks for the patch, looks good besides picky note below.

Yep, makes perfect sense. Thanks!

Max Schlecht (Bobbe) marked an inline comment as done.Mar 28 2022, 2:42 PM
This revision is now accepted and ready to land.Mar 29 2022, 9:55 AM