LerpFunc doesn't register with the IntervalManager?


I have some fun cleaning up intervals that still hang around after the geometry they’re operating on has already been destroyed…

Recently, I started using the IntervalManager of Panda to help me with the cleaning up. I name all my intervals with a special name, and then ask the IntervalManager to finish all intervals with the specific name.

Something like:


This works all fine & well, but it seems as if LerpFunc Intervals don’t register themselves at the IntervalManager.
To demonstrate this I wrote the following test:

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

def myFunc(t):
    print "myFunc running..", t

print "ivals, before:", ivalMgr.getIntervalsMatching("*")
myInterval = LerpFunc(myFunc, duration = 100)
print "the Interval: ", myInterval
# step one frame, just to be sure..
print "the Interval, started: ", myInterval
print "after creating, starting interval.."
print "ivals, after:", ivalMgr.getIntervalsMatching("*")
for i in range(10):

and it gives me the following output:

ivals, before: []
the Interval:  LerpFunctionInterval-1 dur: 100.00
the Interval, started:  LerpFunctionInterval-1 dur: 100.00
after creating, starting interval..
ivals, after: []
myFunc running.. 0.0
myFunc running.. 0.00382898771204
myFunc running.. 0.00402848422527
myFunc running.. 0.0041959467344
myFunc running.. 0.00434524426237
myFunc running.. 0.00452069193125
myFunc running.. 0.0046996595338
myFunc running.. 0.00484986137599
myFunc running.. 0.00523660564795
myFunc running.. 0.00537050701678

Am I doing something wrong or is this a bug?


LerpFunc is handled by task manager

Yeah, it’s a bit of a weirdness. Python-based intervals are handled by the task manager; C-based intervals are handled by the interval manager.

One workaround might be to wrap all of your intervals in, for instance, a one-element Sequence. That would make them all be handled by the interval manager.


So if we put them in a One Element Sequence, they get managed C Side ?
Is there a performance impact?


So interrogate cant handle python call backs? Say passing a python function to c++ layer … like i thought this interval did.


Not really. It still vectors back into Python to perform the actual interval.

It can–else how else could it still work when you wrap it inside a Sequence? But for various reasons, mainly historical, we left the fully-Python interval handled entirely by Python.