xuzhusheng / gltf-to-3d-tiles

Convert glTF model to Glb, b3dm and 3D tiles format.
MIT License
123 stars 35 forks source link

Default to First Scene if None #9

Closed dagrooms52 closed 1 year ago

dagrooms52 commented 1 year ago

I generated a .gltf file using another tool. When processing it with gltf-to-3d-tiles, I found that self.scene = None in Slicer.__init__().

This is easily fixed by setting self.scene = 0 to make the tool resilient, though it is probably an error in the previous tool that I used that caused no scene to be set in that resulting data.

A high-level error message could be preferable to this:

File "...\gltf-to-3d-tiles\gltf\slicer.py", line 24, in __init__
    root = self.scenes[self.scene].nodes[0]
TypeError: list indices must be integers or slices, not **NoneType**
dagrooms52 commented 1 year ago

There is precedent for defaulting to the first scene in the glTF spec: https://github.com/KhronosGroup/glTF/issues/815

xuzhusheng commented 1 year ago

fixed in commit 218172d11c54d63be2cc06f7753fafbe397f6226