*** empty log message ***
This commit is contained in:
parent
edf4be0de3
commit
bd2db22e1f
|
|
@ -246,13 +246,13 @@
|
|||
import LerpBlendHelpers
|
||||
|
||||
if (blendType == "easeIn"):
|
||||
return LerpBlendHelpers.LerpBlendHelpers.easeIn
|
||||
return LerpBlendHelpers.easeIn
|
||||
elif (blendType == "easeOut"):
|
||||
return LerpBlendHelpers.LerpBlendHelpers.easeOut
|
||||
return LerpBlendHelpers.easeOut
|
||||
elif (blendType == "easeInOut"):
|
||||
return LerpBlendHelpers.LerpBlendHelpers.easeInOut
|
||||
return LerpBlendHelpers.easeInOut
|
||||
elif (blendType == "noBlend"):
|
||||
return LerpBlendHelpers.LerpBlendHelpers.noBlend
|
||||
return LerpBlendHelpers.noBlend
|
||||
else:
|
||||
raise Exception("Error: NodePath.__getBlend: Unknown blend type")
|
||||
|
||||
|
|
|
|||
|
|
@ -18,13 +18,14 @@ class Interval(DirectObject):
|
|||
|
||||
playbackCounter = 0
|
||||
|
||||
clock = ClockObject.ClockObject.getGlobalClock()
|
||||
|
||||
# Class methods
|
||||
def __init__(self, name, duration, openEnded = 1):
|
||||
"""__init__(name, duration)
|
||||
"""
|
||||
self.name = name
|
||||
self.duration = duration
|
||||
self.clock = ClockObject.ClockObject.getGlobalClock()
|
||||
self.curr_t = 0.0
|
||||
self.prev_t = 0.0
|
||||
self.stopEventList = []
|
||||
|
|
|
|||
|
|
@ -182,3 +182,20 @@ print(t2)
|
|||
# mtrack.play()
|
||||
# t1.play()
|
||||
# t2.play()
|
||||
|
||||
|
||||
def test(n):
|
||||
lerps = []
|
||||
for i in range(n):
|
||||
lerps.append(LerpPosHprInterval(dock, 5.0,
|
||||
pos=Point3(0, 0, -5),
|
||||
hpr=Vec3(0, 0, 0),
|
||||
startPos=dock.getPos(),
|
||||
startHpr=dock.getHpr(),
|
||||
name='dock-lerp'))
|
||||
lerps.append(EventInterval("joe"))
|
||||
t = Track(lerps)
|
||||
mt = MultiTrack([t])
|
||||
# return mt
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
"""LerpInterval module: contains the LerpInterval class"""
|
||||
|
||||
from Interval import *
|
||||
from PandaModules import *
|
||||
|
||||
import Lerp
|
||||
import LerpBlendHelpers
|
||||
|
||||
class LerpInterval(Interval):
|
||||
# Class methods
|
||||
|
|
@ -21,11 +22,11 @@ class LerpInterval(Interval):
|
|||
"""
|
||||
# Check to see if we need to create the lerp
|
||||
if (event == IVAL_INIT):
|
||||
self.lerp = Lerp.Lerp(self.functorFunc(), self.duration,
|
||||
self.lerp = Lerp(self.functorFunc(), self.duration,
|
||||
self.blendType)
|
||||
# Make sure lerp exists
|
||||
if (not self.lerp):
|
||||
self.lerp = Lerp.Lerp(self.functorFunc(), self.duration,
|
||||
self.lerp = Lerp(self.functorFunc(), self.duration,
|
||||
self.blendType)
|
||||
# Evaluate the lerp
|
||||
self.lerp.setT(t)
|
||||
|
|
@ -34,15 +35,14 @@ class LerpInterval(Interval):
|
|||
"""__getBlend(self, string)
|
||||
Return the C++ blend class corresponding to blendType string
|
||||
"""
|
||||
import LerpBlendHelpers
|
||||
if (blendType == "easeIn"):
|
||||
return LerpBlendHelpers.LerpBlendHelpers.easeIn
|
||||
return LerpBlendHelpers.easeIn
|
||||
elif (blendType == "easeOut"):
|
||||
return LerpBlendHelpers.LerpBlendHelpers.easeOut
|
||||
return LerpBlendHelpers.easeOut
|
||||
elif (blendType == "easeInOut"):
|
||||
return LerpBlendHelpers.LerpBlendHelpers.easeInOut
|
||||
return LerpBlendHelpers.easeInOut
|
||||
elif (blendType == "noBlend"):
|
||||
return LerpBlendHelpers.LerpBlendHelpers.noBlend
|
||||
return LerpBlendHelpers.noBlend
|
||||
else:
|
||||
raise Exception(
|
||||
'Error: LerpInterval.__getBlend: Unknown blend type')
|
||||
|
|
@ -57,19 +57,16 @@ class LerpPosInterval(LerpInterval):
|
|||
"""
|
||||
def functorFunc(node=node, pos=pos, startPos=startPos,
|
||||
other=other):
|
||||
import PosLerpFunctor
|
||||
assert(not node.isEmpty())
|
||||
if (other != None):
|
||||
# lerp wrt other
|
||||
if (startPos == None):
|
||||
startPos = node.getPos(other)
|
||||
functor = PosLerpFunctor.PosLerpFunctor(
|
||||
node, startPos, pos, other)
|
||||
functor = PosLerpFunctor(node, startPos, pos, other)
|
||||
else:
|
||||
if (startPos == None):
|
||||
startPos = node.getPos()
|
||||
functor = PosLerpFunctor.PosLerpFunctor(
|
||||
node, startPos, pos)
|
||||
functor = PosLerpFunctor(node, startPos, pos)
|
||||
return functor
|
||||
|
||||
# Generate unique name if necessary
|
||||
|
|
@ -89,20 +86,16 @@ class LerpHprInterval(LerpInterval):
|
|||
"""
|
||||
def functorFunc(node=node, hpr=hpr, startHpr=startHpr,
|
||||
other=other):
|
||||
import HprLerpFunctor
|
||||
|
||||
assert(not node.isEmpty())
|
||||
if (other != None):
|
||||
# lerp wrt other
|
||||
if (startHpr == None):
|
||||
startHpr = node.getHpr(other)
|
||||
functor = HprLerpFunctor.HprLerpFunctor(
|
||||
node, startHpr, hpr, other)
|
||||
functor = HprLerpFunctor(node, startHpr, hpr, other)
|
||||
else:
|
||||
if (startHpr == None):
|
||||
startHpr = node.getHpr()
|
||||
functor = HprLerpFunctor.HprLerpFunctor(
|
||||
node, startHpr, hpr)
|
||||
functor = HprLerpFunctor(node, startHpr, hpr)
|
||||
return functor
|
||||
|
||||
# Generate unique name if necessary
|
||||
|
|
@ -123,20 +116,16 @@ class LerpScaleInterval(LerpInterval):
|
|||
"""
|
||||
def functorFunc(node=node, scale=scale,
|
||||
startScale=startScale, other=other):
|
||||
import ScaleLerpFunctor
|
||||
|
||||
assert(not node.isEmpty())
|
||||
if (other != None):
|
||||
# lerp wrt other
|
||||
if (startScale == None):
|
||||
startScale = node.getScale(other)
|
||||
functor = ScaleLerpFunctor.ScaleLerpFunctor(
|
||||
node, startScale, scale, other)
|
||||
functor = ScaleLerpFunctor(node, startScale, scale, other)
|
||||
else:
|
||||
if (startScale == None):
|
||||
startScale = node.getScale()
|
||||
functor = ScaleLerpFunctor.ScaleLerpFunctor(
|
||||
node, startScale, scale)
|
||||
functor = ScaleLerpFunctor(node, startScale, scale)
|
||||
return functor
|
||||
|
||||
# Generate unique name if necessary
|
||||
|
|
@ -158,8 +147,6 @@ class LerpPosHprInterval(LerpInterval):
|
|||
"""
|
||||
def functorFunc(node=node, pos=pos, hpr=hpr,
|
||||
startPos=startPos, startHpr=startHpr, other=other):
|
||||
import PosHprLerpFunctor
|
||||
|
||||
assert(not node.isEmpty())
|
||||
if (other != None):
|
||||
# lerp wrt other
|
||||
|
|
@ -167,7 +154,7 @@ class LerpPosHprInterval(LerpInterval):
|
|||
startPos = node.getPos(other)
|
||||
if (startHpr == None):
|
||||
startHpr = node.getHpr(other)
|
||||
functor = PosHprLerpFunctor.PosHprLerpFunctor(
|
||||
functor = PosHprLerpFunctor(
|
||||
node, startPos, pos,
|
||||
startHpr, hpr, other)
|
||||
else:
|
||||
|
|
@ -175,7 +162,7 @@ class LerpPosHprInterval(LerpInterval):
|
|||
startPos = node.getPos()
|
||||
if (startHpr == None):
|
||||
startHpr = node.getHpr()
|
||||
functor = PosHprLerpFunctor.PosHprLerpFunctor(
|
||||
functor = PosHprLerpFunctor(
|
||||
node, startPos, pos,
|
||||
startHpr, hpr)
|
||||
return functor
|
||||
|
|
@ -201,8 +188,6 @@ class LerpPosHprScaleInterval(LerpInterval):
|
|||
def functorFunc(node=node, pos=pos, hpr=hpr, scale=scale,
|
||||
startPos=startPos, startHpr=startHpr,
|
||||
startScale=startScale, other=other):
|
||||
import PosHprScaleLerpFunctor
|
||||
|
||||
assert(not node.isEmpty())
|
||||
if (other != None):
|
||||
# lerp wrt other
|
||||
|
|
@ -212,7 +197,7 @@ class LerpPosHprScaleInterval(LerpInterval):
|
|||
startHpr = node.getHpr(other)
|
||||
if (startScale == None):
|
||||
startScale = node.getScale(other)
|
||||
functor = PosHprScaleLerpFunctor.PosHprScaleLerpFunctor(
|
||||
functor = PosHprScaleLerpFunctor(
|
||||
node, startPos, pos, startHpr, hpr,
|
||||
startScale, scale, other)
|
||||
else:
|
||||
|
|
@ -222,7 +207,7 @@ class LerpPosHprScaleInterval(LerpInterval):
|
|||
startHpr = node.getHpr()
|
||||
if (startScale == None):
|
||||
startScale = node.getScale()
|
||||
functor = PosHprScaleLerpFunctor.PosHprScaleLerpFunctor(
|
||||
functor = PosHprScaleLerpFunctor(
|
||||
node, startPos, pos, startHpr, hpr, startScale, scale)
|
||||
return functor
|
||||
|
||||
|
|
@ -241,6 +226,7 @@ class LerpFunctionInterval(Interval):
|
|||
# Interval counter
|
||||
lerpFunctionIntervalNum = 1
|
||||
# Class methods
|
||||
|
||||
def __init__(self, function, fromData = 0, toData = 1, duration = 0.0,
|
||||
blendType = 'noBlend', extraArgs = [], name = None):
|
||||
"""__init__(function, duration, fromData, toData, name)
|
||||
|
|
@ -258,6 +244,7 @@ class LerpFunctionInterval(Interval):
|
|||
LerpFunctionInterval.lerpFunctionIntervalNum += 1
|
||||
# Initialize superclass
|
||||
Interval.__init__(self, name, duration)
|
||||
|
||||
def updateFunc(self, t, event = IVAL_NONE):
|
||||
""" updateFunc(t, event)
|
||||
"""
|
||||
|
|
@ -275,20 +262,20 @@ class LerpFunctionInterval(Interval):
|
|||
except ZeroDivisionError:
|
||||
# Zero duration, just use endpoint
|
||||
apply(self.function, [self.toData] + self.extraArgs)
|
||||
|
||||
def getBlend(self, blendType):
|
||||
"""__getBlend(self, string)
|
||||
Return the C++ blend class corresponding to blendType string
|
||||
"""
|
||||
# Note, this is temporary until blend functions get exposed
|
||||
import LerpBlendHelpers
|
||||
if (blendType == "easeIn"):
|
||||
return LerpBlendHelpers.LerpBlendHelpers.easeIn
|
||||
return LerpBlendHelpers.easeIn
|
||||
elif (blendType == "easeOut"):
|
||||
return LerpBlendHelpers.LerpBlendHelpers.easeOut
|
||||
return LerpBlendHelpers.easeOut
|
||||
elif (blendType == "easeInOut"):
|
||||
return LerpBlendHelpers.LerpBlendHelpers.easeInOut
|
||||
return LerpBlendHelpers.easeInOut
|
||||
elif (blendType == "noBlend"):
|
||||
return LerpBlendHelpers.LerpBlendHelpers.noBlend
|
||||
return LerpBlendHelpers.noBlend
|
||||
else:
|
||||
raise Exception(
|
||||
'Error: LerpInterval.__getBlend: Unknown blend type')
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
"""LerpBlendHelpers module: contains LerpBlendHelpers class"""
|
||||
|
||||
from PandaModules import *
|
||||
class LerpBlendHelpers:
|
||||
|
||||
"""global lerp blend types for lerp function"""
|
||||
"""global lerp blend types for lerp function"""
|
||||
|
||||
easeIn = EaseInBlendType()
|
||||
easeIn = EaseInBlendType()
|
||||
|
||||
easeOut = EaseOutBlendType()
|
||||
easeOut = EaseOutBlendType()
|
||||
|
||||
easeInOut = EaseInOutBlendType()
|
||||
easeInOut = EaseInOutBlendType()
|
||||
|
||||
noBlend = NoBlendType()
|
||||
noBlend = NoBlendType()
|
||||
|
|
|
|||
Loading…
Reference in New Issue