setPlayRate() and FuncLerpIval inside Parallel crashes panda

import direct.directbase.DirectStart
from pandac.PandaModules import *
from direct.interval.IntervalGlobal import *

base.cam.setPos(0,-15,2)


# MODELS

# model 1
model1 = loader.loadModel('smiley')
model1.reparentTo(render)

# model 2
model2 = loader.loadModel('frowney')
model2.reparentTo(render)
model2.setPos(0,0,2)

# model 3
model3 = loader.loadModel('jack')
model3.reparentTo(render)
model3.setPos(0,0,4)


# INTERVALS

ival1 = model1.hprInterval(2, Vec3(360, 0, 0))

ival2 = model2.hprInterval(2, Vec3(360, 0, 0))

# custom function lerp interval
def rotateFunc(t):
	model3.setHpr(t)

ival3 = LerpFunc(rotateFunc, fromData = Vec3(0, 0, 0), toData = Vec3(360, 0, 0), duration=2, blendType='noBlend')

parallel = Parallel(ival1, ival2, ival3)
parallel.loop()


# SET INTERVAL/ SEQUENCE/ PARALLEL SPEED

parallel.setPlayRate(3.0)


run()

Have a look at this code.

Everything will work fine if you will remove ‘ival3’ from the Parallel which is looping.

For some reason when you have a function lerp interval (‘ival3’ here) inside a Parallel OR Sequence and you call .setPlayRate() on the Parallel, the program will crash with that error.

When calling setPlayRate() directly on the function lerp interval, there is no error.

Is this a Panda bug?

setPlayRate() is not designed to be called on a running interval. You have to pause the parallel first, call setPlayRate() on it, and then you can resume it.

The fact that you can successfully call setPlayRate() on a running LerpFunc interval is just a lucky chance. It’s not guaranteed that you will always be able to do this in future releases of Panda.

Edit: actually, looking closer, I see that setPlayRate() is indeed intended to be callable on a running interval. So this may in fact be a bug. I will investigate.

David

OK, it is indeed a bug, and I have checked in a fix. Sorry about that!

David

Thanks

Got it working with the latest panda3d version from snapshot builds.

EDIT: Oh and something unrelated, Panda3d starts alot faster now.