com.jme.animation
Class AnimationController

java.lang.Object
  extended by com.jme.scene.Controller
      extended by com.jme.animation.AnimationController
All Implemented Interfaces:
Savable, java.io.Serializable

public class AnimationController
extends Controller
implements Savable

AnimationController provides a method for managing multiple BoneAnimations. AnimationController maintains a list of available animations to play, and a reference to the currently active animation. The currently active animation can be set via index into the animation set, the name of the animation or a reference to the animation itself. If blending is used, the active animation is not immediately switched, but instead morphs with an incoming animation via crossfading for a specified period of time. When the blend is complete, the active animation is set to the incoming animation. The

Author:
mpowell
See Also:
BoneAnimation, Serialized Form

Field Summary
 
Fields inherited from class com.jme.scene.Controller
RT_CLAMP, RT_CYCLE, RT_WRAP
 
Constructor Summary
AnimationController()
           
 
Method Summary
 void addAnimation(BoneAnimation bac)
           
 void clearActiveAnimation()
           
 void clearAnimations()
           
 BoneAnimation getActiveAnimation()
           
 BoneAnimation getAnimation(int i)
           
 BoneAnimation getAnimation(java.lang.String name)
           
 java.util.ArrayList<BoneAnimation> getAnimations()
           
 BoneAnimation getBlendAnimation()
           
 float getCurTime()
           
 float getMaxTime()
          Returns the current maximum time for this controller.
 float getMinTime()
          Returns the current minimum time of this controller
 Spatial getModelNode()
           
 AnimationProperties getProps()
           
 boolean hasAnimation(java.lang.String name)
           
 void read(JMEImporter e)
           
 void removeAnimation(BoneAnimation bac)
           
 void removeAnimation(int index)
           
 void setActiveAnimation(BoneAnimation bac)
           
 void setActiveAnimation(BoneAnimation bac, boolean blend, float time, boolean sync)
           
 void setActiveAnimation(int index)
           
 void setActiveAnimation(int index, boolean blend, float time, boolean sync)
           
 void setActiveAnimation(java.lang.String name)
           
 void setActiveAnimation(java.lang.String name, boolean blend, float time, AnimationProperties props)
           
 void setBlendAnimation(BoneAnimation blendAnimation, float blendTime, boolean sync)
           
 void setCurrentFrame(int frame)
           
 void setMaxTime(float minTime)
          Has no effect, and that is misleading.
 void setMinTime(float minTime)
          Has no effect, and that is misleading.
 void setModelNode(Spatial modelNode)
           
 void setProps(AnimationProperties props)
           
 void setSkeleton(Bone b)
           
 void update(float time)
          Defined by extending classes, update is a signal to Controller that it should update whatever object(s) it is controlling.
 void updateProps()
           
 void write(JMEExporter e)
           
 
Methods inherited from class com.jme.scene.Controller
getClassTag, getControllerValues, getRepeatType, getSpeed, isActive, setActive, setControllerValues, setRepeatType, setSpeed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jme.util.export.Savable
getClassTag
 

Constructor Detail

AnimationController

public AnimationController()
Method Detail

addAnimation

public void addAnimation(BoneAnimation bac)

hasAnimation

public boolean hasAnimation(java.lang.String name)

getAnimation

public BoneAnimation getAnimation(java.lang.String name)

removeAnimation

public void removeAnimation(BoneAnimation bac)

removeAnimation

public void removeAnimation(int index)

getActiveAnimation

public BoneAnimation getActiveAnimation()

setCurrentFrame

public void setCurrentFrame(int frame)

clearAnimations

public void clearAnimations()

getAnimation

public BoneAnimation getAnimation(int i)

getAnimations

public java.util.ArrayList<BoneAnimation> getAnimations()

clearActiveAnimation

public void clearActiveAnimation()

setBlendAnimation

public void setBlendAnimation(BoneAnimation blendAnimation,
                              float blendTime,
                              boolean sync)

updateProps

public void updateProps()

setActiveAnimation

public void setActiveAnimation(java.lang.String name)

setActiveAnimation

public void setActiveAnimation(java.lang.String name,
                               boolean blend,
                               float time,
                               AnimationProperties props)

setActiveAnimation

public void setActiveAnimation(BoneAnimation bac)

setActiveAnimation

public void setActiveAnimation(BoneAnimation bac,
                               boolean blend,
                               float time,
                               boolean sync)

setActiveAnimation

public void setActiveAnimation(int index)

setActiveAnimation

public void setActiveAnimation(int index,
                               boolean blend,
                               float time,
                               boolean sync)

setSkeleton

public void setSkeleton(Bone b)

update

public void update(float time)
Description copied from class: Controller
Defined by extending classes, update is a signal to Controller that it should update whatever object(s) it is controlling.

Specified by:
update in class Controller
Parameters:
time - The time in seconds between the last call to update and the current one

write

public void write(JMEExporter e)
           throws java.io.IOException
Specified by:
write in interface Savable
Overrides:
write in class Controller
Throws:
java.io.IOException

read

public void read(JMEImporter e)
          throws java.io.IOException
Specified by:
read in interface Savable
Overrides:
read in class Controller
Throws:
java.io.IOException

getBlendAnimation

public BoneAnimation getBlendAnimation()

getModelNode

public Spatial getModelNode()

setModelNode

public void setModelNode(Spatial modelNode)

getProps

public AnimationProperties getProps()

setProps

public void setProps(AnimationProperties props)

setMaxTime

public void setMaxTime(float minTime)
Has no effect, and that is misleading. Should just throw. Does not in order to not break apps that now call it.

Overrides:
setMaxTime in class Controller
Parameters:
minTime - The new maximum time

setMinTime

public void setMinTime(float minTime)
Has no effect, and that is misleading. Should just throw. Does not in order to not break apps that now call it.

Overrides:
setMinTime in class Controller
Parameters:
minTime - The new minimum time.

getMinTime

public float getMinTime()
Description copied from class: Controller
Returns the current minimum time of this controller

Overrides:
getMinTime in class Controller
Returns:
This controller's minimum time

getMaxTime

public float getMaxTime()
Description copied from class: Controller
Returns the current maximum time for this controller.

Overrides:
getMaxTime in class Controller
Returns:
This controller's maximum time.

getCurTime

public float getCurTime()