*** empty log message ***
This commit is contained in:
parent
a06b37181c
commit
2e298544c8
|
|
@ -2,51 +2,21 @@
|
|||
|
||||
import Interval
|
||||
import Lerp
|
||||
import PosHprInterval
|
||||
|
||||
class LerpInterval(Interval.Interval):
|
||||
|
||||
# special methods
|
||||
|
||||
def __init__(self, name, node, duration, t0=0.0,
|
||||
type=Interval.PREVIOUS_END):
|
||||
"""__init__(name, node, duration, t0, type)
|
||||
def __init__(self, name, node, duration, functor, t0=0.0,
|
||||
type=Interval.PREVIOUS_END, blendType='noBlend'):
|
||||
"""__init__(name, node, duration, functor, t0, type, blendType)
|
||||
"""
|
||||
self.name = name
|
||||
self.node = node
|
||||
self.duration = duration
|
||||
self.startTime = t0
|
||||
self.type = type
|
||||
|
||||
class LerpPosHprInterval(LerpInterval):
|
||||
|
||||
def __init__(self, name, node, pos, hpr, duration, t0=0.0,
|
||||
type=Interval.PREVIOUS_END, other=None, blendType='noBlend'):
|
||||
""" __init__(name, node, pos, hpr, duration, t0, type, other,
|
||||
blendType)
|
||||
"""
|
||||
import PosHprLerpFunctor
|
||||
|
||||
LerpInterval.__init__(self, name, node, duration, t0, type)
|
||||
self.pos = pos
|
||||
self.hpr = hpr
|
||||
|
||||
if (other != None):
|
||||
# lerp wrt other
|
||||
startPos = self.node.getPos(other)
|
||||
startHpr = self.node.getHpr(other)
|
||||
functor = PosHprLerpFunctor.PosHprLerpFunctor(
|
||||
self.node, startPos, pos,
|
||||
startHpr, hpr, other)
|
||||
else:
|
||||
startPos = self.node.getPos()
|
||||
startHpr = self.node.getHpr()
|
||||
functor = PosHprLerpFunctor.PosHprLerpFunctor(
|
||||
self.node, startPos, pos,
|
||||
startHpr, hpr)
|
||||
|
||||
self.blendType = self.__getBlend(blendType)
|
||||
self.lerp = Lerp.Lerp(functor, self.duration, self.blendType)
|
||||
self.lerp = Lerp.Lerp(functor, duration, self.__getBlend(blendType))
|
||||
|
||||
def setT(self, t):
|
||||
""" setT(t)
|
||||
|
|
@ -72,4 +42,81 @@ class LerpPosHprInterval(LerpInterval):
|
|||
elif (blendType == "noBlend"):
|
||||
return LerpBlendHelpers.LerpBlendHelpers.noBlend
|
||||
else:
|
||||
raise Exception("Error: NodePath.__getBlend: Unknown blend type")
|
||||
raise Exception(
|
||||
'Error: LerpInterval.__getBlend: Unknown blend type')
|
||||
|
||||
class LerpPosHprInterval(LerpInterval):
|
||||
|
||||
def __init__(self, name, node, pos, hpr, duration, t0=0.0,
|
||||
type=Interval.PREVIOUS_END, other=None, blendType='noBlend'):
|
||||
""" __init__(name, node, pos, hpr, duration, t0, type, other,
|
||||
blendType)
|
||||
"""
|
||||
import PosHprLerpFunctor
|
||||
|
||||
self.node = node
|
||||
self.pos = pos
|
||||
self.hpr = hpr
|
||||
if (other != None):
|
||||
# lerp wrt other
|
||||
startPos = self.node.getPos(other)
|
||||
startHpr = self.node.getHpr(other)
|
||||
functor = PosHprLerpFunctor.PosHprLerpFunctor(
|
||||
self.node, startPos, pos,
|
||||
startHpr, hpr, other)
|
||||
else:
|
||||
startPos = self.node.getPos()
|
||||
startHpr = self.node.getHpr()
|
||||
functor = PosHprLerpFunctor.PosHprLerpFunctor(
|
||||
self.node, startPos, pos,
|
||||
startHpr, hpr)
|
||||
|
||||
LerpInterval.__init__(self, name, node, duration, functor, t0,
|
||||
type, blendType)
|
||||
|
||||
|
||||
class LerpPosInterval(LerpInterval):
|
||||
|
||||
def __init__(self, name, node, pos, duration, t0=0.0,
|
||||
type=Interval.PREVIOUS_END, other=None, blendType='noBlend'):
|
||||
""" __init__(name, node, pos, duration, t0, type, other, blendType)
|
||||
"""
|
||||
import PosLerpFunctor
|
||||
|
||||
self.node = node
|
||||
self.pos = pos
|
||||
if (other != None):
|
||||
# lerp wrt other
|
||||
startPos = self.node.getPos(other)
|
||||
functor = PosLerpFunctor.PosLerpFunctor(
|
||||
self.node, startPos, pos, other)
|
||||
else:
|
||||
startPos = self.node.getPos()
|
||||
functor = PosLerpFunctor.PosLerpFunctor(
|
||||
self.node, startPos, pos)
|
||||
|
||||
LerpInterval.__init__(self, name, node, duration, functor, t0,
|
||||
type, blendType)
|
||||
|
||||
class LerpHprInterval(LerpInterval):
|
||||
|
||||
def __init__(self, name, node, hpr, duration, t0=0.0,
|
||||
type=Interval.PREVIOUS_END, other=None, blendType='noBlend'):
|
||||
""" __init__(name, node, hpr, duration, t0, type, other, blendType)
|
||||
"""
|
||||
import HprLerpFunctor
|
||||
|
||||
self.node = node
|
||||
self.hpr = hpr
|
||||
if (other != None):
|
||||
# lerp wrt other
|
||||
startHpr = self.node.getHpr(other)
|
||||
functor = HprLerpFunctor.HprLerpFunctor(
|
||||
self.node, startHpr, hpr, other)
|
||||
else:
|
||||
startHpr = self.node.getHpr()
|
||||
functor = HprLerpFunctor.HprLerpFunctor(
|
||||
self.node, startHpr, hpr)
|
||||
|
||||
LerpInterval.__init__(self, name, node, duration, functor, t0,
|
||||
type, blendType)
|
||||
|
|
|
|||
|
|
@ -25,3 +25,45 @@ class PosHprInterval(Interval.Interval):
|
|||
Go to time t
|
||||
"""
|
||||
self.node.setPosHpr(self.pos, self.hpr)
|
||||
|
||||
class PosInterval(Interval.Interval):
|
||||
|
||||
# special methods
|
||||
|
||||
def __init__(self, name, node, pos, duration, t0=0.0,
|
||||
type=Interval.PREVIOUS_END):
|
||||
"""__init__(name, node, pos, duration, t0, type)
|
||||
"""
|
||||
self.name = name
|
||||
self.node = node
|
||||
self.pos = pos
|
||||
self.duration = duration
|
||||
self.startTime = t0
|
||||
self.type = type
|
||||
|
||||
def setT(self, t):
|
||||
""" setT(t)
|
||||
Go to time t
|
||||
"""
|
||||
self.node.setPos(self.pos)
|
||||
|
||||
class HprInterval(Interval.Interval):
|
||||
|
||||
# special methods
|
||||
|
||||
def __init__(self, name, node, hpr, duration, t0=0.0,
|
||||
type=Interval.PREVIOUS_END):
|
||||
"""__init__(name, node, hpr, duration, t0, type)
|
||||
"""
|
||||
self.name = name
|
||||
self.node = node
|
||||
self.hpr = hpr
|
||||
self.duration = duration
|
||||
self.startTime = t0
|
||||
self.type = type
|
||||
|
||||
def setT(self, t):
|
||||
""" setT(t)
|
||||
Go to time t
|
||||
"""
|
||||
self.node.setHpr(self.hpr)
|
||||
|
|
|
|||
Loading…
Reference in New Issue