Loader behavior: Does it still prioritize .bam over .egg?


We’re currently building a version of Panda very close to the head of the public source repository. I’ve run into a confusing behavior: It seems now that if a .bam is placed in a directory alongside its .egg, that the .egg will load instead of the .bam. Additionally, if the .egg is removed, the .bam doesn’t load at all.

We were previously using Panda3D 1.2.3, so we’re a little behind on the latest changes. Is this new behavior by design? If so, is there a way to get the old behavior back (of loading the .bam first, or the .egg if the .bam is missing)? I found the directive ‘default-model-extension’ in the etc/Confauto.prc file; is that related?

Thank you for your help!

Right, we have eliminated the original feature of auto-loading either an egg or bam file, whichever is newer. That feature was making it difficult to optimize the loader path, and was also interfering with other, more important features; and we deemed it infrequently used.

Instead, we recommend you explicitly specify the extension in code when you load a model. If you wish to be able to switch at runtime between loading an egg file or loading a bam file, then you may omit the extension, and set your default-model-extension to either egg or bam. But you do have to know which kind of file you want to load at any given session.


If you are using bam files solely to speed load times, you might also be interested in the model-cache-dir config variable. If you set this variable, it is the name of a directory that will be used to cache model loads as bam files. So you can distribute egg files with your application, and load egg files explicitly in code, but if the cache version is newer it will load that instead. You can also set model-cache-max-kbytes to specify the maximum size of the cache.

This has the nice advantage that you don’t have to build bam files by hand, and you can easily distribute an application that is independent of Panda version. On the other hand, the user does have to load the egg files at least the first time, and you don’t have as much control over the resulting bam files.