From be3a0f352057028e2d11e3d9e51651a686d2e2dc Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 19 May 2010 12:28:17 +0000 Subject: [PATCH] fix setPlayRate() on running MetaInterval --- direct/src/interval/MetaInterval.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/direct/src/interval/MetaInterval.py b/direct/src/interval/MetaInterval.py index 382b97d9de..4900cbfbc4 100644 --- a/direct/src/interval/MetaInterval.py +++ b/direct/src/interval/MetaInterval.py @@ -460,6 +460,19 @@ class MetaInterval(CMetaInterval): else: self.notify.error("Cannot build list from MetaInterval directly.") + def setPlayRate(self, playRate): + """ Changes the play rate of the interval. If the interval is + already started, this changes its speed on-the-fly. Note that + since playRate is a parameter to start() and loop(), the next + call to start() or loop() will reset this parameter. """ + + if self.isPlaying(): + self.pause() + CMetaInterval.setPlayRate(self, playRate) + self.resume() + else: + CMetaInterval.setPlayRate(self, playRate) + def __doPythonCallbacks(self): # This function invokes any Python-level Intervals that need # to be invoked at this point in time. It must be called