*** empty log message ***

This commit is contained in:
Mike Goslin 2001-03-02 03:53:24 +00:00
parent 52e8eb7482
commit 4fe070688b
10 changed files with 41 additions and 108 deletions

View File

@ -33,6 +33,11 @@ class Interval(DirectObject):
""" """
pass pass
def setFinalT(self):
""" setFinalT()
"""
self.setT(self.getDuration(), entry=1)
def printParams(self, indent=0): def printParams(self, indent=0):
""" printParams(indent) """ printParams(indent)
""" """

View File

@ -6,7 +6,6 @@ from LerpInterval import *
from MopathInterval import * from MopathInterval import *
from PosHprInterval import * from PosHprInterval import *
from SoundInterval import * from SoundInterval import *
from WaitInterval import *
from Track import * from Track import *
from MultiTrack import * from MultiTrack import *

View File

@ -1,48 +0,0 @@
"""IntervalPlayer module: contains the IntervalPlayer class"""
from DirectObject import *
import Interval
import Task
class IntervalPlayer(DirectObject):
"""IntervalPlayer class: Plays back Intervals (like a taskMgr)"""
# special methods
def __init__(self, clock):
"""__init__(clock)
"""
self.clock = clock
self.intervals = []
def addInterval(self, interval):
""" addInterval(interval)
"""
self.intervals.append(interval)
def removeInterval(self, interval):
""" removeInterval(interval)
"""
self.intervals.remove(interval)
def play(self):
""" play()
"""
self.duration = 0.0
for i in self.intervals:
dur = i.getDuration()
if (dur > self.duration):
self.duration = dur
self.startT = self.clock.getFrameTime()
taskMgr.spawnMethodNamed(self.__playTask, 'interval-player')
def __playTask(self, task):
t = self.clock.getFrameTime()
te = t - self.startT
if (te <= self.duration):
for i in self.intervals:
i.setT(te)
return Task.cont
else:
return Task.done

View File

@ -1,18 +1,18 @@
"""LerpInterval module: contains the LerpInterval class""" """LerpInterval module: contains the LerpInterval class"""
import Interval from Interval import *
import Lerp import Lerp
class LerpInterval(Interval.Interval): class LerpInterval(Interval):
# special methods # special methods
def __init__(self, name, duration, functor, blendType='noBlend'): def __init__(self, name, duration, functor, blendType='noBlend'):
"""__init__(name, duration, functor, blendType) """__init__(name, duration, functor, blendType)
""" """
self.name = name
self.duration = duration
self.lerp = Lerp.Lerp(functor, duration, self.__getBlend(blendType)) self.lerp = Lerp.Lerp(functor, duration, self.__getBlend(blendType))
Interval.__init__(self, name, duration)
def setT(self, t, entry=0): def setT(self, t, entry=0):
""" setT(t) """ setT(t)

View File

@ -1,20 +1,20 @@
"""MopathInterval module: contains the MopathInterval class""" """MopathInterval module: contains the MopathInterval class"""
import Interval from Interval import *
import Mopath
import PosHprInterval
class MopathInterval(Interval.Interval): import Mopath
class MopathInterval(Interval):
# special methods # special methods
def __init__(self, name, mopath, node): def __init__(self, name, mopath, node):
"""__init__(name, mopath, node) """__init__(name, mopath, node)
""" """
self.name = name
self.node = node self.node = node
self.mopath = mopath self.mopath = mopath
self.duration = self.mopath.getMaxT() duration = self.mopath.getMaxT()
Interval.__init__(self, name, duration)
def setT(self, t, entry=0): def setT(self, t, entry=0):
""" setT(t) """ setT(t)

View File

@ -2,6 +2,7 @@
from Interval import * from Interval import *
from Track import * from Track import *
import ClockObject import ClockObject
import Task import Task
@ -15,16 +16,17 @@ class MultiTrack(Interval):
"""__init__(trackList, name) """__init__(trackList, name)
""" """
if (name == None): if (name == None):
self.name = 'MultiTrack-%d' % MultiTrack.multiTrackNum n = 'MultiTrack-%d' % MultiTrack.multiTrackNum
MultiTrack.multiTrackNum = MultiTrack.multiTrackNum + 1 MultiTrack.multiTrackNum = MultiTrack.multiTrackNum + 1
else: else:
self.name = name n = name
self.tlist = trackList self.tlist = trackList
self.duration = self.getDuration() duration = self.__computeDuration()
self.clock = ClockObject.ClockObject.getGlobalClock() self.clock = ClockObject.ClockObject.getGlobalClock()
Interval.__init__(self, n, duration)
def getDuration(self): def __computeDuration(self):
""" getDuration() """ __computeDuration()
Returns the duration of the longest Track Returns the duration of the longest Track
""" """
duration = 0.0 duration = 0.0

View File

