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
4e636e6d38
commit
89f7969c9e
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
from DirectObject import *
|
from DirectObject import *
|
||||||
|
|
||||||
|
import ClockObject
|
||||||
|
import Task
|
||||||
|
|
||||||
class Interval(DirectObject):
|
class Interval(DirectObject):
|
||||||
"""Interval class: Base class for timeline functionality"""
|
"""Interval class: Base class for timeline functionality"""
|
||||||
|
|
||||||
@ -16,6 +19,7 @@ class Interval(DirectObject):
|
|||||||
"""
|
"""
|
||||||
self.name = name
|
self.name = name
|
||||||
self.duration = duration
|
self.duration = duration
|
||||||
|
self.clock = ClockObject.ClockObject.getGlobalClock()
|
||||||
|
|
||||||
def getName(self):
|
def getName(self):
|
||||||
""" getName()
|
""" getName()
|
||||||
@ -38,6 +42,32 @@ class Interval(DirectObject):
|
|||||||
"""
|
"""
|
||||||
self.setT(self.getDuration(), entry=1)
|
self.setT(self.getDuration(), entry=1)
|
||||||
|
|
||||||
|
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.removeTasksNamed(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
|
||||||
|
|
||||||
def printParams(self, indent=0):
|
def printParams(self, indent=0):
|
||||||
""" printParams(indent)
|
""" printParams(indent)
|
||||||
"""
|
"""
|
||||||
|
@ -3,9 +3,6 @@
|
|||||||
from Interval import *
|
from Interval import *
|
||||||
from Track import *
|
from Track import *
|
||||||
|
|
||||||
import ClockObject
|
|
||||||
import Task
|
|
||||||
|
|
||||||
class MultiTrack(Interval):
|
class MultiTrack(Interval):
|
||||||
|
|
||||||
multiTrackNum = 1
|
multiTrackNum = 1
|
||||||
@ -22,7 +19,6 @@ class MultiTrack(Interval):
|
|||||||
n = name
|
n = name
|
||||||
self.tlist = trackList
|
self.tlist = trackList
|
||||||
duration = self.__computeDuration()
|
duration = self.__computeDuration()
|
||||||
self.clock = ClockObject.ClockObject.getGlobalClock()
|
|
||||||
Interval.__init__(self, n, duration)
|
Interval.__init__(self, n, duration)
|
||||||
|
|
||||||
def __computeDuration(self):
|
def __computeDuration(self):
|
||||||
@ -46,32 +42,6 @@ class MultiTrack(Interval):
|
|||||||
for track in self.tlist:
|
for track in self.tlist:
|
||||||
track.setT(t, entry)
|
track.setT(t, entry)
|
||||||
|
|
||||||
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.removeTasksNamed(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
|
|
||||||
|
|
||||||
def printParams(self, indent=0):
|
def printParams(self, indent=0):
|
||||||
""" printParams(indent)
|
""" printParams(indent)
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user