So I ran into an issue where JME could not find an assets that was actually a texture dependency on a gltf model. This was because blender put a space in the name of the jpg when it created it during the export. GLTF encodes spaces as %20 per RFC3986. But the current jme GLTF plugin does not attempt to decode the encoded URI before using it, so it will pass the file name some%20name.jpg
to the asset manager and it will be unable to find the file (AssetNotFoundException) which is actually some name.jpg
.
Another interesting thing to take note, although I did not test this, GLTF does not restrict URIs to be files, they can also be a URL. I am not sure if this is handled yet, from my digging in the code it did not look like it.
I would think that doing Paths.get(url.toURI()).toFile()
would be sufficient, but perhaps we need to check the protocol on the uri first, but gltf does not put the file:/
at the beginning of file URIs, so we would need to check for a http
as the protocol, and assume file if not present. Since we have the UrlLocater
I do not think it would be that difficult to make the http
uri work.
Anyways, any thoughts on the process for this?
I am actually surprised that no one has run into this issue yet, although I just hit it myself yesterday after working with many gltf models that last year.
If I have some time today I might see if I can get something working.
For more info on the uri encoding in gltf, see here: Whitespace in URIs Ā· Issue #1449 Ā· KhronosGroup/glTF Ā· GitHub
Thanks,
Trevor