I’m currently trying to build a distributable version of a project that includes models in the GLTF format. In the IDE, such models are loaded without problem. However, in the distributable version the loading of them fails, producing an error message in the log of the following form:
:loader(error): Extension of file <file-path>.gltf is unrecognized; cannot load.
Currently known scene file types are:
:loader(error): Couldn't load file <file-path>.gltf: all matching files on model path invalid (the model path is currently: <model-path>)
The fact that the error only lists “bam” as a known file-type seems to suggest that GLTF support hasn’t been included in the build.
Conversely, however, I do have “panda3d-gltf” in my “requirements.txt” file.
I really don’t think that you should ship panda3d-gltf and the .gltf files with your game; rather you should register an extension handler to convert them to .bam files upon running build_apps, similar to what happens when you pack an .egg file.
@Moguri perhaps we should look for a way for panda3d-gltf to automatically register such a handler with build_apps?
As it happens, behind the scenes the GLTF files in question have been converted to bam files for me, so I no longer require support for the former in my build. Nevertheless, thank you all for your help here, and perhaps this will prove useful to others in the future!
I know this a bit old, but I haven’t been able to load GLTF or GLB with Panda at all. I have been using this guy’s tool: GitHub - Moguri/panda3d-gltf: glTF utilities for Panda3D to convert them to bam (I am not affiliated with that repo). It seems to work well for me so far… All of my models were originally glb, but converted to bam with gltf2bam. And I have built executables on Ubuntu and Windows 11 without any issues.
One other good thing is that gltf2bam works with a venv too as long as the venv is activated… on both Windows and Ubuntu I do not follow the typical install directions that are given in Panda3d documentation. I just treat it like any other python lib and install it into a virtualenv. I have not had any issues so far. Although I did have to apt install the recommended libs on Ubuntu… Windows worked right off the bat (odd lol).