public class AnimLayer extends java.lang.Object implements JmeCloneable
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.
Modifier and Type | Method and Description |
---|---|
void |
cloneFields(Cloner cloner,
java.lang.Object original)
Converts this shallow-cloned layer into a deep-cloned one, using the
specified Cloner and original to resolve copied fields.
|
Action |
getCurrentAction()
Returns the Action that's currently running.
|
java.lang.String |
getCurrentActionName()
Returns the name of the Action that's currently running.
|
java.lang.Object |
getManager()
Returns the current manager.
|
AnimationMask |
getMask()
Returns the animation mask.
|
java.lang.String |
getName()
Returns the layer name.
|
double |
getTime()
Returns the animation time, in scaled seconds.
|
boolean |
isLooping() |
java.lang.Object |
jmeClone()
Performs a regular shallow clone of the object.
|
void |
setCurrentAction(Action actionToRun)
Runs the specified Action, starting from time = 0.
|
void |
setCurrentAction(java.lang.String actionName,
Action actionToRun)
Runs the specified Action, starting from time = 0.
|
void |
setCurrentAction(java.lang.String actionName,
Action actionToRun,
boolean loop)
Runs the specified Action, starting from time = 0.
|
void |
setLooping(boolean loop)
Sets the looping mode for this layer.
|
void |
setManager(java.lang.Object manager)
Assigns the specified manager.
|
void |
setTime(double animationTime)
Changes the animation time, wrapping the specified time to fit the
current Action.
|
public Action getCurrentAction()
public java.lang.String getCurrentActionName()
public java.lang.Object getManager()
public AnimationMask getMask()
public java.lang.String getName()
public double getTime()
public void setCurrentAction(Action actionToRun)
actionToRun
- the Action to run (alias created) or null for no
actionpublic void setCurrentAction(java.lang.String actionName, Action actionToRun)
actionName
- the Action name or null for no action nameactionToRun
- the Action to run (alias created) or null for no
actionpublic void setCurrentAction(java.lang.String actionName, Action actionToRun, boolean loop)
actionName
- the Action name or null for no action nameactionToRun
- the Action to run (alias created) or null for no
actionloop
- true if Action must loop. If it is false, Action will be
removed after finished runningpublic void setManager(java.lang.Object manager)
manager
- the desired manager (such as an AnimEvent, alias created)
or null for unknown managerpublic void setTime(double animationTime)
animationTime
- the desired time (in scaled seconds)public boolean isLooping()
public void setLooping(boolean loop)
loop
- True if the action should keep looping after it is done
playingpublic void cloneFields(Cloner cloner, java.lang.Object original)
The clone's current Action gets nulled out. Its manager and mask get aliased to the original's manager and mask.
cloneFields
in interface JmeCloneable
cloner
- the Cloner that's cloning this layer (not null)original
- the instance from which this layer was shallow-cloned
(not null, unaffected)public java.lang.Object jmeClone()
JmeCloneable
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.
jmeClone
in interface JmeCloneable