*** empty log message ***

This commit is contained in:
Mike Goslin 2001-04-11 01:38:29 +00:00
parent dfc77d2ccf
commit b70c6b171d
3 changed files with 2 additions and 64 deletions

View File

@ -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)

View File

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

View File

@ -11,7 +11,6 @@ boat.reparentTo(render)
donald = Actor()
donald.loadModel("phase_3/models/char/donald-wheel-mod")
donald.loadAnims({"steer":"phase_3/models/char/donald-wheel-chan"})
steerAnimControl = donald.getAnimControl('steer', 'modelRoot')
donald.reparentTo(boat)
dock = loader.loadModel('models/directmodels/smiley')
@ -29,10 +28,10 @@ BOAT_START = boatTrack.getIntervalStartTime('boatpath')
BOAT_END = boatTrack.getIntervalEndTime('boatpath')
# 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
# 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],
name = 'steerTrack')