From b3776c71b363edfb2b05f044ddda3ff2e0d32807 Mon Sep 17 00:00:00 2001 From: Mike Goslin Date: Fri, 2 Mar 2001 21:06:40 +0000 Subject: [PATCH] *** empty log message *** --- direct/src/interval/IntervalTest.py | 10 +++--- direct/src/interval/LerpInterval.py | 49 ++++++++++++++++++++------- direct/src/interval/MopathInterval.py | 13 +++++-- direct/src/interval/PosHprInterval.py | 39 ++++++++++++++++----- direct/src/interval/SoundInterval.py | 14 +++++--- direct/src/interval/Track.py | 2 +- 6 files changed, 93 insertions(+), 34 deletions(-) diff --git a/direct/src/interval/IntervalTest.py b/direct/src/interval/IntervalTest.py index 04b410440d..8b2bab0aba 100644 --- a/direct/src/interval/IntervalTest.py +++ b/direct/src/interval/IntervalTest.py @@ -16,7 +16,7 @@ mp = Mopath.Mopath() mp.loadFile(Filename('phase_6/paths/dd-e-w')) # Set up the boat -boatMopath = MopathInterval('boatpath', mp, boat) +boatMopath = MopathInterval(mp, boat, 'boatpath') boatTrack = Track([boatMopath], 'boattrack') BOAT_START = boatTrack.getIntervalStartTime('boatpath') BOAT_END = boatTrack.getIntervalEndTime('boatpath') @@ -25,19 +25,19 @@ BOAT_END = boatTrack.getIntervalEndTime('boatpath') # its mopath pos = Point3(0, 0, -5) hpr = Vec3(0, 0, 0) -dockLerp = LerpPosHprInterval('lerp', dock, pos, hpr, 5.0) +dockLerp = LerpPosHprInterval(dock, 5.0, pos, hpr, name='dock-lerp') # We need the dock's state to be defined before the lerp -dockPos = PosHprInterval('dockpos', dock, dock.getPos(), dock.getHpr(), 1.0) +dockPos = PosHprInterval(dock, dock.getPos(), dock.getHpr(), 1.0, 'dockpos') dockUpTime = BOAT_END - dockLerp.getDuration() hpr2 = Vec3(90.0, 90.0, 90.0) -dockLerp2 = LerpHprInterval('hpr-lerp', dock, hpr2, 3.0) +dockLerp2 = LerpHprInterval(dock, 3.0, hpr2, name='hpr-lerp') dockTrack = Track([dockLerp2, dockPos, dockLerp], 'docktrack') dockTrack.setIntervalStartTime('lerp', dockUpTime) dockTrack.setIntervalStartTime('hpr-lerp', BOAT_START) # Start the water sound 5 seconds after the boat starts moving waterStartTime = BOAT_START + 5.0 -waterSound = SoundInterval('watersound', sound) +waterSound = SoundInterval(sound, name='watersound') soundTrack = Track([waterSound], 'soundtrack') soundTrack.setIntervalStartTime('watersound', waterStartTime) diff --git a/direct/src/interval/LerpInterval.py b/direct/src/interval/LerpInterval.py index 62614e762d..10da499969 100644 --- a/direct/src/interval/LerpInterval.py +++ b/direct/src/interval/LerpInterval.py @@ -43,9 +43,12 @@ class LerpInterval(Interval): class LerpPosHprInterval(LerpInterval): - def __init__(self, name, node, pos, hpr, duration, startPos=None, - startHpr=None, other=None, blendType='noBlend'): - """ __init__(name, node, pos, hpr, duration, other, blendType) + lerpPosHprNum = 1 + + def __init__(self, node, duration, pos, hpr, startPos=None, + startHpr=None, other=None, blendType='noBlend', name=None): + """ __init__(node, duration, pos, hpr, startPos, startHpr, + other, blendType, name) """ import PosHprLerpFunctor @@ -68,14 +71,22 @@ class LerpPosHprInterval(LerpInterval): node, startPos, pos, startHpr, hpr) - LerpInterval.__init__(self, name, duration, functor, blendType) + if (name == None): + n = 'LerpPosHpr-%d' % self.lerpPosHprNum + self.lerpPosHprNum = self.lerpPosHprNum + 1 + else: + n = name + + LerpInterval.__init__(self, n, duration, functor, blendType) class LerpPosInterval(LerpInterval): - def __init__(self, name, node, pos, duration, startPos=None, - other=None, blendType='noBlend'): - """ __init__(name, node, pos, duration, other, blendType) + lerpPosNum = 1 + + def __init__(self, node, duration, pos, startPos=None, + other=None, blendType='noBlend', name=None): + """ __init__(node, duration, pos, startPos, other, blendType, name) """ import PosLerpFunctor @@ -92,13 +103,21 @@ class LerpPosInterval(LerpInterval): functor = PosLerpFunctor.PosLerpFunctor( node, startPos, pos) - LerpInterval.__init__(self, name, duration, functor, blendType) + if (name == None): + n = 'LerpPos-%d' % self.lerpPosNum + self.lerpPosNum = self.lerpPosNum + 1 + else: + n = name + + LerpInterval.__init__(self, n, duration, functor, blendType) class LerpHprInterval(LerpInterval): - def __init__(self, name, node, hpr, duration, startHpr=None, - other=None, blendType='noBlend'): - """ __init__(name, node, hpr, duration, other, blendType) + lerpHprNum = 1 + + def __init__(self, node, duration, hpr, startHpr=None, + other=None, blendType='noBlend', name=None): + """ __init__(node, duration, hpr, startHpr, other, blendType, name) """ import HprLerpFunctor @@ -117,4 +136,10 @@ class LerpHprInterval(LerpInterval): functor = HprLerpFunctor.HprLerpFunctor( node, startHpr, hpr) - LerpInterval.__init__(self, name, duration, functor, blendType) + if (name == None): + n = 'LerpHpr-%d' % self.lerpHprNum + self.lerpHprNum = self.lerpHprNum + 1 + else: + n = name + + LerpInterval.__init__(self, n, duration, functor, blendType) diff --git a/direct/src/interval/MopathInterval.py b/direct/src/interval/MopathInterval.py index a4a2901070..0f95ce2156 100644 --- a/direct/src/interval/MopathInterval.py +++ b/direct/src/interval/MopathInterval.py @@ -6,15 +6,22 @@ import Mopath class MopathInterval(Interval): + mopathNum = 1 + # special methods - def __init__(self, name, mopath, node): - """__init__(name, mopath, node) + def __init__(self, mopath, node, name=None): + """__init__(mopath, node, name) """ self.node = node self.mopath = mopath duration = self.mopath.getMaxT() - Interval.__init__(self, name, duration) + if (name == None): + n = 'Mopath-%d' % self.mopathNum + self.mopathNum = self.mopathNum + 1 + else: + n = name + Interval.__init__(self, n, duration) def setT(self, t, entry=0): """ setT(t) diff --git a/direct/src/interval/PosHprInterval.py b/direct/src/interval/PosHprInterval.py index d91e78d941..6e632870fc 100644 --- a/direct/src/interval/PosHprInterval.py +++ b/direct/src/interval/PosHprInterval.py @@ -5,15 +5,22 @@ from Interval import * class PosHprInterval(Interval): + posHprNum = 1 + # special methods - def __init__(self, name, node, pos, hpr, duration): - """__init__(name, node, pos, hpr, duration) + def __init__(self, node, pos, hpr, duration, name=None): + """__init__(node, pos, hpr, duration, name) """ self.node = node self.pos = pos self.hpr = hpr - Interval.__init__(self, name, duration) + if (name == None): + n = 'PosHpr-%d' % self.posHprNum + self.posHprNum = self.posHprNum + 1 + else: + n = name + Interval.__init__(self, n, duration) def setT(self, t, entry=0): """ setT(t) @@ -24,14 +31,21 @@ class PosHprInterval(Interval): class PosInterval(Interval): + posNum = 1 + # special methods - def __init__(self, name, node, pos, duration): - """__init__(name, node, pos, duration) + def __init__(self, node, pos, duration, name=None): + """__init__(node, pos, duration, name) """ self.node = node self.pos = pos - Interval.__init__(name, duration) + if (name == None): + n = 'Pos-%d' % self.posNum + self.posNum = self.posNum + 1 + else: + n = name + Interval.__init__(n, duration) def setT(self, t, entry=0): """ setT(t) @@ -42,14 +56,21 @@ class PosInterval(Interval): class HprInterval(Interval): + hprNum = 1 + # special methods - def __init__(self, name, node, hpr, duration): - """__init__(name, node, hpr, duration) + def __init__(self, node, hpr, duration, name=None): + """__init__(node, hpr, duration, name) """ self.node = node self.hpr = hpr - Interval.__init__(name, duration) + if (name == None): + n = 'Hpr-%d' % self.hprNum + self.hprNum = self.hprNum + 1 + else: + n = name + Interval.__init__(n, duration) def setT(self, t, entry=0): """ setT(t) diff --git a/direct/src/interval/SoundInterval.py b/direct/src/interval/SoundInterval.py index b50e34b828..83786c77b6 100644 --- a/direct/src/interval/SoundInterval.py +++ b/direct/src/interval/SoundInterval.py @@ -5,12 +5,13 @@ from Interval import * class SoundInterval(Interval): + soundNum = 1 + # special methods - def __init__(self, name, sound, loop=0): - """__init__(name, sound, loop) + def __init__(self, sound, loop=0, name=None): + """__init__(sound, loop, name) """ - self.name = name self.sound = sound duration = self.sound.length() if (duration == 0.0): @@ -19,7 +20,12 @@ class SoundInterval(Interval): duration = 1.0 self.loop = loop self.isPlaying = 0 - Interval.__init__(self, name, duration) + if (name == None): + n = 'Sound-%d' % self.soundNum + self.soundNum = self.soundNum + 1 + else: + n = name + Interval.__init__(self, n, duration) def setT(self, t, entry=0): """ setT(t) diff --git a/direct/src/interval/Track.py b/direct/src/interval/Track.py index 9557f2753c..9c11cd7513 100644 --- a/direct/src/interval/Track.py +++ b/direct/src/interval/Track.py @@ -14,7 +14,7 @@ class Track(Interval): # special methods - def __init__(self, intervalList, name = None): + def __init__(self, intervalList, name=None): """__init__(intervalList, name) """ if (name == None):