mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
*** empty log message ***
This commit is contained in:
parent
52e8eb7482
commit
4fe070688b
@ -33,6 +33,11 @@ class Interval(DirectObject):
|
||||
"""
|
||||
pass
|
||||
|
||||
def setFinalT(self):
|
||||
""" setFinalT()
|
||||
"""
|
||||
self.setT(self.getDuration(), entry=1)
|
||||
|
||||
def printParams(self, indent=0):
|
||||
""" printParams(indent)
|
||||
"""
|
||||
|
@ -6,7 +6,6 @@ from LerpInterval import *
|
||||
from MopathInterval import *
|
||||
from PosHprInterval import *
|
||||
from SoundInterval import *
|
||||
from WaitInterval import *
|
||||
|
||||
from Track import *
|
||||
from MultiTrack import *
|
||||
|
@ -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
|
@ -1,18 +1,18 @@
|
||||
"""LerpInterval module: contains the LerpInterval class"""
|
||||
|
||||
import Interval
|
||||
from Interval import *
|
||||
|
||||
import Lerp
|
||||
|
||||
class LerpInterval(Interval.Interval):
|
||||
class LerpInterval(Interval):
|
||||
|
||||
# special methods
|
||||
|
||||
def __init__(self, name, duration, functor, blendType='noBlend'):
|
||||
"""__init__(name, duration, functor, blendType)
|
||||
"""
|
||||
self.name = name
|
||||
self.duration = duration
|
||||
self.lerp = Lerp.Lerp(functor, duration, self.__getBlend(blendType))
|
||||
Interval.__init__(self, name, duration)
|
||||
|
||||
def setT(self, t, entry=0):
|
||||
""" setT(t)
|
||||
|
@ -1,20 +1,20 @@
|
||||
"""MopathInterval module: contains the MopathInterval class"""
|
||||
|
||||
import Interval
|
||||
import Mopath
|
||||
import PosHprInterval
|
||||
from Interval import *
|
||||
|
||||
class MopathInterval(Interval.Interval):
|
||||
import Mopath
|
||||
|
||||
class MopathInterval(Interval):
|
||||
|
||||
# special methods
|
||||
|
||||
def __init__(self, name, mopath, node):
|
||||
"""__init__(name, mopath, node)
|
||||
"""
|
||||
self.name = name
|
||||
self.node = node
|
||||
self.mopath = mopath
|
||||
self.duration = self.mopath.getMaxT()
|
||||
duration = self.mopath.getMaxT()
|
||||
Interval.__init__(self, name, duration)
|
||||
|
||||
def setT(self, t, entry=0):
|
||||
""" setT(t)
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
from Interval import *
|
||||
from Track import *
|
||||
|
||||
import ClockObject
|
||||
import Task
|
||||
|
||||
@ -15,16 +16,17 @@ class MultiTrack(Interval):
|
||||
"""__init__(trackList, name)
|
||||
"""
|
||||
if (name == None):
|
||||
self.name = 'MultiTrack-%d' % MultiTrack.multiTrackNum
|
||||
n = 'MultiTrack-%d' % MultiTrack.multiTrackNum
|
||||
MultiTrack.multiTrackNum = MultiTrack.multiTrackNum + 1
|
||||
else:
|
||||
self.name = name
|
||||
n = name
|
||||
self.tlist = trackList
|
||||
self.duration = self.getDuration()
|
||||
duration = self.__computeDuration()
|
||||
self.clock = ClockObject.ClockObject.getGlobalClock()
|
||||
Interval.__init__(self, n, duration)
|
||||
|
||||
def getDuration(self):
|
||||
""" getDuration()
|
||||
def __computeDuration(self):
|
||||
""" __computeDuration()
|
||||
Returns the duration of the longest Track
|
||||
"""
|
||||
duration = 0.0
|
||||
|
@ -1,21 +1,19 @@
|
||||
"""PosHprInterval module: contains the PosHprInterval class"""
|
||||
|
||||
from PandaModules import *
|
||||
from Interval import *
|
||||
|
||||
import Interval
|
||||
|
||||
class PosHprInterval(Interval.Interval):
|
||||
class PosHprInterval(Interval):
|
||||
|
||||
# special methods
|
||||
|
||||
def __init__(self, name, node, pos, hpr, duration):
|
||||
"""__init__(name, node, pos, hpr, duration)
|
||||
"""
|
||||
self.name = name
|
||||
self.node = node
|
||||
self.pos = pos
|
||||
self.hpr = hpr
|
||||
self.duration = duration
|
||||
Interval.__init__(self, name, duration)
|
||||
|
||||
def setT(self, t, entry=0):
|
||||
""" setT(t)
|
||||
@ -24,17 +22,16 @@ class PosHprInterval(Interval.Interval):
|
||||
if (entry == 1):
|
||||
self.node.setPosHpr(self.pos, self.hpr)
|
||||
|
||||
class PosInterval(Interval.Interval):
|
||||
class PosInterval(Interval):
|
||||
|
||||
# special methods
|
||||
|
||||
def __init__(self, name, node, pos, duration):
|
||||
"""__init__(name, node, pos, duration)
|
||||
"""
|
||||
self.name = name
|
||||
self.node = node
|
||||
self.pos = pos
|
||||
self.duration = duration
|
||||
Interval.__init__(name, duration)
|
||||
|
||||
def setT(self, t, entry=0):
|
||||
""" setT(t)
|
||||
@ -43,17 +40,16 @@ class PosInterval(Interval.Interval):
|
||||
if (entry == 1):
|
||||
self.node.setPos(self.pos)
|
||||
|
||||
class HprInterval(Interval.Interval):
|
||||
class HprInterval(Interval):
|
||||
|
||||
# special methods
|
||||
|
||||
def __init__(self, name, node, hpr, duration):
|
||||
"""__init__(name, node, hpr, duration)
|
||||
"""
|
||||
self.name = name
|
||||
self.node = node
|
||||
self.hpr = hpr
|
||||
self.duration = duration
|
||||
Interval.__init__(name, duration)
|
||||
|
||||
def setT(self, t, entry=0):
|
||||
""" setT(t)
|
||||
|
@ -1,11 +1,9 @@
|
||||
"""SoundInterval module: contains the SoundInterval class"""
|
||||
|
||||
from PandaModules import *
|
||||
from Interval import *
|
||||
|
||||
import Interval
|
||||
import WaitInterval
|
||||
|
||||
class SoundInterval(Interval.Interval):
|
||||
class SoundInterval(Interval):
|
||||
|
||||
# special methods
|
||||
|
||||
@ -14,13 +12,14 @@ class SoundInterval(Interval.Interval):
|
||||
"""
|
||||
self.name = name
|
||||
self.sound = sound
|
||||
self.duration = self.sound.length()
|
||||
if (self.duration == 0.0):
|
||||
Interval.Interval.notify.warning(
|
||||
duration = self.sound.length()
|
||||
if (duration == 0.0):
|
||||
Interval.notify.warning(
|
||||
'SoundInterval(): zero length sound - setting duration = 1.0')
|
||||
self.duration = 1.0
|
||||
duration = 1.0
|
||||
self.loop = loop
|
||||
self.isPlaying = 0
|
||||
Interval.__init__(self, name, duration)
|
||||
|
||||
def setT(self, t, entry=0):
|
||||
""" setT(t)
|
||||
|
@ -1,6 +1,7 @@
|
||||
"""Track module: contains the Track class"""
|
||||
|
||||
from Interval import *
|
||||
|
||||
import types
|
||||
|
||||
PREVIOUS_END = 1
|
||||
@ -17,14 +18,14 @@ class Track(Interval):
|
||||
"""__init__(intervalList, name)
|
||||
"""
|
||||
if (name == None):
|
||||
self.name = 'Track-%d' % Track.trackNum
|
||||
n = 'Track-%d' % Track.trackNum
|
||||
Track.trackNum = Track.trackNum + 1
|
||||
else:
|
||||
self.name = name
|
||||
|
||||
n = name
|
||||
self.__buildIlist(intervalList)
|
||||
self.duration = self.__computeDuration(len(self.ilist))
|
||||
duration = self.__computeDuration(len(self.ilist))
|
||||
self.currentInterval = None
|
||||
Interval.__init__(self, n, duration)
|
||||
|
||||
def __buildIlist(self, intervalList):
|
||||
self.ilist = []
|
||||
|
@ -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
|
Loading…
x
Reference in New Issue
Block a user