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

Models with textures are not stored correctly in cache #118

Closed
el-dee opened this issue Apr 18, 2023 · 1 comment
Closed

Models with textures are not stored correctly in cache #118

el-dee opened this issue Apr 18, 2023 · 1 comment

Comments

@el-dee
Copy link
Contributor

el-dee commented Apr 18, 2023

This is a regression introduced by 27ef4ae

If I load a .gltf model with textures twice, the second time there are errors in the log about texture not found and the models is rendered without any textures.

This is the output witht the BoomBox model from gLTF:

Known pipe types:
  glxGraphicsPipe
(all display modules loaded.)
:gobj(error): Texture::read() - couldn't read: BoomBox_baseColor.png
:gobj(error): Unable to find texture "BoomBox_baseColor.png" on model-path /home/ld/Projects/gltf/gltf:/usr/share/panda3d:/usr/share/panda3d/models
:gobj(error): Texture::read() - couldn't read: BoomBox_occlusionRoughnessMetallic.png
:gobj(error): Unable to find texture "BoomBox_occlusionRoughnessMetallic.png" on model-path /home/ld/Projects/gltf/gltf:/usr/share/panda3d:/usr/share/panda3d/models
:gobj(error): Texture::read() - couldn't read: BoomBox_normal.png
:gobj(error): Unable to find texture "BoomBox_normal.png" on model-path /home/ld/Projects/gltf/gltf:/usr/share/panda3d:/usr/share/panda3d/models
:gobj(error): Texture::read() - couldn't read: BoomBox_emissive.png
:gobj(error): Unable to find texture "BoomBox_emissive.png" on model-path /home/ld/Projects/gltf/gltf:/usr/share/panda3d:/usr/share/panda3d/models

The viewer does not show the issue as the cache is disabled and the directory containing the .gltf file is prepended to the model path list (which is something an actual app should not do as models could have textures using the same filename but with different content)

The fix seems trivial: the following line

texture.filename = texture.fullpath = uri

should be replaced by:

texture.filename = uri

but I fear any side effects or consequences on e.g. gltf2bam

@Moguri Moguri closed this as completed in 5c55250 May 13, 2023
@Moguri
Copy link
Owner

Moguri commented May 13, 2023

I went ahead and applied the fix. Tests are passing, and I ran into no issues with one of my projects that uses blend2bam/panda3d-gltf. Unfortunately, I do not remember why I originally needed to set fullpath there.

We'll see if someone complains about the change and then I can write a test case to catch it.

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

2 participants