@ -1,21 +1,19 @@
"""PosHprInterval module: contains the PosHprInterval class""" """PosHprInterval module: contains the PosHprInterval class"""
from PandaModules import * from PandaModules import *
from Interval import *
import Interval class PosHprInterval(Interval):
class PosHprInterval(Interval.Interval):
# special methods # special methods
def __init__(self, name, node, pos, hpr, duration): def __init__(self, name, node, pos, hpr, duration):
"""__init__(name, node, pos, hpr, duration) """__init__(name, node, pos, hpr, duration)
""" """
self.name = name
self.node = node self.node = node
self.pos = pos self.pos = pos
self.hpr = hpr self.hpr = hpr
self.duration = duration Interval.__init__(self, name, duration)
def setT(self, t, entry=0): def setT(self, t, entry=0):
""" setT(t) """ setT(t)
@ -24,17 +22,16 @@ class PosHprInterval(Interval.Interval):
if (entry == 1): if (entry == 1):
self.node.setPosHpr(self.pos, self.hpr) self.node.setPosHpr(self.pos, self.hpr)
class PosInterval(Interval.Interval): class PosInterval(Interval):
# special methods # special methods
def __init__(self, name, node, pos, duration): def __init__(self, name, node, pos, duration):
"""__init__(name, node, pos, duration) """__init__(name, node, pos, duration)
""" """
self.name = name
self.node = node self.node = node
self.pos = pos self.pos = pos
self.duration = duration Interval.__init__(name, duration)
def setT(self, t, entry=0): def setT(self, t, entry=0):
""" setT(t) """ setT(t)
@ -43,17 +40,16 @@ class PosInterval(Interval.Interval):
if (entry == 1): if (entry == 1):
self.node.setPos(self.pos) self.node.setPos(self.pos)
class HprInterval(Interval.Interval): class HprInterval(Interval):
# special methods # special methods
def __init__(self, name, node, hpr, duration): def __init__(self, name, node, hpr, duration):
"""__init__(name, node, hpr, duration) """__init__(name, node, hpr, duration)
""" """
self.name = name
self.node = node self.node = node
self.hpr = hpr self.hpr = hpr
self.duration = duration Interval.__init__(name, duration)
def setT(self, t, entry=0): def setT(self, t, entry=0):
""" setT(t) """ setT(t)

View File

@ -1,11 +1,9 @@
"""SoundInterval module: contains the SoundInterval class""" """SoundInterval module: contains the SoundInterval class"""
from PandaModules import * from PandaModules import *
from Interval import *
import Interval class SoundInterval(Interval):
import WaitInterval
class SoundInterval(Interval.Interval):
# special methods # special methods
@ -14,13 +12,14 @@ class SoundInterval(Interval.Interval):
""" """
self.name = name self.name = name
self.sound = sound self.sound = sound
self.duration = self.sound.length() duration = self.sound.length()
if (self.duration == 0.0): if (duration == 0.0):
Interval.Interval.notify.warning( Interval.notify.warning(
'SoundInterval(): zero length sound - setting duration = 1.0') 'SoundInterval(): zero length sound - setting duration = 1.0')
self.duration = 1.0 duration = 1.0
self.loop = loop self.loop = loop
self.isPlaying = 0 self.isPlaying = 0
Interval.__init__(self, name, duration)
def setT(self, t, entry=0): def setT(self, t, entry=0):
""" setT(t) """ setT(t)

View File

@ -1,6 +1,7 @@
"""Track module: contains the Track class""" """Track module: contains the Track class"""
from Interval import * from Interval import *
import types import types
PREVIOUS_END = 1 PREVIOUS_END = 1
@ -17,14 +18,14 @@ class Track(Interval):
"""__init__(intervalList, name) """__init__(intervalList, name)
""" """
if (name == None): if (name == None):
self.name = 'Track-%d' % Track.trackNum n = 'Track-%d' % Track.trackNum
Track.trackNum = Track.trackNum + 1 Track.trackNum = Track.trackNum + 1
else: else:
self.name = name n = name
self.__buildIlist(intervalList) self.__buildIlist(intervalList)
self.duration = self.__computeDuration(len(self.ilist)) duration = self.__computeDuration(len(self.ilist))
self.currentInterval = None self.currentInterval = None
Interval.__init__(self, n, duration)
def __buildIlist(self, intervalList): def __buildIlist(self, intervalList):
self.ilist = [] self.ilist = []

View File

@ -1,21 +0,0 @@
"""WaitInterval module: contains the Wait class"""
from PandaModules import *
import Interval
class Wait(Interval.Interval):
waitNum = 1
# special methods
def __init__(self, duration, name=None):
"""__init__(duration, name, t0, type)
"""
if (name == None):
self.name = 'wait-%d' % Wait.waitNum
Wait.waitNum = Wait.waitNum + 1
else:
self.name = name
self.duration = duration