*** empty log message ***

This commit is contained in:
Joe Shochet 2002-02-09 00:58:34 +00:00
parent 0e0bd2fe2b
commit 54e0304bd3
7 changed files with 108 additions and 11 deletions

View File

@ -1280,5 +1280,7 @@ class Actor(PandaObject, NodePath):
self.__animControlDict[lodName][partName][animName] = \ self.__animControlDict[lodName][partName][animName] = \
[other.__animControlDict[lodName][partName][animName][0], None] [other.__animControlDict[lodName][partName][animName][0], None]
def actorInterval(self, *args, **kw):
import ActorInterval
return ActorInterval.ActorInterval(self, *args, **kw)

View File

@ -854,3 +854,35 @@
np = npc[p] np = npc[p]
if (mask == None or (np.node().getIntoCollideMask() & mask).getWord()): if (mask == None or (np.node().getIntoCollideMask() & mask).getWord()):
np.hide() np.hide()
def posInterval(self, *args, **kw):
import LerpInterval
return LerpInterval.LerpPosInterval(self, *args, **kw)
def hprInterval(self, *args, **kw):
import LerpInterval
return LerpInterval.LerpHprInterval(self, *args, **kw)
def scaleInterval(self, *args, **kw):
import LerpInterval
return LerpInterval.LerpScaleInterval(self, *args, **kw)
def posHprInterval(self, *args, **kw):
import LerpInterval
return LerpInterval.LerpPosHprInterval(self, *args, **kw)
def hprScaleInterval(self, *args, **kw):
import LerpInterval
return LerpInterval.LerpHprScaleInterval(self, *args, **kw)
def posHprScaleInterval(self, *args, **kw):
import LerpInterval
return LerpInterval.LerpPosHprScaleInterval(self, *args, **kw)
def colorInterval(self, *args, **kw):
import LerpInterval
return LerpInterval.LerpColorInterval(self, *args, **kw)
def colorScaleInterval(self, *args, **kw):
import LerpInterval
return LerpInterval.LerpColorScaleInterval(self, *args, **kw)

View File

@ -256,15 +256,24 @@ class PosHprScaleInterval(FunctionInterval):
# Create function interval # Create function interval
FunctionInterval.__init__(self, posHprScaleFunc, name = name) FunctionInterval.__init__(self, posHprScaleFunc, name = name)
class Func(FunctionInterval):
def __init__(self, *args, **kw):
function = args[0]
assert(callable(function))
extraArgs = args[1:]
kw['extraArgs'] = extraArgs
FunctionInterval.__init__(self, function, **kw)
""" """
SAMPLE CODE SAMPLE CODE
from IntervalGlobal import * from IntervalGlobal import *
### Using lambdas and functions ### i1 = Func(base.transitions.fadeOut)
# Using a lambda i2 = Func(base.transitions.fadeIn)
i1 = FunctionInterval(lambda: base.transitions.fadeOut())
i2 = FunctionInterval(lambda: base.transitions.fadeIn())
def caughtIt(): def caughtIt():
print 'Caught here-is-an-event' print 'Caught here-is-an-event'
@ -273,20 +282,20 @@ class DummyAcceptor(DirectObject):
pass pass
da = DummyAcceptor() da = DummyAcceptor()
i3 = AcceptInterval(da, 'here-is-an-event', caughtIt) i3 = Func(da.accept, 'here-is-an-event', caughtIt)
i4 = EventInterval('here-is-an-event') i4 = Func(messenger.send, 'here-is-an-event')
i5 = IgnoreInterval(da, 'here-is-an-event') i5 = Func(da.ignore, 'here-is-an-event')
# Using a function # Using a function
def printDone(): def printDone():
print 'done' print 'done'
i6 = FunctionInterval(printDone) i6 = Func(printDone)
# Create track # Create track
t1 = Track([ t1 = Sequence([
# Fade out # Fade out
(0.0, i1), (0.0, i1),
# Fade in # Fade in
@ -332,7 +341,7 @@ def printTrackStart():
currTime = globalClock.getFrameTime() currTime = globalClock.getFrameTime()
print 'TRACK_START %0.2f' % (currTime - startTime) print 'TRACK_START %0.2f' % (currTime - startTime)
i1 = FunctionInterval(printStart) i1 = Func(printStart)
# Just to take time # Just to take time
i2 = LerpPosInterval(camera, 2.0, Point3(0,10,5)) i2 = LerpPosInterval(camera, 2.0, Point3(0,10,5))
# This will be relative to end of camera move # This will be relative to end of camera move
@ -355,4 +364,35 @@ t2 = Track([(0.0, i1), # i1 start at t = 0, duration = 0.0
t2.play() t2.play()
smiley = loader.loadModel('models/misc/smiley')
import Actor
donald = Actor.Actor()
donald.loadModel("phase_6/models/char/donald-wheel-1000")
donald.loadAnims({"steer":"phase_6/models/char/donald-wheel-wheel"})
donald.reparentTo(render)
seq = Sequence(Func(donald.setPos, 0,0,0),
donald.actorInterval('steer', duration=1.0),
donald.posInterval(1, Point3(0,0,1)),
Parallel(donald.actorInterval('steer', duration=1.0),
donald.posInterval(1, Point3(0,0,0)),
),
Wait(1.0),
Func(base.toggleWireframe),
Wait(1.0),
Parallel(donald.actorInterval('steer', duration=1.0),
donald.posInterval(1, Point3(0,0,-1)),
Sequence(donald.hprInterval(1, Vec3(180,0,0)),
donald.hprInterval(1, Vec3(0,0,0)),
),
),
Func(base.toggleWireframe),
Func(messenger.send, 'hello'),
)
""" """

View File

@ -357,6 +357,11 @@ class LerpFunctionInterval(Interval):
raise Exception( raise Exception(
'Error: LerpInterval.__getBlend: Unknown blend type') 'Error: LerpInterval.__getBlend: Unknown blend type')
# New interface
class LerpFunc(LerpFunctionInterval):
def __init__(self, *args, **kw):
LerpFunctionInterval.__init__(self, *args, **kw)
class LerpColorScaleInterval(LerpInterval): class LerpColorScaleInterval(LerpInterval):
# Name counter # Name counter

View File

@ -3,6 +3,8 @@
from Interval import * from Interval import *
from Track import * from Track import *
class MultiTrack(Interval): class MultiTrack(Interval):
# Name counter # Name counter
multiTrackNum = 1 multiTrackNum = 1
@ -72,3 +74,7 @@ class MultiTrack(Interval):
class Parallel(MultiTrack):
def __init__(self, *tracks, **kw):
MultiTrack.__init__(self, tracks, **kw)

View File

@ -13,6 +13,8 @@ IDATA_TYPE = 2
IDATA_START = 3 IDATA_START = 3
IDATA_END = 4 IDATA_END = 4
class Track(Interval): class Track(Interval):
# Name counter # Name counter
trackNum = 1 trackNum = 1
@ -240,3 +242,8 @@ class Track(Interval):
(idata[IDATA_START], idata[IDATA_END])) + '\n' (idata[IDATA_START], idata[IDATA_END])) + '\n'
) )
return str return str
class Sequence(Track):
def __init__(self, *intervals, **kw):
Track.__init__(self, intervals, **kw)

View File

@ -16,3 +16,8 @@ class WaitInterval(Interval):
WaitInterval.waitNum += 1 WaitInterval.waitNum += 1
# Initialize superclass # Initialize superclass
Interval.__init__(self, name, duration) Interval.__init__(self, name, duration)
class Wait(WaitInterval):
def __init__(self, *args, **kw):
WaitInterval.__init__(self, *args, **kw)