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

Always make texture paths relative in 'ref' mode #91

Closed
wants to merge 1 commit into from

Conversation

izzyboris
Copy link

Proposed to fix #89. Write gltf image uris as paths relative to the asset, keeping in line with the gltf format spec and also avoiding the problem described in Moguri/panda3d-gltf#131

Note that I can't seem to run these unit tests in my environment at the moment but I've checked this works at runtime during loadModel(), running manually at the command line and in bdist_apps.

@izzyboris izzyboris marked this pull request as draft March 31, 2024 05:33
@izzyboris
Copy link
Author

Marked as Draft, as I realized this may be a wrong or incomplete solution.

When in 'ref' mode: gltf2bam doesn't know the original path of the .blend file. I would assume that if using 'ref', the relative path of a texture to the .blend file should be the same as the relative path to the resulting .bam file. However, to calculate the relative path we need to know where the .blend file came from on disk.

When in 'copy' mode: a new relative path to the copied image can be used. However I'm having difficulty with this, where even though the uri gets set as e.g., "Beam.png", something is still storing a relative path, and this only becomes obvious once the game files are moved to a different Windows drive (since in Windows, it's impossible to construct a relative path between drives).

:gobj(error): Texture::read() - couldn't read: ../../../../../../../AppData/Local/Temp/tmptzg9q0ys/Beam.png
:gobj(error): Unable to find texture "../../../../../../../AppData/Local/Temp/tmptzg9q0ys/Beam.png" on model-path /d/win_amd64;/..;/../models;/d/win_amd64/assets;/d/win_amd64/assets/models

@izzyboris izzyboris closed this May 23, 2024
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

Successfully merging this pull request may close these issues.

textures=ref can leave absolute Windows paths in gltf output
1 participant