From 5c7bbbafa4e1754cb38aaf9ea6e5673de89470f7 Mon Sep 17 00:00:00 2001 From: Joe Shochet Date: Thu, 14 Feb 2002 21:36:10 +0000 Subject: [PATCH] *** empty log message *** --- direct/src/interval/IntervalGlobal.py | 2 +- direct/src/interval/LerpInterval.py | 135 +++++++++++++------------- 2 files changed, 71 insertions(+), 66 deletions(-) diff --git a/direct/src/interval/IntervalGlobal.py b/direct/src/interval/IntervalGlobal.py index a1c7690d01..cb6fa56b70 100644 --- a/direct/src/interval/IntervalGlobal.py +++ b/direct/src/interval/IntervalGlobal.py @@ -1,6 +1,6 @@ """IntervalGlobal module""" -from DirectObject import * +# from DirectObject import * from Interval import * from ActorInterval import * from FunctionInterval import * diff --git a/direct/src/interval/LerpInterval.py b/direct/src/interval/LerpInterval.py index e07c29d9b3..292be32ec8 100644 --- a/direct/src/interval/LerpInterval.py +++ b/direct/src/interval/LerpInterval.py @@ -1,6 +1,7 @@ """LerpInterval module: contains the LerpInterval class""" from PandaModules import * +from DirectNotifyGlobal import * import Interval import LerpBlendHelpers @@ -293,10 +294,75 @@ class LerpPosHprScaleInterval(LerpInterval): # Initialize superclass LerpInterval.__init__(self, name, duration, functorFunc, blendType) -# Class used to execute a function over time. Function can access fromData -# and toData to perform blend. If fromData and toData not specified, will -# execute the given function passing in values ranging from 0 to 1 -class LerpFunctionInterval(Interval): + +class LerpColorScaleInterval(LerpInterval): + # Name counter + lerpColorScaleNum = 1 + # Class methods + def __init__(self, node, duration, startColor, endColor, + other=None, blendType='noBlend', name=None): + + def functorFunc(node=node, startColor=startColor, endColor=endColor, other=other): + assert(not node.isEmpty()) + if callable(endColor): + # This may be a thunk that returns a point. + endColor = endColor() + if callable(startColor): + # This may be a thunk that returns a point. + startColor = startColor() + if (other != None): + functor = ColorScaleLerpFunctor(node, startColor, endColor, other) + else: + functor = ColorScaleLerpFunctor(node, startColor, endColor) + return functor + + # Generate unique name if necessary + if (name == None): + name = 'LerpColorScaleInterval-%d' % LerpColorScaleInterval.lerpColorScaleNum + LerpColorScaleInterval.lerpColorScaleNum += 1 + # Initialize superclass + LerpInterval.__init__(self, name, duration, functorFunc, blendType) + + + +class LerpColorInterval(LerpInterval): + # Name counter + lerpColorNum = 1 + # Class methods + def __init__(self, node, duration, startColor, endColor, + other=None, blendType='noBlend', name=None): + + def functorFunc(node=node, startColor=startColor, + endColor=endColor, other=other): + assert(not node.isEmpty()) + if callable(endColor): + # This may be a thunk that returns a point. + endColor = endColor() + if callable(startColor): + # This may be a thunk that returns a point. + startColor = startColor() + if (other != None): + functor = ColorLerpFunctor(node, startColor, endColor, other) + else: + functor = ColorLerpFunctor(node, startColor, endColor) + return functor + + # Generate unique name if necessary + if (name == None): + name = 'LerpColorInterval-%d' % LerpColorInterval.lerpColorNum + LerpColorInterval.lerpColorNum += 1 + # Initialize superclass + LerpInterval.__init__(self, name, duration, functorFunc, blendType) + + + +class LerpFunctionInterval(Interval.Interval): + """ + Class used to execute a function over time. Function can access fromData + and toData to perform blend. If fromData and toData not specified, will + execute the given function passing in values ranging from 0 to 1 + """ + # Interval counter lerpFunctionIntervalNum = 1 # create LerpFunctionInterval DirectNotify category @@ -360,64 +426,3 @@ class LerpFunctionInterval(Interval): class LerpFunc(LerpFunctionInterval): def __init__(self, *args, **kw): LerpFunctionInterval.__init__(self, *args, **kw) - - -class LerpColorScaleInterval(LerpInterval): - # Name counter - lerpColorScaleNum = 1 - # Class methods - def __init__(self, node, duration, startColor, endColor, - other=None, blendType='noBlend', name=None): - - def functorFunc(node=node, startColor=startColor, endColor=endColor, other=other): - assert(not node.isEmpty()) - if callable(endColor): - # This may be a thunk that returns a point. - endColor = endColor() - if callable(startColor): - # This may be a thunk that returns a point. - startColor = startColor() - if (other != None): - functor = ColorScaleLerpFunctor(node, startColor, endColor, other) - else: - functor = ColorScaleLerpFunctor(node, startColor, endColor) - return functor - - # Generate unique name if necessary - if (name == None): - name = 'LerpColorScaleInterval-%d' % LerpColorScaleInterval.lerpColorScaleNum - LerpColorScaleInterval.lerpColorScaleNum += 1 - # Initialize superclass - LerpInterval.__init__(self, name, duration, functorFunc, blendType) - - - -class LerpColorInterval(LerpInterval): - # Name counter - lerpColorNum = 1 - # Class methods - def __init__(self, node, duration, startColor, endColor, - other=None, blendType='noBlend', name=None): - - def functorFunc(node=node, startColor=startColor, - endColor=endColor, other=other): - assert(not node.isEmpty()) - if callable(endColor): - # This may be a thunk that returns a point. - endColor = endColor() - if callable(startColor): - # This may be a thunk that returns a point. - startColor = startColor() - if (other != None): - functor = ColorLerpFunctor(node, startColor, endColor, other) - else: - functor = ColorLerpFunctor(node, startColor, endColor) - return functor - - # Generate unique name if necessary - if (name == None): - name = 'LerpColorInterval-%d' % LerpColorInterval.lerpColorNum - LerpColorInterval.lerpColorNum += 1 - # Initialize superclass - LerpInterval.__init__(self, name, duration, functorFunc, blendType) -