Class AnimLayer
- All Implemented Interfaces:
JmeCloneable
,Cloneable
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 Summary
Modifier and TypeMethodDescriptionvoid
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.Returns the Action that's currently running.Returns the name of the Action that's currently running.Returns the current manager.getMask()
Returns the animation mask.getName()
Returns the layer name.double
getTime()
Returns the animation time, in scaled seconds.boolean
jmeClone()
Performs a regular shallow clone of the object.void
setCurrentAction
(Action actionToRun) Runs the specified Action, starting from time = 0.void
setCurrentAction
(String actionName, Action actionToRun) Runs the specified Action, starting from time = 0.void
setCurrentAction
(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
(Object manager) Assigns the specified manager.void
setTime
(double animationTime) Changes the animation time, wrapping the specified time to fit the current Action.
-
Method Details
-
getCurrentAction
Returns the Action that's currently running.- Returns:
- the pre-existing instance, or null if none
-
getCurrentActionName
Returns the name of the Action that's currently running.- Returns:
- the pre-existing instance, or null if none
-
getManager
Returns the current manager.- Returns:
- the pre-existing object (such as an AnimEvent) or null for unknown
-
getMask
Returns the animation mask.- Returns:
- the pre-existing instance, or null if this layer can animate the entire model
-
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
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
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 nameactionToRun
- the Action to run (alias created) or null for no action
-
setCurrentAction
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 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 running
-
setManager
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
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 interfaceJmeCloneable
- 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
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 interfaceJmeCloneable
- Returns:
- a new instance
-