isStarted/isStopped always evals as if interval is finished

isStarted and isStopped with LerpInterval (sequence) always evaluates as if the interval is not runnning even when I can visibly see the interval running on the screen.

— PseudoCode

i1 = LerpPosInterval(…)
i2 = LerpPosInterval(…)

mySeq = (i1, i2, name=“mySeq”)


isStarted() ------ always equals 0
isStopped() ------ always equals 1
------- even though I can see it running (model moving)

I want to execute some code but not until after the sequence is finished. Is there another approach or do I seem to be doing something wrong?

Are you testing mySeq.isStarted(), or i1.isStarted()? In your example, the Sequence–that is, mySeq–is the only interval that is considered “started”. The two LerpIntervals become a part of mySeq, and are not directly started themselves.


I first tried:


That did behave as I expected so I tried-

(and with i2 as well)

Regardless, did not return that the interval / sequence was running.

It did behave as you expected? Or did you mean to say it didn’t? If it did work for mySeq, then that is the correct behavior.

Although now that I look closer, the method name is isPlaying(), not isStarted(). But I guess you knew that.

In any case, mySeq.isPlaying() will return 1 while the sequence is playing, and 0 when it is not playing. But i1.isPlaying() and i2.isPlaying() will always return 0, since those intervals are not technically playing (even though they are part of the interval that is playing).


Sorry 'bout the poorly worded post - working too late / too long.

Here is the actual code snippet…

    i1 = LerpPosInterval(camera, 4, pos = Point3(0, 80, 0), startPos = None,
                   other = None, blendType = 'easeInOut',
                   bakeInStart = 1, fluid = 0, name = None)

    i2 = LerpHprInterval(camera, 4, hpr = Point3(0, 15, 0), startHpr = None,
                   other = None, blendType = 'easeInOut',
                   bakeInStart = 1, fluid = 0, name = None)

    controlSeq = Sequence(i1, i2, name = "controlSeq")
    print "in control panel"
    print controlSeq.isStopped()
    print controlSeq.isPlaying()

both isStopped and isPlaying return 1 while interval is playing…

So here’s what’s going on: isStopped() and isPlaying() are not precisely antonyms of each other.

In your example, isStopped() and isPlaying() are both immediately true. But in the next frame, isStopped() will go to 0, while isPlaying() will remain at 1. While the interval is playing, if you were to call pause() temporarily, both isStopped() and isPlaying() would be 0. When the interval eventually finishes, isStopped() will go to 1, and there may or may not be another frame of overlap when they are both 1; and then isPlaying() will go to 0.

This is because isPlaying() is defined to return True when the interval is on the ivalMgr’s list of active intervals. It is put on that list by a call to start(), and it is removed from that list by a call to finish() or pause(), or by playing to completion.

However, isStopped() returns True when the interval is in its initial or final state. That is to say, before it has executed its first frame, or after it has completed its last frame. When you call start(), it puts the interval on the ready queue, but it does not execute immediately, so isStopped() is still True, until the next frame.

All this may be academic. If what you are seeking is a way to be notified when an interval has finished, consider using controlSeq.setDoneEvent(‘eventName’), which will throw the indicated event (in this case, ‘eventName’) when the interval has finished. Then you just have to do something like self.accept(‘eventName’, self.intervalDone) to get a callback when the interval has finished.

If you’d like to get a callback when i1 has finished (but i2 might still be playing), insert a Func(messenger.send, ‘eventName’) into your Sequence between i1 and i2.




Setting the event works like a charm.