diff --git a/direct/src/interval/MopathInterval.py b/direct/src/interval/MopathInterval.py index 82fba9c325..10cbee3a92 100644 --- a/direct/src/interval/MopathInterval.py +++ b/direct/src/interval/MopathInterval.py @@ -1,36 +1,38 @@ """MopathInterval module: contains the MopathInterval class""" -import Interval +import LerpInterval from PandaModules import * from DirectNotifyGlobal import * # import Mopath -class MopathInterval(Interval.Interval): +class MopathInterval(LerpInterval.LerpFunctionInterval): # Name counter mopathNum = 1 # create MopathInterval DirectNotify category notify = directNotify.newCategory('MopathInterval') # Class methods - def __init__(self, mopath, node, name=None): - """__init__(mopath, node, name) - """ - self.mopath = mopath - self.node = node + def __init__(self, mopath, node, fromT = 0, toT = None, + blendType = 'noBlend', name = None): + if toT == None: + toT = mopath.getMaxT() + # Generate unique name if necessary if (name == None): name = 'Mopath-%d' % MopathInterval.mopathNum MopathInterval.mopathNum += 1 - # Compute duration - duration = self.mopath.getMaxT() - # Initialize superclass - Interval.Interval.__init__(self, name, duration) - def privStep(self, t): + LerpInterval.LerpFunctionInterval.__init__( + self, self.__doMopath, fromData = fromT, toData = toT, + duration = abs(toT - fromT), blendType = blendType, + name = name) + + self.mopath = mopath + self.node = node + + def __doMopath(self, t): """ updateFunc(t, event) Go to time t """ self.mopath.goTo(self.node, t) - self.state = CInterval.SStarted - self.currT = t