LerpTexSomethingInterval and EGG textures?

I tried this code on the official Panda model and it works:

from panda3d.core import *
import direct.directbase.DirectStart
from direct.interval.IntervalGlobal import *

panda = loader.loadModel("panda")
panda.reparentTo(render)

texival = LerpTexOffsetInterval(panda, 5, (1,1), (1,-1))
texival.loop()

run()

Then I try it on my model exported from Blender and it doesnt work.

I even try to reassign the texture by code, but even that doesnt work.

panda.clearTexture()

Doesnt remove the texture from loaded by the egg file.

Try to add a textureStage parameter. I’ve seen some models from blender exported with saved-result flag and that will mess up the default texture stage.

If you mean something like

texival = LerpTexOffsetInterval(panda, 5, (1,1), (1,-1), textureStage = TextureStage.getDefault())

Then that doesn’t work.

If you mean something like getting the texture and reassigning it, then I’m having trouble overwriting the default texture:

from panda3d.core import *
import direct.directbase.DirectStart
from direct.interval.IntervalGlobal import *

panda = loader.loadModel("test")
panda.reparentTo(render)

ts = TextureStage("ts")
texture = panda.findAllTextures()[0]
panda.setTexture(ts, texture, 1)

texival = LerpTexOffsetInterval(panda, 5, (1,1), (1,-1), textureStage = ts)
texival.loop()

run()

getDefault() won’t work in some cases. You can take a look at the egg file and see how the textures are named or use findAllTextureStages() to list them. When you know how the texture stages are called (say ‘Tex01’) you can do

texival = LerpTexOffsetInterval(panda, 5, (1,1), (1,-1), textureStage = TextureStage.findTextureStage('Tex01'))

Hm, yeah, that seems to do the trick.
Thanks, but I tend to forget stuff like this if I don’t get the logic behind it. Mind explaining what’s going on with these egg files?

That I don’t know, sorry. I could only say how I think it works, but I don’t think it works as I think it works.