I’m specifically only using glTF right now.
As suggested, panda3d-gltf library is used.
Sometimes, when I load models from different folders but with models and their texture named the same, Panda will just use the first loaded texture and applied it on every model until I manually delete the files in the cache folder.
The other issue is, if I will re-export the glTF from my editor, sometimes Panda will refuse to reload the models and just use the old one in the cache.
Seems like the caching system was designed for egg and either the new glTF importers don’t respect it, or it doesn’t respect them.
Create two glTF files, each in its own subfolder. Name them and their texture the same
Load both in Panda.
The second one will reuse the texture of the first one.
Delete your cache folder, reverse the order of the loaded models in your code. Now the previously first model will reuse the texture of the previously last one.
I don’t really want that, I want it to generate and use bam files, otherwise load times for files which will come with my program will be very slow.
What I want it to do is to respect the full file path (at least from the root program directory) and not just the file name of the textures when determining whether to use cached textures or not. Otherwise again, it applies the wrong texture to the wrong model when both texture files are named the same.
I’m unable to create a clear reproduction step for the second (remaining) issue. Sometimes the new gltf files (same name as the one which have already been cached, but updated model data) fail to be used and the old cached version is used, sometimes it does work. I don’t know what the trigger is. My guess is the loader or caching system fails to do a proper comparison between the data in the cached bam file and the current gltf file, to determine if they are different and if a new bam is needed to be generated or not. For example, maybe it is checking for file size or poly count instead of actual coordinates of the vertices (shape of the mesh). I think, if it isn’t currently, it should just be checking the creation or modification date of the gltf file and if that data is newer than the cache, it should generate a new bam file regardless of it considers the new gltf file too similar to the old one or not.
For my current project it’s not an issue as I can delete the cache and generate it one last time when shipping the product, and users are not expected to be able to alter the models on their end, but this is a general issue that has to be identified and fixed.
I believe it’s just looking at the modified time. Is this happening when the file is being modified and reloaded within the same second, by any chance?