From 6da0c1e352322b8d036341350e692eb360b07182 Mon Sep 17 00:00:00 2001 From: Dave Schuyler Date: Wed, 26 Nov 2003 02:54:08 +0000 Subject: [PATCH] changed node arg to nodePath in intervals --- direct/src/interval/LerpInterval.py | 44 +++++++++--------- direct/src/level/CutScene.py | 71 ++++++++++++++++++++--------- 2 files changed, 71 insertions(+), 44 deletions(-) diff --git a/direct/src/interval/LerpInterval.py b/direct/src/interval/LerpInterval.py index c3a1e73e66..da39249670 100644 --- a/direct/src/interval/LerpInterval.py +++ b/direct/src/interval/LerpInterval.py @@ -18,7 +18,7 @@ class LerpNodePathInterval(CLerpNodePathInterval): lerpNodePathNum = 1 def __init__(self, name, duration, blendType, bakeInStart, fluid, - node, other): + nodePath, other): if name == None: name = '%s-%d' % (self.__class__.__name__, self.lerpNodePathNum) LerpNodePathInterval.lerpNodePathNum += 1 @@ -30,7 +30,7 @@ class LerpNodePathInterval(CLerpNodePathInterval): other = NodePath() CLerpNodePathInterval.__init__(self, name, duration, blendType, - bakeInStart, fluid, node, other) + bakeInStart, fluid, nodePath, other) def anyCallable(self, *params): # Returns true if any of the parameters listed is a callable @@ -81,11 +81,11 @@ class LerpNodePathInterval(CLerpNodePathInterval): ##################################################################### class LerpPosInterval(LerpNodePathInterval): - def __init__(self, node, duration, pos, startPos = None, + def __init__(self, nodePath, duration, pos, startPos = None, other = None, blendType = 'noBlend', bakeInStart = 1, fluid = 0, name = None): LerpNodePathInterval.__init__(self, name, duration, blendType, - bakeInStart, fluid, node, other) + bakeInStart, fluid, nodePath, other) # Check for functors in the input parameters. self.paramSetup = self.anyCallable(pos, startPos) @@ -108,11 +108,11 @@ class LerpPosInterval(LerpNodePathInterval): class LerpHprInterval(LerpNodePathInterval): - def __init__(self, node, duration, hpr, startHpr = None, + def __init__(self, nodePath, duration, hpr, startHpr = None, other = None, blendType = 'noBlend', bakeInStart = 1, fluid = 0, name = None): LerpNodePathInterval.__init__(self, name, duration, blendType, - bakeInStart, fluid, node, other) + bakeInStart, fluid, nodePath, other) # Check for functors in the input parameters. self.paramSetup = self.anyCallable(hpr, startHpr) @@ -134,11 +134,11 @@ class LerpHprInterval(LerpNodePathInterval): LerpNodePathInterval.privDoEvent(self, t, event) class LerpScaleInterval(LerpNodePathInterval): - def __init__(self, node, duration, scale, startScale = None, + def __init__(self, nodePath, duration, scale, startScale = None, other = None, blendType = 'noBlend', bakeInStart = 1, fluid = 0, name = None): LerpNodePathInterval.__init__(self, name, duration, blendType, - bakeInStart, fluid, node, other) + bakeInStart, fluid, nodePath, other) # Check for functors in the input parameters. self.paramSetup = self.anyCallable(scale, startScale) if self.paramSetup: @@ -159,11 +159,11 @@ class LerpScaleInterval(LerpNodePathInterval): LerpNodePathInterval.privDoEvent(self, t, event) class LerpShearInterval(LerpNodePathInterval): - def __init__(self, node, duration, shear, startShear = None, + def __init__(self, nodePath, duration, shear, startShear = None, other = None, blendType = 'noBlend', bakeInStart = 1, fluid = 0, name = None): LerpNodePathInterval.__init__(self, name, duration, blendType, - bakeInStart, fluid, node, other) + bakeInStart, fluid, nodePath, other) # Check for functors in the input parameters. self.paramSetup = self.anyCallable(shear, startShear) if self.paramSetup: @@ -184,12 +184,12 @@ class LerpShearInterval(LerpNodePathInterval): LerpNodePathInterval.privDoEvent(self, t, event) class LerpPosHprInterval(LerpNodePathInterval): - def __init__(self, node, duration, pos, hpr, + def __init__(self, nodePath, duration, pos, hpr, startPos = None, startHpr = None, other = None, blendType = 'noBlend', bakeInStart = 1, fluid = 0, name = None): LerpNodePathInterval.__init__(self, name, duration, blendType, - bakeInStart, fluid, node, other) + bakeInStart, fluid, nodePath, other) # Check for functors in the input parameters. self.paramSetup = self.anyCallable(pos, startPos, hpr, startHpr) if self.paramSetup: @@ -217,12 +217,12 @@ class LerpPosHprInterval(LerpNodePathInterval): LerpNodePathInterval.privDoEvent(self, t, event) class LerpHprScaleInterval(LerpNodePathInterval): - def __init__(self, node, duration, hpr, scale, + def __init__(self, nodePath, duration, hpr, scale, startHpr = None, startScale = None, other = None, blendType = 'noBlend', bakeInStart = 1, fluid = 0, name = None): LerpNodePathInterval.__init__(self, name, duration, blendType, - bakeInStart, fluid, node, other) + bakeInStart, fluid, nodePath, other) # Check for functors in the input parameters. self.paramSetup = self.anyCallable(hpr, startHpr, scale, startScale) @@ -251,12 +251,12 @@ class LerpHprScaleInterval(LerpNodePathInterval): LerpNodePathInterval.privDoEvent(self, t, event) class LerpPosHprScaleInterval(LerpNodePathInterval): - def __init__(self, node, duration, pos, hpr, scale, + def __init__(self, nodePath, duration, pos, hpr, scale, startPos = None, startHpr = None, startScale = None, other = None, blendType = 'noBlend', bakeInStart = 1, fluid = 0, name = None): LerpNodePathInterval.__init__(self, name, duration, blendType, - bakeInStart, fluid, node, other) + bakeInStart, fluid, nodePath, other) # Check for functors in the input parameters. self.paramSetup = self.anyCallable(pos, startPos, hpr, startHpr, scale, startScale) if self.paramSetup: @@ -291,12 +291,12 @@ class LerpPosHprScaleInterval(LerpNodePathInterval): LerpNodePathInterval.privDoEvent(self, t, event) class LerpPosHprScaleShearInterval(LerpNodePathInterval): - def __init__(self, node, duration, pos, hpr, scale, shear, + def __init__(self, nodePath, duration, pos, hpr, scale, shear, startPos = None, startHpr = None, startScale = None, startShear = None, other = None, blendType = 'noBlend', bakeInStart = 1, fluid = 0, name = None): LerpNodePathInterval.__init__(self, name, duration, blendType, - bakeInStart, fluid, node, other) + bakeInStart, fluid, nodePath, other) # Check for functors in the input parameters. self.paramSetup = self.anyCallable(pos, startPos, hpr, startHpr, scale, startScale, shear, startShear) if self.paramSetup: @@ -338,21 +338,21 @@ class LerpPosHprScaleShearInterval(LerpNodePathInterval): LerpNodePathInterval.privDoEvent(self, t, event) class LerpColorScaleInterval(LerpNodePathInterval): - def __init__(self, node, duration, colorScale, startColorScale = None, + def __init__(self, nodePath, duration, colorScale, startColorScale = None, other = None, blendType = 'noBlend', bakeInStart = 1, fluid = 0, name = None): LerpNodePathInterval.__init__(self, name, duration, blendType, - bakeInStart, fluid, node, other) + bakeInStart, fluid, nodePath, other) self.setEndColorScale(colorScale) if startColorScale != None: self.setStartColorScale(startColorScale) class LerpColorInterval(LerpNodePathInterval): - def __init__(self, node, duration, color, startColor = None, + def __init__(self, nodePath, duration, color, startColor = None, other = None, blendType = 'noBlend', bakeInStart = 1, fluid = 0, name = None): LerpNodePathInterval.__init__(self, name, duration, blendType, - bakeInStart, fluid, node, other) + bakeInStart, fluid, nodePath, other) self.setEndColor(color) if startColor != None: self.setStartColor(startColor) diff --git a/direct/src/level/CutScene.py b/direct/src/level/CutScene.py index c89846a53c..cab8965e2f 100755 --- a/direct/src/level/CutScene.py +++ b/direct/src/level/CutScene.py @@ -3,7 +3,7 @@ import DirectObject import DirectNotifyGlobal -import Entity +import BasicEntities from PandaModules import * from ShowBaseGlobal import * @@ -57,30 +57,56 @@ def foo1(self, track, subjectNodePath, duration): track, subjectNodePath, duration))) track.append(Sequence( Func(toonbase.localToon.stopUpdateSmartCamera), - LerpPosHprInterval(node=camera, - other=subjectNodePath, - duration=0.0, - pos=Point3(-2, -35, 7.5), - hpr=VBase3(-7, 0, 0), - blendType="easeInOut"), - LerpPosHprInterval(node=camera, - other=subjectNodePath, - duration=duration, - pos=Point3(2, -22, 7.5), - hpr=VBase3(4, 0, 0), - blendType="easeInOut"), - LerpPosHprInterval(node=camera, - other=subjectNodePath, - duration=0.0, - pos=Point3(0, -28, 7.5), - hpr=VBase3(0, 0, 0), - blendType="easeInOut"), + PosHprInterval( + camera, + other=subjectNodePath, + pos=Point3(-2, -35, 7.5), + hpr=VBase3(-7, 0, 0)), + LerpPosHprInterval( + nodePath=camera, + other=subjectNodePath, + duration=duration, + pos=Point3(2, -22, 7.5), + hpr=VBase3(4, 0, 0), + blendType="easeInOut"), + PosHprInterval( + camera, + other=subjectNodePath, + pos=Point3(0, -28, 7.5), + hpr=VBase3(0, 0, 0)), + Func(toonbase.localToon.startUpdateSmartCamera), + )) + return track + +def doorUnlock(self, track, subjectNodePath, duration): + assert(self.debugPrint( + "foo1(track=%s, subjectNodePath=%s, duration=%s)"%( + track, subjectNodePath, duration))) + track.append(Sequence( + Func(toonbase.localToon.stopUpdateSmartCamera), + PosHprInterval( + camera, + other=self, + pos=Point3(-2, -35, 7.5), + hpr=VBase3(-7, 0, 0)), + LerpPosHprInterval( + nodePath=camera, + other=self, + duration=duration, + pos=Point3(2, -22, 7.5), + hpr=VBase3(4, 0, 0), + blendType="easeInOut"), + PosHprInterval( + camera, + other=self, + pos=Point3(0, -28, 7.5), + hpr=VBase3(0, 0, 0)), Func(toonbase.localToon.startUpdateSmartCamera), )) return track -class CutScene(Entity.Entity, DirectObject.DirectObject): +class CutScene(BasicEntities.NodePathEntity, DirectObject.DirectObject): if __debug__: notify = DirectNotifyGlobal.directNotify.newCategory('CutScene') @@ -92,6 +118,7 @@ class CutScene(Entity.Entity, DirectObject.DirectObject): motions={ "foo1": foo1, + "doorUnlock": doorUnlock, } def __init__(self, level, entId): @@ -99,7 +126,7 @@ class CutScene(Entity.Entity, DirectObject.DirectObject): "CutScene(level=%s, entId=%s)" %(level, entId))) DirectObject.DirectObject.__init__(self) - Entity.Entity.__init__(self, level, entId) + BasicEntities.NodePathEntity.__init__(self, level, entId) self.track = None self.setEffect(self.effect) self.setMotion(self.motion) @@ -113,7 +140,7 @@ class CutScene(Entity.Entity, DirectObject.DirectObject): assert(self.debugPrint("destroy()")) self.ignore(self.startStopEvent) self.startStopEvent = None - Entity.Entity.destroy(self) + BasicEntities.NodePathEntity.destroy(self) #DirectObject.DirectObject.destroy(self) def setEffect(self, effect):