waitInterval ignores state?

Hi,

currently Im looking for a way to wait for a specific event in a sequence:
codepad.org/1GeLwpvP

If I made no misstake CWaitInterval seems to ignore to state completely. Pausing and then resuming a 0.1 WaitInterval does not work either. Did I miss something? Is there a other way to finsih a Wait prematurely? Is it possible to change the duration?

You are trying to use an interval for a purpose beyond its intended design. Intervals aren’t meant to be dynamic in duration like this; and although you can extend an Interval’s behavior through subclassing, it would be a bit more complex than what you are doing here.

Instead, consider using a task for this purpose.

David

Well anyway according to panda3d.org/manual/index.php/Intervals

Does not this apply to WaitInterval as well? Of course I can use a task but this way I cant use Sequences and have to handle it by my own :confused:

That is the interface for controlling a playing interval from outside. It doesn’t work that way from within the interval itself.

When you embed an interval within a Sequence, it doesn’t really play the interval directly. Instead, only the outermost Sequence is “playing”; and all of the intervals nested within it are invoked (but not “played”) in the appropriate order. This is all a very sophisticated system designed to optimize the playback of complex intervals. You can’t call finish() on a deeply nested interval, because nested intervals aren’t in a playing state.

What you’re trying to do can very naturally be expressed in two functions, without even using the task system:

def func1(self):
    self.video.play()
    self.sound.play()
    self.accept("mouse1", self.continue)
    self.accept(self.video.getFinishedEvent(), self.continue)

def func2(self):
    self.ignoreAll()
    self.openAP()

self.func1()

David