Package com.jme3.anim

Class AnimLayer

java.lang.Object
com.jme3.anim.AnimLayer
All Implemented Interfaces:
JmeCloneable, Cloneable

public class AnimLayer extends Object implements JmeCloneable
A named portion of an AnimComposer that can run (at most) one Action at a time.

A composer with multiple layers can run multiple actions simultaneously. For instance, one layer could run a "wave" action on the model's upper body while another ran a "walk" action on the model's lower body.

A layer cannot be shared between multiple composers.

Animation time may advance at a different rate from application time, based on speedup factors in the composer and the current Action.

  • Method Details

    • getCurrentAction

      public Action getCurrentAction()
      Returns the Action that's currently running.
      Returns:
      the pre-existing instance, or null if none
    • getCurrentActionName

      public String getCurrentActionName()
      Returns the name of the Action that's currently running.
      Returns:
      the pre-existing instance, or null if none
    • getManager

      public Object getManager()
      Returns the current manager.
      Returns:
      the pre-existing object (such as an AnimEvent) or null for unknown
    • getMask

      public AnimationMask getMask()
      Returns the animation mask.
      Returns:
      the pre-existing instance, or null if this layer can animate the entire model
    • getName

      public String getName()
      Returns the layer name.
      Returns:
      the name of this layer
    • getTime

      public double getTime()
      Returns the animation time, in scaled seconds.
      Returns:
      the current animation time (not negative)
    • setCurrentAction

      public void setCurrentAction(Action actionToRun)
      Runs the specified Action, starting from time = 0. This cancels any Action previously running on this layer. By default Action will loop.
      Parameters:
      actionToRun - the Action to run (alias created) or null for no action
    • setCurrentAction

      public void setCurrentAction(String actionName, Action actionToRun)
      Runs the specified Action, starting from time = 0. This cancels any Action previously running on this layer. By default Action will loop.
      Parameters:
      actionName - the Action name or null for no action name
      actionToRun - the Action to run (alias created) or null for no action
    • setCurrentAction

      public void setCurrentAction(String actionName, Action actionToRun, boolean loop)
      Runs the specified Action, starting from time = 0. This cancels any Action previously running on this layer.
      Parameters:
      actionName - the Action name or null for no action name
      actionToRun - the Action to run (alias created) or null for no action
      loop - true if Action must loop. If it is false, Action will be removed after finished running
    • setManager

      public void setManager(Object manager)
      Assigns the specified manager. This cancels any manager previously assigned.
      Parameters:
      manager - the desired manager (such as an AnimEvent, alias created) or null for unknown manager
    • setTime

      public void setTime(double animationTime)
      Changes the animation time, wrapping the specified time to fit the current Action. An Action must be running.
      Parameters:
      animationTime - the desired time (in scaled seconds)
    • isLooping

      public boolean isLooping()
      Returns:
      True if the Action will keep looping after it is done playing, otherwise, returns false
    • setLooping

      public void setLooping(boolean loop)
      Sets the looping mode for this layer. The default is true.
      Parameters:
      loop - True if the action should keep looping after it is done playing
    • cloneFields

      public void cloneFields(Cloner cloner, Object original)
      Converts this shallow-cloned layer into a deep-cloned one, using the specified Cloner and original to resolve copied fields.

      The clone's current Action gets nulled out. Its manager and mask get aliased to the original's manager and mask.

      Specified by:
      cloneFields in interface JmeCloneable
      Parameters:
      cloner - the Cloner that's cloning this layer (not null)
      original - the instance from which this layer was shallow-cloned (not null, unaffected)
    • jmeClone

      public Object jmeClone()
      Description copied from interface: JmeCloneable
      Performs a regular shallow clone of the object. Some fields may also be cloned but generally only if they will never be shared with other objects. (For example, local Vector3fs and so on.)

      This method is separate from the regular clone() method so that objects might still maintain their own regular java clone() semantics (perhaps even using Cloner for those methods). However, because Java's clone() has specific features in the sense of Object's clone() implementation, it's usually best to have some path for subclasses to bypass the public clone() method that might be cloning fields and instead get at the superclass protected clone() methods. For example, through super.jmeClone() or another protected clone method that some base class eventually calls super.clone() in.

      Specified by:
      jmeClone in interface JmeCloneable
      Returns:
      a new instance