Trouble Pausing/finishing a sequence

Hi, I am attempting to create a sequence that can be paused at any time during the sequence. The sequence is set up with this function, which is called when a certain contact is detected:

        def doGrind():

                self.grindseq = Sequence()

                        for i in range(n, len(self.points)):
                                par = Parallel(LerpPosInterval(node, t, self.pointPos[i]),
                                        LerpPosInterval(, t, self.pointPos[i]),
                                        LerpHprInterval(model, t, self.pointHpr[i]))


I attempt to end the sequence with this function:

     def exitGrind(self):
             if self.grindseq.isPlaying():
                     print('exit grind')

This does not work. However, when I place self.grindseq = Sequence() into the __init__ of my program, I get the desired effect, but there is a delay before the sequence begins as well as this error :

:interval(warning): CLerpNodePathInterval::priv_initialize() called for LerpPosInterval-2 in state >started.

Any help is greatly appreciated!

Is it possible that “doGrind” is being called more than once?

Specifically, it occurs to me that, if said method were called more than once, you could end up with more than one sequence running, I think. However, since the method replaces the contents of “self.grindseq”, you would then lose the reference to any previous sequence that it may have held, and thus have no means of pausing that previous sequence.

I would imagine that this doesn’t happen when you put the sequence-initialisation into the “init” method because that method is presumably being run just once.

One way of testing this might be to have the “doGrind” method first check whether “self.grindseq” already holds a sequence, and if so, stop that sequence. (You might then want to initialise it to “None”, so that it exists to be checked on the first run of “doGrind”, and clear it to “None” when the sequence is done, so that you’re not stopping a sequence that has already stopped.)

1 Like

That seemed to be the issue, thanks!

1 Like