瀏覽代碼

*** empty log message ***

Mike Goslin 25 年之前
父節點
當前提交
b70c6b171d
共有 3 個文件被更改,包括 2 次插入64 次删除
  1. 0 60
      direct/src/interval/AnimInterval.py
  2. 0 1
      direct/src/interval/IntervalGlobal.py
  3. 2 3
      direct/src/interval/IntervalTest.py

+ 0 - 60
direct/src/interval/AnimInterval.py

@@ -1,60 +0,0 @@
-"""AnimInterval module: contains the AnimInterval class"""
-
-from PandaModules import *
-from Interval import *
-
-class AnimInterval(Interval):
-    # Name counter
-    animNum = 1
-    # Class methods
-    # Interval used to play an animation.  If loop = 0, animation is
-    # played only once and the pose of the anim depends on t passed
-    # into the setT method every frame.  If loop = 1, the animation is
-    # started and plays on its own and stopped when t > duration or
-    # IVAL_STOP event occurs.  If no duration is specified, interval
-    # duration defaults to be equal to the length of the animation.
-    # Note: if loop == 0 and duration > anim duration then the animation
-    # will play once and then nothing will happen for the remainder of the
-    # interval
-    def __init__(self, animControl, loop = 0, duration = 0.0, name=None):
-        """__init__(name)
-        """
-        # Record class specific variables
-	self.animControl = animControl
-        self.loop = loop
-        # Generate unique name if necessary
-	if (name == None):
-	    name = 'Anim-%d' % AnimInterval.animNum
-	    AnimInterval.animNum += 1
-        # Compute anim duration
-        self.numFrames = self.animControl.getNumFrames()
-        if duration == 0.0:
-            duration = (float(self.numFrames)/animControl.getFrameRate())
-        # Initialize superclass
-	Interval.__init__(self, name, duration)
-    def updateFunc(self, t, event = IVAL_NONE):
-	""" updateFunc(t, event)
-	    Go to time t
-	"""
-        # Update animation based upon current time
-        # Pose or stop anim
-        if (t >= self.getDuration()) or (event == IVAL_STOP):
-            self.animControl.stop()
-        elif self.loop == 1:
-            if event == IVAL_INIT:
-                # Determine the current frame
-                frame = (int(self.animControl.getFrameRate() * t) %
-                         self.numFrames)
-                # Pose anim
-                self.animControl.pose(frame)
-                # And start loop
-                self.animControl.loop(0)
-        else:
-            # Determine the current frame
-            frame = (int(self.animControl.getFrameRate() * t) %
-                     self.numFrames)
-            # Pose anim
-            self.animControl.pose(frame)
-            
-
-

+ 0 - 1
direct/src/interval/IntervalGlobal.py

@@ -2,7 +2,6 @@
 
 
 from DirectObject import *
 from DirectObject import *
 from Interval import *
 from Interval import *
-from AnimInterval import *
 from ActorInterval import *
 from ActorInterval import *
 from FunctionInterval import *
 from FunctionInterval import *
 from LerpInterval import *
 from LerpInterval import *

+ 2 - 3
direct/src/interval/IntervalTest.py

@@ -11,7 +11,6 @@ boat.reparentTo(render)
 donald = Actor()
 donald = Actor()
 donald.loadModel("phase_3/models/char/donald-wheel-mod")
 donald.loadModel("phase_3/models/char/donald-wheel-mod")
 donald.loadAnims({"steer":"phase_3/models/char/donald-wheel-chan"})
 donald.loadAnims({"steer":"phase_3/models/char/donald-wheel-chan"})
-steerAnimControl = donald.getAnimControl('steer', 'modelRoot')
 donald.reparentTo(boat)
 donald.reparentTo(boat)
 
 
 dock = loader.loadModel('models/directmodels/smiley')
 dock = loader.loadModel('models/directmodels/smiley')
@@ -29,10 +28,10 @@ BOAT_START = boatTrack.getIntervalStartTime('boatpath')
 BOAT_END = boatTrack.getIntervalEndTime('boatpath')
 BOAT_END = boatTrack.getIntervalEndTime('boatpath')
 
 
 # This will create an anim interval that is posed every frame
 # This will create an anim interval that is posed every frame
-donaldSteerInterval = AnimInterval(steerAnimControl)
+donaldSteerInterval = ActorInterval(donald, 'steer')
 # This will create an anim interval that is started at t = 0 and then
 # This will create an anim interval that is started at t = 0 and then
 # loops for 10 seconds
 # loops for 10 seconds
-donaldLoopInterval = AnimInterval(steerAnimControl, loop = 1, duration = 10.0)
+donaldLoopInterval = ActorInterval(donald, 'steer', loop=1, duration = 10.0)
 donaldSteerTrack = Track([donaldSteerInterval, donaldLoopInterval],
 donaldSteerTrack = Track([donaldSteerInterval, donaldLoopInterval],
                          name = 'steerTrack')
                          name = 'steerTrack')