mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-19 13:15:00 -04:00
*** empty log message ***
This commit is contained in:
parent
b01eb83885
commit
ebee5f6b86
@ -77,15 +77,20 @@ class Interval(DirectObject):
|
|||||||
def play(self, t0=0.0, duration=0.0, scale=1.0):
|
def play(self, t0=0.0, duration=0.0, scale=1.0):
|
||||||
""" play(t0, duration)
|
""" play(t0, duration)
|
||||||
"""
|
"""
|
||||||
|
# Kill ongoing play task
|
||||||
|
self.stop()
|
||||||
|
# Start new one
|
||||||
self.offset = t0
|
self.offset = t0
|
||||||
self.startT = self.clock.getFrameTime()
|
self.startT = self.clock.getFrameTime()
|
||||||
assert(scale > 0.0)
|
assert(scale > 0.0)
|
||||||
self.scale = scale
|
self.scale = scale
|
||||||
self.firstTime = 1
|
self.firstTime = 1
|
||||||
if (duration == 0.0):
|
if (duration == 0.0):
|
||||||
self.endTime = self.offset + self.duration
|
# If no play duration specified, use duration of Interval
|
||||||
|
self.endTime = self.duration
|
||||||
else:
|
else:
|
||||||
self.endTime = self.offset + duration
|
# Otherwise use min of interval duration and offset + play duration
|
||||||
|
self.endTime = min(self.duration, self.offset + duration)
|
||||||
assert(t0 <= self.endTime)
|
assert(t0 <= self.endTime)
|
||||||
taskMgr.spawnMethodNamed(self.__playTask, self.name + '-play')
|
taskMgr.spawnMethodNamed(self.__playTask, self.name + '-play')
|
||||||
|
|
||||||
@ -100,7 +105,7 @@ class Interval(DirectObject):
|
|||||||
"""
|
"""
|
||||||
t = self.clock.getFrameTime()
|
t = self.clock.getFrameTime()
|
||||||
te = self.offset + ((t - self.startT) * self.scale)
|
te = self.offset + ((t - self.startT) * self.scale)
|
||||||
if (te <= self.endTime):
|
if (te < self.endTime):
|
||||||
if (self.firstTime):
|
if (self.firstTime):
|
||||||
self.setT(te, event = IVAL_INIT)
|
self.setT(te, event = IVAL_INIT)
|
||||||
self.firstTime = 0
|
self.firstTime = 0
|
||||||
@ -128,7 +133,7 @@ class Interval(DirectObject):
|
|||||||
import EntryScale
|
import EntryScale
|
||||||
tl = Toplevel()
|
tl = Toplevel()
|
||||||
tl.title(self.getName() + ' Interval Controls')
|
tl.title(self.getName() + ' Interval Controls')
|
||||||
es = EntryScale.EntryScale(
|
self.es = es = EntryScale.EntryScale(
|
||||||
tl, text = 'Time',
|
tl, text = 'Time',
|
||||||
min = 0, max = string.atof(fpformat.fix(self.duration, 2)),
|
min = 0, max = string.atof(fpformat.fix(self.duration, 2)),
|
||||||
command = lambda t, s = self: s.setT(t))
|
command = lambda t, s = self: s.setT(t))
|
||||||
|
@ -40,7 +40,13 @@ class MultiTrack(Interval):
|
|||||||
Go to time t
|
Go to time t
|
||||||
"""
|
"""
|
||||||
for track in self.tlist:
|
for track in self.tlist:
|
||||||
track.setT(min(t, track.getDuration()), event)
|
tEnd = track.getDuration()
|
||||||
|
# Compare time with track's end times
|
||||||
|
if (t > tEnd):
|
||||||
|
if (self.prev_t < tEnd) or (event == IVAL_INIT):
|
||||||
|
track.setT(t)
|
||||||
|
else:
|
||||||
|
track.setT(t)
|
||||||
|
|
||||||
def __repr__(self, indent=0):
|
def __repr__(self, indent=0):
|
||||||
""" __repr__(indent)
|
""" __repr__(indent)
|
||||||
|
@ -153,7 +153,8 @@ class Track(Interval):
|
|||||||
# First entry, re-init instance variables
|
# First entry, re-init instance variables
|
||||||
if (event == IVAL_INIT):
|
if (event == IVAL_INIT):
|
||||||
# Initialize prev_t to max t of track
|
# Initialize prev_t to max t of track
|
||||||
self.prev_t = self.getDuration()
|
#self.prev_t = self.getDuration()
|
||||||
|
self.prev_t = 0.0
|
||||||
# Clear record of currentInterval
|
# Clear record of currentInterval
|
||||||
self.currentInterval = None
|
self.currentInterval = None
|
||||||
# Compare t with start and end of each interval to determine
|
# Compare t with start and end of each interval to determine
|
||||||
|
Loading…
x
Reference in New Issue
Block a user