mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
*** empty log message ***
This commit is contained in:
parent
e72fcc4a9a
commit
19158dfd98
@ -5,8 +5,6 @@ from IntervalGlobal import *
|
||||
import Mopath
|
||||
import IntervalPlayer
|
||||
|
||||
#AudioManager.spawnUpdate()
|
||||
|
||||
boat = loader.loadModel('models/directmodels/smiley')
|
||||
boat.reparentTo(render)
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
import Interval
|
||||
import Track
|
||||
import ClockObject
|
||||
import Task
|
||||
|
||||
class MultiTrack(Interval.Interval):
|
||||
|
||||
@ -21,6 +23,7 @@ class MultiTrack(Interval.Interval):
|
||||
self.duration = self.getDuration()
|
||||
self.startTime = 0.0
|
||||
self.type = Interval.PREVIOUS_END
|
||||
self.clock = ClockObject.ClockObject.getGlobalClock()
|
||||
|
||||
def getDuration(self):
|
||||
""" getDuration()
|
||||
@ -42,3 +45,29 @@ class MultiTrack(Interval.Interval):
|
||||
'MultiTrack.setT(): t = %f > duration' % t)
|
||||
for track in self.tlist:
|
||||
track.setT(t)
|
||||
|
||||
def play(self, t0=0.0, duration=0.0):
|
||||
""" play(t0, duration)
|
||||
"""
|
||||
self.startT = self.clock.getFrameTime() - t0
|
||||
if (duration == 0.0):
|
||||
self.playDuration = self.duration
|
||||
else:
|
||||
self.playDuration = duration
|
||||
taskMgr.spawnMethodNamed(self.__playTask, self.name + '-play')
|
||||
|
||||
def stop(self):
|
||||
""" stop()
|
||||
"""
|
||||
taskMgr.removeMethodsNamed(self.name + '-play')
|
||||
|
||||
def __playTask(self, task):
|
||||
""" __playTask(task)
|
||||
"""
|
||||
t = self.clock.getFrameTime()
|
||||
te = t - self.startT
|
||||
if (te <= self.playDuration):
|
||||
self.setT(te)
|
||||
return Task.cont
|
||||
else:
|
||||
return Task.done
|
||||
|
@ -32,6 +32,7 @@ class SoundInterval(Interval.Interval):
|
||||
if (t > self.duration):
|
||||
if (self.isPlaying == 1):
|
||||
AudioManager.stop(self.sound)
|
||||
self.isPlaying = 0
|
||||
return
|
||||
assert(t >= 0)
|
||||
if (t == 0):
|
||||
|
Loading…
x
Reference in New Issue
Block a user