add checks for NoneType to ignore empty shape nodes #3

Merged
Cedric Steiert merged 2 commits from Bujus_Krachus/io_scene_x3d:add-none-check-for-empty-nodes into main 2024-08-06 17:22:23 +02:00

View File

@ -1878,6 +1878,10 @@ def importMesh_IndexedFaceSet(geom, ancestry):
ccw = geom.getFieldAsBool('ccw', True, ancestry)
coord = geom.getChildBySpec('Coordinate')
if coord is None:
return None
if coord.reference:
points = coord.getRealNode().parsed
# We need unflattened coord array here, while
@ -3163,6 +3167,10 @@ def importShape(bpycollection, node, ancestry, global_matrix):
if geom_fn is not None:
bpydata = geom_fn(geom, ancestry)
if bpydata is None:
print('ImportX3D warning: empty shape, skipping node "%s"' % vrmlname)
return
# There are no geometry importers that can legally return
# no object. It's either a bpy object, or an exception
importShape_ProcessObject(