*** empty log message ***
This commit is contained in:
parent
0a7ff1b5c9
commit
cb9c410ee2
|
|
@ -8,6 +8,7 @@ import Task
|
|||
# Interval events
|
||||
IVAL_NONE = 0
|
||||
IVAL_INIT = 1
|
||||
IVAL_DONE = 2
|
||||
|
||||
class Interval(DirectObject):
|
||||
"""Interval class: Base class for timeline functionality"""
|
||||
|
|
@ -80,7 +81,7 @@ class Interval(DirectObject):
|
|||
def setFinalT(self):
|
||||
""" setFinalT()
|
||||
"""
|
||||
self.setT(self.getDuration(), event=IVAL_NONE)
|
||||
self.setT(self.getDuration(), event=IVAL_DONE)
|
||||
|
||||
def play(self, t0=0.0, duration=0.0, scale=1.0):
|
||||
""" play(t0, duration)
|
||||
|
|
@ -135,21 +136,21 @@ class Interval(DirectObject):
|
|||
t = self.clock.getFrameTime()
|
||||
te = self.offset + ((t - self.startT) * self.scale)
|
||||
if (te < self.endTime):
|
||||
# If first call, init intervals
|
||||
if (self.firstTime):
|
||||
self.setT(te, event = IVAL_INIT)
|
||||
self.firstTime = 0
|
||||
else:
|
||||
self.setT(te)
|
||||
if (self.firstTime):
|
||||
# If first call, init intervals
|
||||
self.setT(te, event = IVAL_INIT)
|
||||
self.firstTime = 0
|
||||
else:
|
||||
self.setT(te)
|
||||
return Task.cont
|
||||
else:
|
||||
te = self.endTime
|
||||
# If first call, init intervals
|
||||
if (self.firstTime):
|
||||
self.setT(te, event = IVAL_INIT)
|
||||
self.firstTime = 0
|
||||
else:
|
||||
self.setT(te)
|
||||
if (self.firstTime):
|
||||
# If first call, init intervals
|
||||
self.setT(te, event = IVAL_INIT)
|
||||
self.firstTime = 0
|
||||
else:
|
||||
self.setT(te, IVAL_DONE)
|
||||
messenger.send(self.name + "-loop")
|
||||
return Task.done
|
||||
|
||||
|
|
|
|||
|
|
@ -46,13 +46,14 @@ class MultiTrack(Interval):
|
|||
"""
|
||||
for track in self.tlist:
|
||||
# Compare time with track's end times
|
||||
if (t > track.duration):
|
||||
if (event == IVAL_INIT) or (event == IVAL_DONE):
|
||||
# always call setT if INIT or DONE event
|
||||
track.setT(t, event)
|
||||
elif (t >= track.duration) and (self.prev_t < track.duration):
|
||||
# If t > track.duration, only call if just crossing over
|
||||
# or this is an IVAL_INIT event
|
||||
if (self.prev_t < track.duration) or (event == IVAL_INIT):
|
||||
track.setT(t, event)
|
||||
track.setT(t, event)
|
||||
else:
|
||||
# Update track
|
||||
# t within track, update track
|
||||
track.setT(t, event)
|
||||
|
||||
# Print out representation of MultiTrack
|
||||
|
|
|
|||
|
|
@ -182,7 +182,9 @@ class Track(Interval):
|
|||
for ival, itime, itype, tStart, tEnd in self.ilist:
|
||||
# Compare time with each ival's start/end times
|
||||
if (t < tStart):
|
||||
if (self.prev_t > tStart):
|
||||
if (event == IVAL_DONE):
|
||||
ival.setT(ival.getDuration(), event)
|
||||
elif (self.prev_t > tStart):
|
||||
# We just crossed the start of this interval
|
||||
# going backwards (e.g. via the slider)
|
||||
# Execute this interval at its start time
|
||||
|
|
@ -191,17 +193,22 @@ class Track(Interval):
|
|||
break
|
||||
elif (t >= tStart) and (t <= tEnd):
|
||||
# Between start/end, record current interval
|
||||
currentInterval = ival
|
||||
# Make sure event == IVAL_INIT if entering new interval
|
||||
if ((event == IVAL_NONE) and
|
||||
((self.prev_t < tStart) or
|
||||
(ival != self.currentInterval))):
|
||||
event = IVAL_INIT
|
||||
# Evaluate interval at interval relative time
|
||||
currentInterval.setT(t - tStart, event)
|
||||
if (event == IVAL_DONE):
|
||||
ival.setT(ival.getDuration(), event)
|
||||
else:
|
||||
ival.setT(t - tStart, event)
|
||||
currentInterval = ival
|
||||
elif (t > tEnd):
|
||||
# Crossing over interval end
|
||||
if (((event == IVAL_NONE) and (self.prev_t < tEnd)) or
|
||||
if ((((event == IVAL_NONE) or (event == IVAL_DONE)) and
|
||||
(self.prev_t < tEnd))
|
||||
or
|
||||
((event == IVAL_INIT) and ival.getfOpenEnded())):
|
||||
# If we've just crossed the end of this interval
|
||||
# or its an INIT event after the interval's end
|
||||
|
|
|
|||
Loading…
Reference in New Issue