What is saved in a Bam file?

I’m designing a model importer/preprocessor for my game. Rather than running it and patching up my models at load time I’d like to run it as a “model compiler” and only distribute the final versions. (it does some optimization, remaps textures stages to shader inputs, attaches some effects nodes, generates shaders, sets camera bit masks etc)

It seems like the best thing to do is make a simple application that will prepare all my models from the egg and settings files into bam files. My question is where can I find a list of everything that gets saved when making a bam file out of a NodePath?

Main things of interest: will bam files save:
Tags? as in setTag(string key, string value) (Everything I can’t save can be stored in them if they are saved)
camera_mask? (BitMasks for hiding/showing/showThrough)
Shader inputs? (I expect this to not work at least in some cases)
Shaders? (Its probably better if these arn’t saved so I can do better caching when loading lots of files)
LODNodes? (I haven’t used these yet, but they look handy. I can obviously rebuild them from on import if needed)
Collision Geometry? (Again, I haven’t gotten to this yet, but I will need it)

Also, what about actors and animations? I need to keep support for multi part actors and lots of animations. Whats the process for baming animated stuff from NodePaths? Should my “model compiler” not load them as actors?

Thanks!

The short answer is, bam files are designed to store almost any low-level C++ Panda object (specifically, any Panda objects that inherit from the class TypedWritable), but not any Python objects. So if you know which objects are actually C++ objects, and which are higher-level Python objects, you can answer this easily.

To answer your question more specifically:

Tags? Yes: setTag/getTag, but not setPythonTag/getPythonTag.

camera_mask? Yes.

Shader inputs? This should be yes, but it appears that the person who implemented support for shaders and shader inputs in Panda neglected to implement support for reading and writing bam files. So no.

Shaders? The shaders themselves would always be loaded from an external file, similar to textures; but there is supposed to be support to re-load the referenced shaders automatically when a bam file is read. However, see above: this isn’t implemented yet. So no, unfortunately.

LODNodes? Yes.

Collision Geometry? Yes.

Also, what about actors and animations? The low-level Character and AnimBundle classes are fully supported in bam files, but the high-level Actor class is a Python class. So Actor cannot be written as such. Probably better to write all of the models and animations as a tree of nodes, and recreate the Actors at load time.

David

I’ll dump a shader ID of some sort (probably a source hash) in a tag, along with the shader inputs. Then I just have to walk the scene graph and convert tags on import.

Your suggestion for dealing with actors sounds good.

Thanks for the info. I think I know what I need now.

Has there been an idea in the past to have actual binary egg files?

That would be egg.pz.

David