Accessing The Multi

Does Panda have user APIs that will allow access to one particular material or one particular texture, on an object that has multi texturing and multiple materials, for manipulation?

That is much needed.

For instance, you might want to make a character’s skin material shine, but leave all other materials alone; and covert the skin material back to original at some point.



and more…


Ok… I suppose the values returned will be a pointer to that material or texture?

or will it point to the face which is uv mapped with that texture or material?

Holy “chit!” I just did a character.findAllMaterials() and a list of cords return.

Don’t tell me, if I wanted to change a materials look or swap out a texture for a new one, it’s going to have to be done on the cord level?


I see…it’s really just the attributes like ambient, diffuse and so on. Now I just have to figure out how to write manipulation code that will up date the material.

Then its off to texture swapping.


I guess I’ll leave it alone for now. Panda has the API calls for doing things like finding a texture, but what is returned is far from successful.

I tried nodepath.findTexture(“BodyTexture”);

This returned a different texture…even though I provided a string name. Yikes!

What did you expect findTexture() to return, other than a texture?

Normally, if you want to replace one texture on a model, you should flag those pieces of the model so they will be placed in a separate node from the rest of the model, then you can find that particular node with NodePath.find() and replace the texture there.

If you really want to replace the texture on a piece deeply nested within a model, it’s possible, but unnecessarily complicated, especially when the easy solution is so easy.


The right texture.

But I guess Panda’s API arguments for “FIND” aren’t direct. You’ve already mentioned “flagging” so that proves it there.

Oh well…I’ll play around with that stuff later on. Too much work ahead of me to worry about it now.

Great, figured out how to tag an object. I exported a model made of more than one object, found a specific object within the model and returned that material for that piece.

At least I’m on the right track now. I’m sure it’s the same for texturing, and with that said, I now see how to swap texture on a specific piece of a model.

What I was asking for with this topic was example code showing the synax needed to accomplish this. But something like this can be setup right out of your 3D modeling package, with no need to use the command prompt for altering an egg file.


“One must first conquer thy self before they can conquer the world.” - words of the peg leg hermmit

For the record, I don’t see anything wrong with findTexture(); it’s certainly not returning the wrong texture for me:

>>> m = loader.loadModel('environment.egg')
>>> print m.findTexture('envir-rock2')
2d_texture envir-rock2 (from /Users/drose/player/models/maps/envir-rock2.jpg)
>>> print m.findTexture('nosuchtexture')