[SOLVED] Error importing GLTF from blender 2.91.0

So, I updated to blender 2.91.0.
I am running into issues importing gltf assets. I have tried both glb and gltf output formats.

com.jme3.asset.AssetLoadException: An error occurred loading Models/KB3D_NeoShanghai-Native_BldgSM_H.gltf
	at com.jme3.scene.plugins.gltf.GltfLoader.loadFromStream(GltfLoader.java:182)
	at com.jme3.scene.plugins.gltf.GltfLoader.load(GltfLoader.java:110)
	at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:260)
	at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:374)
	at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:417)
	at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:421)
	at io.tlf.jme.test.Main.simpleInitApp(Main.java:36)
	at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:239)
	at com.jme3.system.lwjgl.LwjglWindow.initInThread(LwjglWindow.java:520)
	at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:632)
	at com.jme3.system.lwjgl.LwjglWindow.create(LwjglWindow.java:473)
	at com.jme3.app.LegacyApplication.start(LegacyApplication.java:463)
	at com.jme3.app.LegacyApplication.start(LegacyApplication.java:424)
	at com.jme3.app.SimpleApplication.start(SimpleApplication.java:127)
	at io.tlf.jme.test.Main.main(Main.java:145)
Caused by: java.lang.NullPointerException
	at com.jme3.scene.plugins.gltf.GltfLoader.readScenes(GltfLoader.java:214)
	at com.jme3.scene.plugins.gltf.GltfLoader.loadFromStream(GltfLoader.java:159)
	... 14 more

Caused by: java.lang.NullPointerException

Does anyone else have this issue with blender 2.91.0 and gltf?

EDIT: It looks like the gltf file no longer contains a scene node. Perhaps this was a change in the gltf exported that was made recently?

EDIT 2: The gltf file contains the scene node. Still looking for the problem. I was able to export the blender default cube and import it without issues, so it must be related to this model…

OK, I figured out the issue. The new exporter will create an empty scene node if the main blender scene is not named “Scene”
I have opened a PR for the fix here: Fix for gltf empty scene by tlf30 · Pull Request #1442 · jMonkeyEngine/jmonkeyengine (github.com)

1 Like

PR 1442 was integrated into “master” branch today, so the issue should be fixed in the next Engine release.