mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-18 04:33:04 -04:00
drose added HprScale
This commit is contained in:
parent
1c58927483
commit
12fbeebc6f
@ -208,6 +208,29 @@ class PosHprInterval(FunctionInterval):
|
|||||||
# Create function interval
|
# Create function interval
|
||||||
FunctionInterval.__init__(self, posHprFunc, name = name)
|
FunctionInterval.__init__(self, posHprFunc, name = name)
|
||||||
|
|
||||||
|
class HprScaleInterval(FunctionInterval):
|
||||||
|
# HprScaleInterval counter
|
||||||
|
hprScaleIntervalNum = 1
|
||||||
|
# Initialization
|
||||||
|
def __init__(self, nodePath, hpr, scale, duration = 0.0,
|
||||||
|
name = None, other = None):
|
||||||
|
"""__init__(nodePath, hpr, scale, duration, other, name)
|
||||||
|
"""
|
||||||
|
# Create function
|
||||||
|
def hprScaleFunc(np=nodePath, hpr=hpr, scale=scale,
|
||||||
|
other = other):
|
||||||
|
if other:
|
||||||
|
np.setHprScale(other, hpr, scale)
|
||||||
|
else:
|
||||||
|
np.setHprScale(hpr, scale)
|
||||||
|
# Determine name
|
||||||
|
if (name == None):
|
||||||
|
name = ('HprScale-%d' %
|
||||||
|
HprScaleInterval.hprScaleIntervalNum)
|
||||||
|
HprScaleInterval.hprScaleIntervalNum += 1
|
||||||
|
# Create function interval
|
||||||
|
FunctionInterval.__init__(self, hprScaleFunc, name = name)
|
||||||
|
|
||||||
class PosHprScaleInterval(FunctionInterval):
|
class PosHprScaleInterval(FunctionInterval):
|
||||||
# PosHprScaleInterval counter
|
# PosHprScaleInterval counter
|
||||||
posHprScaleIntervalNum = 1
|
posHprScaleIntervalNum = 1
|
||||||
|
@ -100,7 +100,7 @@ class LerpHprInterval(LerpInterval):
|
|||||||
if (other != None):
|
if (other != None):
|
||||||
# lerp wrt other
|
# lerp wrt other
|
||||||
if (startHpr == None):
|
if (startHpr == None):
|
||||||
startHpr = node.getHpr(other)
|
startHpr = VBase3(node.getHpr(other))
|
||||||
functor = HprLerpFunctor(node, startHpr, hpr, other)
|
functor = HprLerpFunctor(node, startHpr, hpr, other)
|
||||||
else:
|
else:
|
||||||
if (startHpr == None):
|
if (startHpr == None):
|
||||||
@ -193,6 +193,53 @@ class LerpPosHprInterval(LerpInterval):
|
|||||||
# Initialize superclass
|
# Initialize superclass
|
||||||
LerpInterval.__init__(self, name, duration, functorFunc, blendType)
|
LerpInterval.__init__(self, name, duration, functorFunc, blendType)
|
||||||
|
|
||||||
|
class LerpHprScaleInterval(LerpInterval):
|
||||||
|
# Interval counter
|
||||||
|
lerpHprScaleNum = 1
|
||||||
|
# Class methods
|
||||||
|
def __init__(self, node, duration, hpr, scale,
|
||||||
|
startHpr=None, startScale=None,
|
||||||
|
other=None, blendType='noBlend', name=None):
|
||||||
|
""" __init__(node, duration, hpr, scale,
|
||||||
|
startHpr, startScale,
|
||||||
|
other, blendType, name)
|
||||||
|
"""
|
||||||
|
def functorFunc(node=node, hpr=hpr, scale=scale,
|
||||||
|
startHpr=startHpr,
|
||||||
|
startScale=startScale, other=other):
|
||||||
|
assert(not node.isEmpty())
|
||||||
|
if callable(hpr):
|
||||||
|
# This may be a thunk that returns a point.
|
||||||
|
hpr = hpr()
|
||||||
|
if callable(scale):
|
||||||
|
# This may be a thunk that returns a point.
|
||||||
|
scale = scale()
|
||||||
|
if (other != None):
|
||||||
|
# lerp wrt other
|
||||||
|
if (startHpr == None):
|
||||||
|
startHpr = node.getHpr(other)
|
||||||
|
if (startScale == None):
|
||||||
|
startScale = node.getScale(other)
|
||||||
|
functor = HprScaleLerpFunctor(
|
||||||
|
node, startHpr, hpr,
|
||||||
|
startScale, scale, other)
|
||||||
|
else:
|
||||||
|
if (startHpr == None):
|
||||||
|
startHpr = node.getHpr()
|
||||||
|
if (startScale == None):
|
||||||
|
startScale = node.getScale()
|
||||||
|
functor = HprScaleLerpFunctor(
|
||||||
|
node, startHpr, hpr, startScale, scale)
|
||||||
|
return functor
|
||||||
|
|
||||||
|
# Generate unique name if necessary
|
||||||
|
if (name == None):
|
||||||
|
name = ('LerpHprScale-%d' %
|
||||||
|
LerpHprScaleInterval.lerpHprScaleNum)
|
||||||
|
LerpHprScaleInterval.lerpHprScaleNum += 1
|
||||||
|
# Initialize superclass
|
||||||
|
LerpInterval.__init__(self, name, duration, functorFunc, blendType)
|
||||||
|
|
||||||
class LerpPosHprScaleInterval(LerpInterval):
|
class LerpPosHprScaleInterval(LerpInterval):
|
||||||
# Interval counter
|
# Interval counter
|
||||||
lerpPosHprScaleNum = 1
|
lerpPosHprScaleNum = 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user