mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
*** empty log message ***
This commit is contained in:
parent
5e4835f8b6
commit
1f5e16730d
@ -126,19 +126,27 @@
|
|||||||
raise Exception("Error: NodePath.__getBlend: Unknown blend type")
|
raise Exception("Error: NodePath.__getBlend: Unknown blend type")
|
||||||
|
|
||||||
|
|
||||||
def __lerp(self, functor, time, blendType, taskName=None):
|
def __lerp(self, functorFunc, duration, blendType, taskName=None):
|
||||||
"""__lerp(self, functor, float, string, string)
|
"""
|
||||||
|
__lerp(self, functorFunc, float, string, string)
|
||||||
Basic lerp functionality used by other lerps.
|
Basic lerp functionality used by other lerps.
|
||||||
Fire off a lerp. Make it a task if taskName given."""
|
Fire off a lerp. Make it a task if taskName given.
|
||||||
import Lerp
|
"""
|
||||||
# make the lerp
|
# functorFunc is a function which can be called to create a functor.
|
||||||
lerp = Lerp.Lerp(functor, time, (self.__getBlend(blendType)))
|
# functor creation is defered so initial state (sampled in functorFunc)
|
||||||
|
# will be appropriate for the time the lerp is spawned
|
||||||
from TaskManagerGlobal import *
|
from TaskManagerGlobal import *
|
||||||
|
|
||||||
# make the task function
|
# make the task function
|
||||||
def lerpTaskFunc(task):
|
def lerpTaskFunc(task):
|
||||||
|
import Lerp
|
||||||
import Task
|
import Task
|
||||||
import ClockObject
|
import ClockObject
|
||||||
|
if task.init == 1:
|
||||||
|
# make the lerp
|
||||||
|
functor = task.functorFunc()
|
||||||
|
task.lerp = Lerp.Lerp(functor, task.duration, task.blendType)
|
||||||
|
task.init = 0
|
||||||
dt = ClockObject.ClockObject.getGlobalClock().getDt()
|
dt = ClockObject.ClockObject.getGlobalClock().getDt()
|
||||||
task.lerp.setStepSize(dt)
|
task.lerp.setStepSize(dt)
|
||||||
task.lerp.step()
|
task.lerp.step()
|
||||||
@ -146,10 +154,13 @@
|
|||||||
return(Task.done)
|
return(Task.done)
|
||||||
else:
|
else:
|
||||||
return(Task.cont)
|
return(Task.cont)
|
||||||
|
|
||||||
# make the lerp task
|
# make the lerp task
|
||||||
lerpTask = Task.Task(lerpTaskFunc)
|
lerpTask = Task.Task(lerpTaskFunc)
|
||||||
lerpTask.lerp = lerp
|
lerpTask.init = 1
|
||||||
|
lerpTask.functorFunc = functorFunc
|
||||||
|
lerpTask.duration = duration
|
||||||
|
lerpTask.blendType = self.__getBlend(blendType)
|
||||||
|
|
||||||
if (taskName == None):
|
if (taskName == None):
|
||||||
# don't spawn a task, return one instead
|
# don't spawn a task, return one instead
|
||||||
@ -159,7 +170,7 @@
|
|||||||
taskMgr.spawnTaskNamed(lerpTask, taskName)
|
taskMgr.spawnTaskNamed(lerpTask, taskName)
|
||||||
return lerpTask
|
return lerpTask
|
||||||
|
|
||||||
def __autoLerp(self, functor, time, blendType, taskName):
|
def __autoLerp(self, functorFunc, time, blendType, taskName):
|
||||||
"""_autoLerp(self, functor, float, string, string)
|
"""_autoLerp(self, functor, float, string, string)
|
||||||
This lerp uses C++ to handle the stepping. Bonus is
|
This lerp uses C++ to handle the stepping. Bonus is
|
||||||
its more efficient, trade-off is there is less control"""
|
its more efficient, trade-off is there is less control"""
|
||||||
@ -167,6 +178,7 @@
|
|||||||
from ShowBaseGlobal import *
|
from ShowBaseGlobal import *
|
||||||
|
|
||||||
# make a lerp that lives in C++ land
|
# make a lerp that lives in C++ land
|
||||||
|
functor = functorFunc()
|
||||||
lerp = AutonomousLerp.AutonomousLerp(functor, time,
|
lerp = AutonomousLerp.AutonomousLerp(functor, time,
|
||||||
self.__getBlend(blendType),
|
self.__getBlend(blendType),
|
||||||
base.eventHandler)
|
base.eventHandler)
|
||||||
@ -192,75 +204,88 @@
|
|||||||
raise Exception("Error: NodePath.lerpColor: bad number of args")
|
raise Exception("Error: NodePath.lerpColor: bad number of args")
|
||||||
|
|
||||||
|
|
||||||
def lerpColorRGBA(self, r, g, b, a, time, blendType="noBlend",
|
def lerpColorRGBA(self, r, g, b, a, time,
|
||||||
auto=None, task=None):
|
blendType="noBlend", auto=None, task=None):
|
||||||
"""lerpColorRGBA(self, float, float, float, float, float,
|
"""lerpColorRGBA(self, float, float, float, float, float,
|
||||||
string="noBlend", string=none, string=none)
|
string="noBlend", string=none, string=none)
|
||||||
"""
|
"""
|
||||||
import ColorLerpFunctor
|
def functorFunc(self = self, r = r, g = g, b = b, a = a):
|
||||||
# just end rgba values, use current color rgba values for start
|
import ColorLerpFunctor
|
||||||
startColor = self.getColor()
|
# just end rgba values, use current color rgba values for start
|
||||||
functor = ColorLerpFunctor.ColorLerpFunctor(self,
|
startColor = self.getColor()
|
||||||
startColor[0], startColor[1],
|
functor = ColorLerpFunctor.ColorLerpFunctor(
|
||||||
startColor[2], startColor[3],
|
self,
|
||||||
r, g, b, a)
|
startColor[0], startColor[1],
|
||||||
|
startColor[2], startColor[3],
|
||||||
|
r, g, b, a)
|
||||||
|
return functor
|
||||||
#determine whether to use auto, spawned, or blocking lerp
|
#determine whether to use auto, spawned, or blocking lerp
|
||||||
if (auto != None):
|
if (auto != None):
|
||||||
return self.__autoLerp(functor, time, blendType, auto)
|
return self.__autoLerp(functorFunc, time, blendType, auto)
|
||||||
elif (task != None):
|
elif (task != None):
|
||||||
return self.__lerp(functor, time, blendType, task)
|
return self.__lerp(functorFunc, time, blendType, task)
|
||||||
else:
|
else:
|
||||||
return self.__lerp(functor, time, blendType)
|
return self.__lerp(functorFunc, time, blendType)
|
||||||
|
|
||||||
def lerpColorRGBARGBA(self, sr, sg, sb, sa, er, eg, eb, ea, time,
|
def lerpColorRGBARGBA(self, sr, sg, sb, sa, er, eg, eb, ea, time,
|
||||||
blendType="noBlend", auto=None, task=None):
|
blendType="noBlend", auto=None, task=None):
|
||||||
"""lerpColorRGBARGBA(self, float, float, float, float, float,
|
"""lerpColorRGBARGBA(self, float, float, float, float, float,
|
||||||
float, float, float, float, string="noBlend", string=none, string=none)
|
float, float, float, float, string="noBlend", string=none, string=none)
|
||||||
"""
|
"""
|
||||||
import ColorLerpFunctor
|
def functorFunc(self = self, sr = sr, sg = sg, sb = sb, sa = sa,
|
||||||
# start and end rgba values
|
er = er, eg = eg, eb = eb, ea = ea):
|
||||||
functor = ColorLerpFunctor.ColorLerpFunctor(self, sr, sg, sb, sa,
|
import ColorLerpFunctor
|
||||||
er, eg, eb, ea)
|
# start and end rgba values
|
||||||
|
functor = ColorLerpFunctor.ColorLerpFunctor(self, sr, sg, sb, sa,
|
||||||
|
er, eg, eb, ea)
|
||||||
|
return functor
|
||||||
#determine whether to use auto, spawned, or blocking lerp
|
#determine whether to use auto, spawned, or blocking lerp
|
||||||
if (auto != None):
|
if (auto != None):
|
||||||
return self.__autoLerp(functor, time, blendType, auto)
|
return self.__autoLerp(functorFunc, time, blendType, auto)
|
||||||
elif (task != None):
|
elif (task != None):
|
||||||
return self.__lerp(functor, time, blendType, task)
|
return self.__lerp(functorFunc, time, blendType, task)
|
||||||
else:
|
else:
|
||||||
return self.__lerp(functor, time, blendType)
|
return self.__lerp(functorFunc, time, blendType)
|
||||||
|
|
||||||
def lerpColorVBase4(self, endColor, time, blendType="noBlend",
|
def lerpColorVBase4(self, endColor, time,
|
||||||
auto=None, task=None):
|
blendType="noBlend", auto=None, task=None):
|
||||||
"""lerpColorVBase4(self, VBase4, float, string="noBlend", string=none,
|
"""lerpColorVBase4(self, VBase4, float, string="noBlend", string=none,
|
||||||
string=none)
|
string=none)
|
||||||
"""
|
"""
|
||||||
import ColorLerpFunctor
|
def functorFunc(self = self, endColor = endColor):
|
||||||
# just end vec4, use current color for start
|
import ColorLerpFunctor
|
||||||
startColor = self.getColor()
|
# just end vec4, use current color for start
|
||||||
functor = ColorLerpFunctor.ColorLerpFunctor(self, startColor, endColor)
|
startColor = self.getColor()
|
||||||
|
functor = ColorLerpFunctor.ColorLerpFunctor(
|
||||||
|
self, startColor, endColor)
|
||||||
|
return functor
|
||||||
#determine whether to use auto, spawned, or blocking lerp
|
#determine whether to use auto, spawned, or blocking lerp
|
||||||
if (auto != None):
|
if (auto != None):
|
||||||
return self.__autoLerp(functor, time, blendType, auto)
|
return self.__autoLerp(functorFunc, time, blendType, auto)
|
||||||
elif (task != None):
|
elif (task != None):
|
||||||
return self.__lerp(functor, time, blendType, task)
|
return self.__lerp(functorFunc, time, blendType, task)
|
||||||
else:
|
else:
|
||||||
return self.__lerp(functor, time, blendType)
|
return self.__lerp(functorFunc, time, blendType)
|
||||||
|
|
||||||
def lerpColorVBase4VBase4(self, startColor, endColor, time,
|
def lerpColorVBase4VBase4(self, startColor, endColor, time,
|
||||||
blendType="noBlend", auto=None, task=None):
|
blendType="noBlend", auto=None, task=None):
|
||||||
"""lerpColorVBase4VBase4(self, VBase4, VBase4, float, string="noBlend",
|
"""lerpColorVBase4VBase4(self, VBase4, VBase4, float, string="noBlend",
|
||||||
string=none, string=none)
|
string=none, string=none)
|
||||||
"""
|
"""
|
||||||
import ColorLerpFunctor
|
def functorFunc(self = self, startColor = startColor,
|
||||||
# start color and end vec
|
endColor = endColor):
|
||||||
functor = ColorLerpFunctor.ColorLerpFunctor(self, startColor, endColor)
|
import ColorLerpFunctor
|
||||||
|
# start color and end vec
|
||||||
|
functor = ColorLerpFunctor.ColorLerpFunctor(
|
||||||
|
self, startColor, endColor)
|
||||||
|
return functor
|
||||||
#determine whether to use auto, spawned, or blocking lerp
|
#determine whether to use auto, spawned, or blocking lerp
|
||||||
if (auto != None):
|
if (auto != None):
|
||||||
return self.__autoLerp(functor, time, blendType, auto)
|
return self.__autoLerp(functorFunc, time, blendType, auto)
|
||||||
elif (task != None):
|
elif (task != None):
|
||||||
return self.__lerp(functor, time, blendType, task)
|
return self.__lerp(functorFunc, time, blendType, task)
|
||||||
else:
|
else:
|
||||||
return self.__lerp(functor, time, blendType)
|
return self.__lerp(functorFunc, time, blendType)
|
||||||
|
|
||||||
|
|
||||||
def lerpHpr(self, *posArgs, **keyArgs):
|
def lerpHpr(self, *posArgs, **keyArgs):
|
||||||
@ -278,56 +303,61 @@
|
|||||||
# bad args
|
# bad args
|
||||||
raise Exception("Error: NodePath.lerpHpr: bad number of args")
|
raise Exception("Error: NodePath.lerpHpr: bad number of args")
|
||||||
|
|
||||||
def lerpHprHPR(self, h, p, r, time, blendType="noBlend", auto=None,
|
def lerpHprHPR(self, h, p, r, time, other=None,
|
||||||
task=None, other=None):
|
blendType="noBlend", auto=None, task=None):
|
||||||
"""lerpHprHPR(self, float, float, float, float, string="noBlend",
|
"""lerpHprHPR(self, float, float, float, float, string="noBlend",
|
||||||
string=none, string=none, NodePath=none)
|
string=none, string=none, NodePath=none)
|
||||||
Perform a hpr lerp with three floats as the end point
|
Perform a hpr lerp with three floats as the end point
|
||||||
"""
|
"""
|
||||||
import HprLerpFunctor
|
def functorFunc(self = self, h = h, p = p, r = r, other = other):
|
||||||
# it's individual hpr components
|
import HprLerpFunctor
|
||||||
if (other != None):
|
# it's individual hpr components
|
||||||
# lerp wrt other
|
if (other != None):
|
||||||
startHpr = self.getHpr(other)
|
# lerp wrt other
|
||||||
functor = HprLerpFunctor.HprLerpFunctor(self,
|
startHpr = self.getHpr(other)
|
||||||
startHpr[0], startHpr[1], startHpr[2],
|
functor = HprLerpFunctor.HprLerpFunctor(
|
||||||
h, p, r, other)
|
self,
|
||||||
else:
|
startHpr[0], startHpr[1], startHpr[2],
|
||||||
startHpr = self.getHpr()
|
h, p, r, other)
|
||||||
functor = HprLerpFunctor.HprLerpFunctor(self,
|
else:
|
||||||
startHpr[0], startHpr[1], startHpr[2],
|
startHpr = self.getHpr()
|
||||||
h, p, r)
|
functor = HprLerpFunctor.HprLerpFunctor(
|
||||||
|
self,
|
||||||
|
startHpr[0], startHpr[1], startHpr[2],
|
||||||
|
h, p, r)
|
||||||
|
return functor
|
||||||
#determine whether to use auto, spawned, or blocking lerp
|
#determine whether to use auto, spawned, or blocking lerp
|
||||||
if (auto != None):
|
if (auto != None):
|
||||||
return self.__autoLerp(functor, time, blendType, auto)
|
return self.__autoLerp(functorFunc, time, blendType, auto)
|
||||||
elif (task != None):
|
elif (task != None):
|
||||||
return self.__lerp(functor, time, blendType, task)
|
return self.__lerp(functorFunc, time, blendType, task)
|
||||||
else:
|
else:
|
||||||
return self.__lerp(functor, time, blendType)
|
return self.__lerp(functorFunc, time, blendType)
|
||||||
|
|
||||||
|
|
||||||
def lerpHprVBase3(self, hpr, time, blendType="noBlend", auto=None,
|
def lerpHprVBase3(self, hpr, time, other=None,
|
||||||
task=None, other=None):
|
blendType="noBlend", auto=None, task=None):
|
||||||
"""lerpHprVBase3(self, VBase3, float, string="noBlend", string=none,
|
"""lerpHprVBase3(self, VBase3, float, string="noBlend", string=none,
|
||||||
string=none, NodePath=None)
|
string=none, NodePath=None)
|
||||||
Perform a hpr lerp with a VBase3 as the end point
|
Perform a hpr lerp with a VBase3 as the end point
|
||||||
"""
|
"""
|
||||||
import HprLerpFunctor
|
def functorFunc(self = self, hpr = hpr, other = other):
|
||||||
# it's a vbase3 hpr
|
import HprLerpFunctor
|
||||||
if (other != None):
|
# it's a vbase3 hpr
|
||||||
# lerp wrt other
|
if (other != None):
|
||||||
functor = HprLerpFunctor.HprLerpFunctor(self, (self.getHpr(other)),
|
# lerp wrt other
|
||||||
hpr, other)
|
functor = HprLerpFunctor.HprLerpFunctor(
|
||||||
else:
|
self, (self.getHpr(other)), hpr, other)
|
||||||
functor = HprLerpFunctor.HprLerpFunctor(self, (self.getHpr()),
|
else:
|
||||||
hpr)
|
functor = HprLerpFunctor.HprLerpFunctor(
|
||||||
|
self, (self.getHpr()), hpr)
|
||||||
|
return functor
|
||||||
#determine whether to use auto, spawned, or blocking lerp
|
#determine whether to use auto, spawned, or blocking lerp
|
||||||
if (auto != None):
|
if (auto != None):
|
||||||
return self.__autoLerp(functor, time, blendType, auto)
|
return self.__autoLerp(functorFunc, time, blendType, auto)
|
||||||
elif (task != None):
|
elif (task != None):
|
||||||
return self.__lerp(functor, time, blendType, task)
|
return self.__lerp(functorFunc, time, blendType, task)
|
||||||
else:
|
else:
|
||||||
return self.__lerp(functor, time, blendType)
|
return self.__lerp(functorFunc, time, blendType)
|
||||||
|
|
||||||
|
|
||||||
def lerpPos(self, *posArgs, **keyArgs):
|
def lerpPos(self, *posArgs, **keyArgs):
|
||||||
@ -345,51 +375,56 @@
|
|||||||
# bad number off args
|
# bad number off args
|
||||||
raise Exception("Error: NodePath.lerpPos: bad number of args")
|
raise Exception("Error: NodePath.lerpPos: bad number of args")
|
||||||
|
|
||||||
def lerpPosXYZ(self, x, y, z, time, blendType="noBlend", auto=None,
|
def lerpPosXYZ(self, x, y, z, time, other=None,
|
||||||
task=None, other=None):
|
blendType="noBlend", auto=None, task=None):
|
||||||
"""lerpPosXYZ(self, float, float, float, float, string="noBlend",
|
"""lerpPosXYZ(self, float, float, float, float, string="noBlend",
|
||||||
string=None, NodePath=None)
|
string=None, NodePath=None)
|
||||||
Perform a pos lerp with three floats as the end point
|
Perform a pos lerp with three floats as the end point
|
||||||
"""
|
"""
|
||||||
import PosLerpFunctor
|
def functorFunc(self = self, x = x, y = y, z = z, other = other):
|
||||||
if (other != None):
|
import PosLerpFunctor
|
||||||
# lerp wrt other
|
if (other != None):
|
||||||
startPos = self.getPos(other)
|
# lerp wrt other
|
||||||
functor = PosLerpFunctor.PosLerpFunctor(self,
|
startPos = self.getPos(other)
|
||||||
startPos[0], startPos[1], startPos[2],
|
functor = PosLerpFunctor.PosLerpFunctor(self,
|
||||||
x, y, z, other)
|
startPos[0], startPos[1], startPos[2],
|
||||||
else:
|
x, y, z, other)
|
||||||
startPos = self.getPos()
|
else:
|
||||||
functor = PosLerpFunctor.PosLerpFunctor(self, startPos[0],
|
startPos = self.getPos()
|
||||||
startPos[1], startPos[2], x, y, z)
|
functor = PosLerpFunctor.PosLerpFunctor(self, startPos[0],
|
||||||
|
startPos[1], startPos[2], x, y, z)
|
||||||
|
return functor
|
||||||
#determine whether to use auto, spawned, or blocking lerp
|
#determine whether to use auto, spawned, or blocking lerp
|
||||||
if (auto != None):
|
if (auto != None):
|
||||||
return self.__autoLerp(functor, time, blendType, auto)
|
return self.__autoLerp(functorFunc, time, blendType, auto)
|
||||||
elif (task != None):
|
elif (task != None):
|
||||||
return self.__lerp(functor, time, blendType, task)
|
return self.__lerp(functorFunc, time, blendType, task)
|
||||||
else:
|
else:
|
||||||
return self.__lerp(functor, time, blendType)
|
return self.__lerp(functorFunc, time, blendType)
|
||||||
|
|
||||||
def lerpPosPoint3(self, pos, time, blendType="noBlend", auto=None,
|
def lerpPosPoint3(self, pos, time, other=None,
|
||||||
task=None, other=None):
|
blendType="noBlend", auto=None, task=None):
|
||||||
"""lerpPosPoint3(self, Point3, float, string="noBlend", string=None,
|
"""lerpPosPoint3(self, Point3, float, string="noBlend", string=None,
|
||||||
string=None, NodePath=None)
|
string=None, NodePath=None)
|
||||||
Perform a pos lerp with a Point3 as the end point
|
Perform a pos lerp with a Point3 as the end point
|
||||||
"""
|
"""
|
||||||
import PosLerpFunctor
|
def functorFunc(self = self, pos = pos, other = other):
|
||||||
if (other != None):
|
import PosLerpFunctor
|
||||||
#lerp wrt other
|
if (other != None):
|
||||||
functor = PosLerpFunctor.PosLerpFunctor(self, (self.getPos(other)),
|
#lerp wrt other
|
||||||
pos, other)
|
functor = PosLerpFunctor.PosLerpFunctor(
|
||||||
else:
|
self, (self.getPos(other)), pos, other)
|
||||||
functor = PosLerpFunctor.PosLerpFunctor(self, (self.getPos()), pos)
|
else:
|
||||||
|
functor = PosLerpFunctor.PosLerpFunctor(
|
||||||
|
self, (self.getPos()), pos)
|
||||||
|
return functor
|
||||||
#determine whether to use auto, spawned, or blocking lerp
|
#determine whether to use auto, spawned, or blocking lerp
|
||||||
if (auto != None):
|
if (auto != None):
|
||||||
return self.__autoLerp(functor, time, blendType, auto)
|
return self.__autoLerp(functorFunc, time, blendType, auto)
|
||||||
elif (task != None):
|
elif (task != None):
|
||||||
return self.__lerp(functor, time, blendType, task)
|
return self.__lerp(functorFunc, time, blendType, task)
|
||||||
else:
|
else:
|
||||||
return self.__lerp(functor, time, blendType)
|
return self.__lerp(functorFunc, time, blendType)
|
||||||
|
|
||||||
|
|
||||||
def lerpPosHpr(self, *posArgs, **keyArgs):
|
def lerpPosHpr(self, *posArgs, **keyArgs):
|
||||||
@ -407,99 +442,107 @@
|
|||||||
# bad number off args
|
# bad number off args
|
||||||
raise Exception("Error: NodePath.lerpPosHpr: bad number of args")
|
raise Exception("Error: NodePath.lerpPosHpr: bad number of args")
|
||||||
|
|
||||||
def lerpPosHprPoint3VBase3(self, pos, hpr, time, blendType="noBlend",
|
def lerpPosHprPoint3VBase3(self, pos, hpr, time, other=None,
|
||||||
auto=None, task=None, other=None):
|
blendType="noBlend", auto=None, task=None):
|
||||||
"""lerpPosHprPoint3VBase3(self, Point3, VBase3, string="noBlend",
|
"""lerpPosHprPoint3VBase3(self, Point3, VBase3, string="noBlend",
|
||||||
string=none, string=none, NodePath=None)
|
string=none, string=none, NodePath=None)
|
||||||
"""
|
"""
|
||||||
import PosHprLerpFunctor
|
def functorFunc(self = self, pos = pos, hpr = hpr, other = other):
|
||||||
if (other != None):
|
import PosHprLerpFunctor
|
||||||
# lerp wrt other
|
if (other != None):
|
||||||
startPos = self.getPos(other)
|
# lerp wrt other
|
||||||
startHpr = self.getHpr(other)
|
startPos = self.getPos(other)
|
||||||
functor = PosHprLerpFunctor.PosHprLerpFunctor(self,
|
startHpr = self.getHpr(other)
|
||||||
startPos, pos,
|
functor = PosHprLerpFunctor.PosHprLerpFunctor(
|
||||||
startHpr, hpr, other)
|
self, startPos, pos,
|
||||||
else:
|
startHpr, hpr, other)
|
||||||
startPos = self.getPos()
|
else:
|
||||||
startHpr = self.getHpr()
|
startPos = self.getPos()
|
||||||
functor = PosHprLerpFunctor.PosHprLerpFunctor(self,
|
startHpr = self.getHpr()
|
||||||
startPos, pos,
|
functor = PosHprLerpFunctor.PosHprLerpFunctor(
|
||||||
startHpr, hpr)
|
self, startPos, pos,
|
||||||
|
startHpr, hpr)
|
||||||
|
return functor
|
||||||
#determine whether to use auto, spawned, or blocking lerp
|
#determine whether to use auto, spawned, or blocking lerp
|
||||||
if (auto != None):
|
if (auto != None):
|
||||||
return self.__autoLerp(functor, time, blendType, auto)
|
return self.__autoLerp(functorFunc, time, blendType, auto)
|
||||||
elif (task != None):
|
elif (task != None):
|
||||||
return self.__lerp(functor, time, blendType, task)
|
return self.__lerp(functorFunc, time, blendType, task)
|
||||||
else:
|
else:
|
||||||
return self.__lerp(functor, time, blendType)
|
return self.__lerp(functorFunc, time, blendType)
|
||||||
|
|
||||||
def lerpPosHprXYZHPR(self, x, y, z, h, p, r, time, blendType="noBlend",
|
def lerpPosHprXYZHPR(self, x, y, z, h, p, r, time, other=None,
|
||||||
auto=None, task=None, other=None):
|
blendType="noBlend", auto=None, task=None):
|
||||||
"""lerpPosHpr(self, float, string="noBlend", string=none,
|
"""lerpPosHpr(self, float, string="noBlend", string=none,
|
||||||
string=none, NodePath=None)
|
string=none, NodePath=None)
|
||||||
"""
|
"""
|
||||||
import PosHprLerpFunctor
|
def functorFunc(self = self, x = x, y = y, z = z,
|
||||||
if (other != None):
|
h = h, p = p, r = r, other = other):
|
||||||
# lerp wrt other
|
import PosHprLerpFunctor
|
||||||
startPos = self.getPos(other)
|
if (other != None):
|
||||||
startHpr = self.getHpr(other)
|
# lerp wrt other
|
||||||
functor = PosHprLerpFunctor.PosHprLerpFunctor(self,
|
startPos = self.getPos(other)
|
||||||
startPos[0], startPos[1],
|
startHpr = self.getHpr(other)
|
||||||
startPos[2], x, y, z,
|
functor = PosHprLerpFunctor.PosHprLerpFunctor(self,
|
||||||
startHpr[0], startHpr[1],
|
startPos[0], startPos[1],
|
||||||
startHpr[2], h, p, r,
|
startPos[2], x, y, z,
|
||||||
other)
|
startHpr[0], startHpr[1],
|
||||||
else:
|
startHpr[2], h, p, r,
|
||||||
startPos = self.getPos()
|
other)
|
||||||
startHpr = self.getHpr()
|
else:
|
||||||
functor = PosHprLerpFunctor.PosHprLerpFunctor(self,
|
startPos = self.getPos()
|
||||||
startPos[0], startPos[1],
|
startHpr = self.getHpr()
|
||||||
startPos[2], x, y, z,
|
functor = PosHprLerpFunctor.PosHprLerpFunctor(self,
|
||||||
startHpr[0], startHpr[1],
|
startPos[0], startPos[1],
|
||||||
startHpr[2], h, p, r)
|
startPos[2], x, y, z,
|
||||||
|
startHpr[0], startHpr[1],
|
||||||
|
startHpr[2], h, p, r)
|
||||||
|
return functor
|
||||||
#determine whether to use auto, spawned, or blocking lerp
|
#determine whether to use auto, spawned, or blocking lerp
|
||||||
if (auto != None):
|
if (auto != None):
|
||||||
return self.__autoLerp(functor, time, blendType, auto)
|
return self.__autoLerp(functorFunc, time, blendType, auto)
|
||||||
elif (task != None):
|
elif (task != None):
|
||||||
return self.__lerp(functor, time, blendType, task)
|
return self.__lerp(functorFunc, time, blendType, task)
|
||||||
else:
|
else:
|
||||||
return self.__lerp(functor, time, blendType)
|
return self.__lerp(functorFunc, time, blendType)
|
||||||
|
|
||||||
|
|
||||||
def lerpPosHprScale(self, pos, hpr, scale, time, blendType="noBlend",
|
def lerpPosHprScale(self, pos, hpr, scale, time, other=None,
|
||||||
auto=None, task=None, other=None):
|
blendType="noBlend", auto=None, task=None):
|
||||||
"""lerpPosHpr(self, Point3, VBase3, float, float, string="noBlend",
|
"""lerpPosHpr(self, Point3, VBase3, float, float, string="noBlend",
|
||||||
string=none, string=none, NodePath=None)
|
string=none, string=none, NodePath=None)
|
||||||
Only one case, no need for extra args. Call the appropriate lerp
|
Only one case, no need for extra args. Call the appropriate lerp
|
||||||
(auto, spawned, or blocking) based on how(if) a task name is given
|
(auto, spawned, or blocking) based on how(if) a task name is given
|
||||||
"""
|
"""
|
||||||
import PosHprScaleLerpFunctor
|
def functorFunc(self = self, pos = pos, hpr = hpr,
|
||||||
if (other != None):
|
scale = scale, other = other):
|
||||||
# lerp wrt other
|
import PosHprScaleLerpFunctor
|
||||||
startPos = self.getPos(other)
|
if (other != None):
|
||||||
startHpr = self.getHpr(other)
|
# lerp wrt other
|
||||||
startScale = self.getScale(other)
|
startPos = self.getPos(other)
|
||||||
functor = PosHprScaleLerpFunctor.PosHprScaleLerpFunctor(self,
|
startHpr = self.getHpr(other)
|
||||||
startPos, pos,
|
startScale = self.getScale(other)
|
||||||
startHpr, hpr,
|
functor = PosHprScaleLerpFunctor.PosHprScaleLerpFunctor(self,
|
||||||
startScale, scale, other)
|
startPos, pos,
|
||||||
else:
|
startHpr, hpr,
|
||||||
startPos = self.getPos()
|
startScale, scale, other)
|
||||||
startHpr = self.getHpr()
|
else:
|
||||||
startScale = self.getScale()
|
startPos = self.getPos()
|
||||||
functor = PosHprScaleLerpFunctor.PosHprScaleLerpFunctor(self,
|
startHpr = self.getHpr()
|
||||||
startPos, pos,
|
startScale = self.getScale()
|
||||||
startHpr, hpr,
|
functor = PosHprScaleLerpFunctor.PosHprScaleLerpFunctor(self,
|
||||||
startScale, scale)
|
startPos, pos,
|
||||||
|
startHpr, hpr,
|
||||||
|
startScale, scale)
|
||||||
|
|
||||||
|
return functor
|
||||||
#determine whether to use auto, spawned, or blocking lerp
|
#determine whether to use auto, spawned, or blocking lerp
|
||||||
if (auto != None):
|
if (auto != None):
|
||||||
return self.__autoLerp(functor, time, blendType, auto)
|
return self.__autoLerp(functorFunc, time, blendType, auto)
|
||||||
elif (task != None):
|
elif (task != None):
|
||||||
return self.__lerp(functor, time, blendType, task)
|
return self.__lerp(functorFunc, time, blendType, task)
|
||||||
else:
|
else:
|
||||||
return self.__lerp(functor, time, blendType)
|
return self.__lerp(functorFunc, time, blendType)
|
||||||
|
|
||||||
|
|
||||||
def lerpScale(self, *posArgs, **keyArgs):
|
def lerpScale(self, *posArgs, **keyArgs):
|
||||||
@ -517,53 +560,57 @@
|
|||||||
# bad number off args
|
# bad number off args
|
||||||
raise Exception("Error: NodePath.lerpScale: bad number of args")
|
raise Exception("Error: NodePath.lerpScale: bad number of args")
|
||||||
|
|
||||||
def lerpScaleVBase3(self, scale, time, blendType="noBlend", auto=None,
|
def lerpScaleVBase3(self, scale, time, other=None,
|
||||||
task=None, other=None):
|
blendType="noBlend", auto=None, task=None):
|
||||||
"""lerpPos(self, VBase3, float, string="noBlend", string=none,
|
"""lerpPos(self, VBase3, float, string="noBlend", string=none,
|
||||||
string=none, NodePath=None)
|
string=none, NodePath=None)
|
||||||
"""
|
"""
|
||||||
import ScaleLerpFunctor
|
def functorFunc(self = self, scale = scale, other = other):
|
||||||
if (other != None):
|
import ScaleLerpFunctor
|
||||||
# lerp wrt other
|
if (other != None):
|
||||||
functor = ScaleLerpFunctor.ScaleLerpFunctor(self,
|
# lerp wrt other
|
||||||
(self.getScale(other)),
|
functor = ScaleLerpFunctor.ScaleLerpFunctor(self,
|
||||||
scale, other)
|
(self.getScale(other)),
|
||||||
else:
|
scale, other)
|
||||||
functor = ScaleLerpFunctor.ScaleLerpFunctor(self,
|
else:
|
||||||
(self.getScale()), scale)
|
functor = ScaleLerpFunctor.ScaleLerpFunctor(self,
|
||||||
|
(self.getScale()), scale)
|
||||||
|
|
||||||
|
return functor
|
||||||
#determine whether to use auto, spawned, or blocking lerp
|
#determine whether to use auto, spawned, or blocking lerp
|
||||||
if (auto != None):
|
if (auto != None):
|
||||||
return self.__autoLerp(functor, time, blendType, auto)
|
return self.__autoLerp(functorFunc, time, blendType, auto)
|
||||||
elif (task != None):
|
elif (task != None):
|
||||||
return self.__lerp(functor, time, blendType, task)
|
return self.__lerp(functorFunc, time, blendType, task)
|
||||||
else:
|
else:
|
||||||
return self.__lerp(functor, time, blendType)
|
return self.__lerp(functorFunc, time, blendType)
|
||||||
|
|
||||||
def lerpScaleXYZ(self, sx, sy, sz, time, blendType="noBlend",
|
def lerpScaleXYZ(self, sx, sy, sz, time, other=None,
|
||||||
auto=None, task=None, other=None):
|
blendType="noBlend", auto=None, task=None):
|
||||||
"""lerpPos(self, float, float, float, float, string="noBlend",
|
"""lerpPos(self, float, float, float, float, string="noBlend",
|
||||||
string=none, string=none, NodePath=None)
|
string=none, string=none, NodePath=None)
|
||||||
"""
|
"""
|
||||||
import ScaleLerpFunctor
|
def functorFunc(self = self, sx = sx, sy = sy, sz = sz, other = other):
|
||||||
if (other != None):
|
import ScaleLerpFunctor
|
||||||
# lerp wrt other
|
if (other != None):
|
||||||
startScale = self.getScale(other)
|
# lerp wrt other
|
||||||
functor = ScaleLerpFunctor.ScaleLerpFunctor(self,
|
startScale = self.getScale(other)
|
||||||
startScale[0], startScale[1],
|
functor = ScaleLerpFunctor.ScaleLerpFunctor(self,
|
||||||
startScale[2], sx, sy, sz, other)
|
startScale[0], startScale[1],
|
||||||
else:
|
startScale[2], sx, sy, sz, other)
|
||||||
startScale = self.getScale()
|
else:
|
||||||
functor = ScaleLerpFunctor.ScaleLerpFunctor(self,
|
startScale = self.getScale()
|
||||||
startScale[0], startScale[1],
|
functor = ScaleLerpFunctor.ScaleLerpFunctor(self,
|
||||||
startScale[2], sx, sy, sz)
|
startScale[0], startScale[1],
|
||||||
|
startScale[2], sx, sy, sz)
|
||||||
|
return functor
|
||||||
#determine whether to use auto, spawned, or blocking lerp
|
#determine whether to use auto, spawned, or blocking lerp
|
||||||
if (auto != None):
|
if (auto != None):
|
||||||
return self.__autoLerp(functor, time, blendType, auto)
|
return self.__autoLerp(functorFunc, time, blendType, auto)
|
||||||
elif (task != None):
|
elif (task != None):
|
||||||
return self.__lerp(functor, time, blendType, task)
|
return self.__lerp(functorFunc, time, blendType, task)
|
||||||
else:
|
else:
|
||||||
return self.__lerp(functor, time, blendType)
|
return self.__lerp(functorFunc, time, blendType)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user