Texture Swapping

Hi.

I have working in one animation of fire in blender, then exported the 91 diferents image (frames) png extension, (chimenea0000.png to chimenea0090.png), i have those files into one directory, that i´m calling from one method.

here are images:

In this first one, this is the main module, importing the module where i have the animated textures data, and then calling it from init.

The second one is the module that contains the animated texture data:

Here is the directory where i have the png images:

And this two last ones, the first is with animated texture working… (well, let say that could happen), and the second one is the same but i commented the line “self.planoDeFuego.setTransparency(1)”, that means the plane is well arranged in position, but texture anim does not work… what is wrong?..

thanks in advance.

try replacing the default texture stage, maybe that helps:

task.obj.setTexture(TextureStage.getDefault(), task.textures[...], 1)

if that doesnt help try narrowing down the error, what if you use a untextured plane object and use the code on it. are the textures correctly read do you have correct uv-coodinates, etc.

You could use the egg-texture-cards utility, it will be much easer, look at this manual page: panda3d.org/manual/index.php/A … _Animation

Note, for the record, that these two statements are exactly equivalent:

task.obj.setTexture(TextureStage.getDefault(), task.textures[...], 1)
task.obj.setTexture(task.textures[...], 1)

Both statements replace the texture on the default TextureStage, leaving other TextureStages unchanged.

But I suspect Hypnos has hit at least very close to the problem: if the texture already on your model is not the default TextureStage, then when you use the above operation, it will simply add the new texture to the textures showing, rather than replacing the texture that’s already there. Depending on your textures, this may result in no visual change at all.

One way to avoid this is to find the TextureStage that’s already there, and re-use that one:

ts = task.obj.findTextureStage('*')
task.obj.setTexture(ts, task.textures[...], 1)

Of course, this is just a guess. It might be some other problem. But other than this point, your code looks fine to me.

If that doesn’t solve it, I would put some print statements in your task to make sure it is executing. I would also attempt to apply the texture to the model interactively to ensure that it really does work. Then narrow down the problem from there.

David

all you were right, two methods did work well, and i looking now the fuego.egg file is wrong, because i copied the plane.egg.pz sample file from Texture Swapping tutorial and that works perfectly…

Do I must to add UV Textures and Materials in modeller?, i saw the file was made in maya…

EDIT:, is a bug from the exporter…guess

Thank you.