*** empty log message ***

This commit is contained in:
Mark Mine 2001-03-30 02:11:06 +00:00
parent 51ec5d8e95
commit c0fd62dfe8
5 changed files with 29 additions and 18 deletions

View File

@ -213,6 +213,7 @@ class PosHprScaleInterval(FunctionInterval):
""" """
SAMPLE CODE SAMPLE CODE
from IntervalGlobal import *
### Using lambdas and functions ### ### Using lambdas and functions ###
# Using a lambda # Using a lambda
@ -224,9 +225,9 @@ def printHello():
i3 = FunctionInterval(printHello) i3 = FunctionInterval(printHello)
# Create track # Create track
t = Track([(0.0, i1), (2.0, i2), (4.0, i3)], name = 'demo') t1 = Track([(0.0, i1), (2.0, i2), (4.0, i3)], name = 'demo')
# Play track # Play track
t.play() t1.play()
### Specifying interval start times during track construction ### ### Specifying interval start times during track construction ###
# Interval start time can be specified relative to three different points: # Interval start time can be specified relative to three different points:
@ -257,24 +258,25 @@ def printTrackStart():
i1 = FunctionInterval(printStart) i1 = FunctionInterval(printStart)
# Just to take time # Just to take time
i2 = LerpPosInterval(camera, 2.0, Point3(0,10,0)) 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
i3 = FunctionInterval(printPreviousEnd) i3 = FunctionInterval(printPreviousEnd)
# Just to take time # Just to take time
i4 = LerpPosInterval(camera, 2.0, Point3(0,0,0)) i4 = LerpPosInterval(camera, 2.0, Point3(0,0,5))
# This will be relative to the start of the camera move # This will be relative to the start of the camera move
i5 = FunctionInterval(printPreviousStart) i5 = FunctionInterval(printPreviousStart)
# This will be relative to track start # This will be relative to track start
i6 = FunctionInterval(printTrackStart) i6 = FunctionInterval(printTrackStart)
# Create the track, if you don't specify offset type in tuple it defaults to # Create the track, if you don't specify offset type in tuple it defaults to
# relative to TRACK_START (first entry below) # relative to TRACK_START (first entry below)
t = Track([(0.0, i1), # i1 start at t = 0, duration = 0.0 t2 = Track([(0.0, i1), # i1 start at t = 0, duration = 0.0
(1.0, i2, TRACK_START), # i2 start at t = 1, duration = 2.0 (1.0, i2, TRACK_START), # i2 start at t = 1, duration = 2.0
(2.0, i3, PREVIOUS_END), # i3 start at t = 5, duration = 0.0 (2.0, i3, PREVIOUS_END), # i3 start at t = 5, duration = 0.0
(1.0, i4, PREVIOUS_END), # i4 start at t = 6, duration = 2.0 (1.0, i4, PREVIOUS_END), # i4 start at t = 6, duration = 2.0
(3.0, i5, PREVIOUS_START), # i5 start at t = 9, duration = 0.0 (3.0, i5, PREVIOUS_START), # i5 start at t = 9, duration = 0.0
(10.0, i6, TRACK_START)], # i6 start at t = 10, duration = 0.0 (10.0, i6, TRACK_START)], # i6 start at t = 10, duration = 0.0
name = 'startTimeDemo') name = 'startTimeDemo')
t.play()
t2.play()
""" """

View File

@ -80,13 +80,13 @@ class Interval(DirectObject):
self.setT(self.playDuration) self.setT(self.playDuration)
return Task.done return Task.done
def printParams(self, indent=0): def __repr__(self, indent=0):
""" printParams(indent) """ __repr__(indent)
""" """
space = '' space = ''
for l in range(indent): for l in range(indent):
space = space + ' ' space = space + ' '
print (space + self.name + ' dur: %.2f' % self.duration) return (space + self.name + ' dur: %.2f\n' % self.duration)
def popupControls(self): def popupControls(self):
# I moved this here because Toontown does not ship Tk # I moved this here because Toontown does not ship Tk

View File

@ -49,7 +49,8 @@ waterEventTrack = Track([waterDone])
waterEventTrack.setIntervalStartTime('water-is-done', eventTime) waterEventTrack.setIntervalStartTime('water-is-done', eventTime)
mtrack = MultiTrack([boatTrack, dockTrack, soundTrack, waterEventTrack]) mtrack = MultiTrack([boatTrack, dockTrack, soundTrack, waterEventTrack])
mtrack.printParams() # Print out MultiTrack parameters
mtrack
def handleWaterDone(): def handleWaterDone():
print 'water is done' print 'water is done'

View File

@ -21,6 +21,9 @@ class MultiTrack(Interval):
duration = self.__computeDuration() duration = self.__computeDuration()
Interval.__init__(self, n, duration) Interval.__init__(self, n, duration)
def __getitem__(self, item):
return self.tlist[item]
def __computeDuration(self): def __computeDuration(self):
""" __computeDuration() """ __computeDuration()
Returns the duration of the longest Track Returns the duration of the longest Track
@ -41,9 +44,10 @@ class MultiTrack(Interval):
for track in self.tlist: for track in self.tlist:
track.setT(t, entry) track.setT(t, entry)
def printParams(self, indent=0): def __repr__(self, indent=0):
""" printParams(indent) """ __repr__(indent)
""" """
Interval.printParams(self, indent) str = Interval.__repr__(self, indent)
for t in self.tlist: for t in self.tlist:
t.printParams(indent+1) str = str + t.__repr__(indent+1)
return str

View File

@ -27,6 +27,9 @@ class Track(Interval):
self.currentInterval = None self.currentInterval = None
Interval.__init__(self, n, duration) Interval.__init__(self, n, duration)
def __getitem__(self, item):
return self.ilist[item][0]
def __buildIlist(self, intervalList): def __buildIlist(self, intervalList):
self.ilist = [] self.ilist = []
for i in intervalList: for i in intervalList:
@ -154,9 +157,10 @@ class Track(Interval):
else: else:
ival.setT(tc) ival.setT(tc)
def printParams(self, indent=0): def __repr__(self, indent=0):
""" printParams(indent) """ __repr__(indent)
""" """
Interval.printParams(self, indent) str = Interval.__repr__(self, indent)
for i in self.ilist: for i in self.ilist:
i[0].printParams(indent+1) str = str + i[0].__repr__(indent+1)
return str