Saving Actors into bam files [SOLVED]

I’ve run into a new problem with saving out my models with their gloss and glow maps applied into bam files. When I load an egg as a static model everything works fine. When I load the egg as an actor, however, I lose the texture in the resulting bam file.

Here’s the code I’m using to save out these files:

self.glossTS = TextureStage("Color_TexStage")
self.model1 = self.assetLoader.loadActor("Parts/SJ/RearMolding.egg")
self.model1Tex = self.assetLoader.loadTexture("Parts/SJ/TeamTex.tif")
self.model1.setTexture(self.glossTS, self.model1Tex)
result = self.model1.writeBamFile("RearMolding.bam")

Here is a pic of the actor in the bam writer program

And here is the bam file loaded into my game. You can see the same piece on the hover cycle, but without the red and striped texture, for some reason.

I have absolutely no clue why this would be the case. Can anyone fill me in on this?

Hmm, the writeBamFile() interface is less-thoroughly tested for Actors than it is for static geometry. The Actor class does a lot of massaging of its data when it loads it. Perhaps you could try loading the model initially via the static loadModel() interface (even though it is an animatable model), then write it out as a bam file. And then, try loading the bam file using the Actor interface.

But I don’t know why the textures would be getting lost. That’s strange indeed. Does the same thing happen with this particular model if you don’t use the Actor interface at all?


I loaded the egg file into the bam writer as a model and saved out a bam.

When I loaded that bam as an actor the joint was still in place and working (I use the joint to mount the rear weapon in the right place, so that when I animate the cycle to tilt it left and right the rear weapon will move with the animation) but the texture was still missing.

When I loaded that bam as a model I lost access to the joint (as expected), but the texture shows up just fine.

Just an update about this problem. I’ve been implementing a work around where I separate the models and joints into different eggs so I can load the models as models and the joints as actors.

While doing this, I discovered that the Actor bams which were losing their textures are inheriting the textures of whatever they are parented to.

Hopefully this will provide a little insight into the issue so it can be fixed in a future version of panda.

You’re not applying a texture override on the node they’re being parented to, are you? Something like parentNode.setTexture(newTex, 1)? Because that would override the textures on all children nodes as well.

Are you using the auto-shader generator? Does it work properly if you disable this?


I am using the autoShader generator for the glow and gloss maps. Let me structure my model tree so I have the problem again and turn off the generator to see if the problem persists…

The problem persists with the auto shader off and the bloom filter on. It also persists with both of them turned off.

(To see what I mean about restructuring the model tree, just check this post:

I verified that the problem is related to texture inheriting by using print(myNodePath.findAllTextures()). The children were showing their parent’s textures in addition to their own.

OK, the auto-shader was just a guess. I’m not surprised that it’s not related.

It sounds like you’re describing normal state inheritance, as designed. I put a lengthier explanation in your other thread.


Yup, got it and replied to it. Thanks for helping me with this.

For future viewers of this post looking for a solution to this problem, I am posting this “fix” from another thread. The problem is a result of texture inheritance from parent to child. The solution is to separate the textured models from the joints, and structure your model tree so that child models are not direct children of other textured models. Like so:

I got around the problem by changing my parenting structure.

What I was doing before looked like this:

         |                    |
         Exposed Joint        Exposed Joint
              |                    |
            Model                 Model

Now I’m creating my model tree like this:

         |         |                | 
         Model     Exposed Joint    Exposed Joint
                         |                |
                       Model            Model

So that none of the things with textures on them are ancestors of other things with textures.