Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relative paths with ".." in .gltf files don't work #22

Open
hut opened this issue Oct 5, 2024 · 0 comments
Open

Relative paths with ".." in .gltf files don't work #22

hut opened this issue Oct 5, 2024 · 0 comments

Comments

@hut
Copy link

hut commented Oct 5, 2024

Thanks for the great plugin, love it!

There's a bug (in v0.11.0) when there is a relative path with ".." in a .gltf file.

(.gltf files store 3D models and are a slim variant of .glb files where textures and vertex data are not embedded, but stored in external files, so that you can reuse those for different 3D models.)

Example setup

  • assets/textures/solarpanel.jpg (the texture)
  • assets/models/satellite.bin (the vertex data)
  • assets/models/satellite.gltf (the entire model that pulls in the texture and vertex data)

You can find this setup in my git repo at this specific commit: https://codeberg.org/outfly/outfly/src/commit/2873894003838ef9fcccdeb52538e49c23c1b48e

The file satellite.gltf contains references to satellite.bin and ../textures/solarpanel.jpg:

[...]
	"images":[
		{
			"mimeType":"image/jpeg",
			"name":"solarpanel",
			"uri":"../textures/solarpanel.jpg"
		}
	],
[...]
	"buffers":[
		{
			"byteLength":35576,
			"uri":"satellite.bin"
		}
	]
}

Expected Result

Without this plugin, both satellite.bin and solarpanel.jpg are correctly integrated into the model. I would expect the same when enabling this plugin.

Actual Result

  • satellite.bin is integrated correctly.
  • when looking for "../textures/solarpanel.jpg", it doesn't expand to "textures/solarpanel.jpg" but instead remains literally "models/../textures/solarpanel.jpg" and I get this error:
ERROR bevy_asset::server: Path not found: models/../textures/solarpanel.jpg

Workaround

My workaround was to move assets/textures/solarpanel.jpg to assets/models/textures/solarpanel.jpg so that there is no ".." in the uri parameter in the .gltf file anymore, but instead textures/solarpanel.jpg.

But it would be great if ".." would just work.

Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant