|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jme.animation.BoneAnimation
public class BoneAnimation
BoneAnimation defines a component that manipulates the position of a skeletal system based on a collection of keyframes. In the simplest case, BoneAnimation directly affects a single bone, and the skeletal system is a tree (skeleton) of these BoneAnimations. The BoneAnimation is defined with an array of keyframe times and a BoneTransform for each bone directly controlled. The animations can have a heirarchical composition, and at any level the animation may not control a bone, but simply control sub-animations. In a typical application, the skeletal tree described above is collapsed down so that only one BoneAnimation object is used at display-time. Though it implements no interface, the intention is that an update method of this class should be called by a Controller.
optimize(boolean)
,
BoneTransform
,
Controller
,
update(float, int, float)
,
Serialized FormField Summary | |
---|---|
static int |
BEZIER
|
static int |
LINEAR
|
Constructor Summary | |
---|---|
BoneAnimation()
|
|
BoneAnimation(java.lang.String name)
Contructor creates a new animation. |
|
BoneAnimation(java.lang.String name,
Bone bone,
int numKeyframes)
Creates a new, linear-interpolating BoneAnimation with a name, the bone it will control and the number of keyframes it will have. |
Method Summary | |
---|---|
void |
addBoneAnimation(BoneAnimation ba)
addBoneAnimation adds a child animation to this animation. |
void |
addBoneTransforms(BoneTransform bt)
addBoneTransform adds a bone transform array pair that this bone animation uses to update. |
void |
addEvent(int frame,
AnimationEvent event)
adds an AnimationEvent to this animation for a specified frame. |
void |
addSync(java.lang.String name,
int[] frames)
add a sync tag to this animation. |
boolean |
assignSkeleton(Bone b)
Assigns this animation to a provided skeleton. |
boolean |
containsSyncTags()
|
java.util.Set<java.lang.String> |
getAllSyncTags()
|
AnimationProperties |
getAnimationProperties()
|
java.util.ArrayList<BoneTransform> |
getBoneTransforms()
returns the list of BoneTransforms for this animation. |
java.lang.Class |
getClassTag()
|
int |
getCurrentFrame()
returns the current frame that animation is currently working towards or set to. |
float |
getCurrentTime()
returns the current time of the animation. |
Spatial |
getDestSpatial()
|
int |
getEndFrame()
retrieves the end frame of the animation. |
float |
getInterpolationRate()
retrieves the rate at which interpolation occurs, this is in unit seconds. |
float[] |
getKeyFrameTimes()
returns the list of keyframe times for this animation. |
java.lang.String |
getName()
returns the name of this animation. |
Bone |
getSourceBone()
|
int |
getStartFrame()
retrieves the start frame of the animation. |
BoneAnimation |
getSubanimation(int i)
returns a child animation from a given index. |
int[] |
getSyncFrames(java.lang.String name)
|
java.util.ArrayList<java.lang.String> |
getSyncNames(int frame)
|
boolean |
hasChildren()
hasChildren returns true if this BoneAnimation has child BoneAnimations, false otherwise. |
boolean |
isInterpolate()
returns true if this animation should interpolate between keyframes, false otherwise. |
boolean |
isValid()
returns true if this animation is valid (i.e. |
void |
optimize(boolean removeChildren)
optimize will attempt to condense the BoneAnimation into as few children as possible. |
void |
read(JMEImporter e)
|
void |
reset()
|
void |
resetCurrentTime()
|
void |
setAnimationProperties(AnimationProperties props)
|
void |
setCurrentFrame(int frame)
setCurrentFrame will set the current position of the animation to the supplied frame. |
void |
setDestSpatial(Spatial destSpatial)
|
void |
setEndFrame(int endFrame)
sets the end frame of the animation. |
void |
setInitialFrame(int frame)
|
void |
setInterpolate(boolean interpolate)
sets whether this animation should interpolate between frames. |
void |
setInterpolationRate(float interpolationRate)
sets the rate at which interpolation occurs, this is in unit seconds. |
void |
setInterpolationTypes(int[] types)
Sets the interpolation types array for the keyframes. |
void |
setName(java.lang.String name)
sets the name of this animation. |
void |
setSourceBone(Bone sourceBone)
|
void |
setStartFrame(int startFrame)
sets the start frame of the animation. |
void |
setTimes(float[] times)
Sets the times array for the keyframes. |
int |
subanimationCount()
returns the number of children animations that are attached to this animation. |
java.lang.String |
toString()
returns the string representation of this animation. |
void |
update(float time,
int repeat,
float speed)
update is called during the update phase of the game cycle. |
void |
update(float time,
int repeat,
float speed,
float blendRate)
This method of update() supports Blending. |
void |
write(JMEExporter e)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int LINEAR
public static final int BEZIER
Constructor Detail |
---|
public BoneAnimation()
public BoneAnimation(java.lang.String name)
name
- the name of the animation.public BoneAnimation(java.lang.String name, Bone bone, int numKeyframes)
name
- the name of the animationbone
- the bone the animation affectsnumKeyframes
- the number of keyframes the animation has.Method Detail |
---|
public void addBoneAnimation(BoneAnimation ba)
ba
- the child animation to add to this animation.public void addEvent(int frame, AnimationEvent event)
frame
- the frame number to trigger the event.event
- the event to trigger.public void addSync(java.lang.String name, int[] frames)
name
- the name of the sync tag.frames
- the frames that are tied to this sync tag.public int[] getSyncFrames(java.lang.String name)
public boolean containsSyncTags()
public java.util.Set<java.lang.String> getAllSyncTags()
public java.util.ArrayList<java.lang.String> getSyncNames(int frame)
public void setInitialFrame(int frame)
public void setCurrentFrame(int frame)
frame
- the frame to set the current animation frame to.public void addBoneTransforms(BoneTransform bt)
bt
- the BoneTransform to add to this list.public void update(float time, int repeat, float speed)
time
- The time
supplied is the time between frames (normally) and this is used to define
what frame of animation we should be at and how to interpolate between
frames.repeat
- Controller.RT_CLAMP
will cause the bones to animate through a single cycle and stop.
Controller.RT_CYCLE
will cause the animation to reverse when it reaches one of the ends
of the cycle.
Controller.RT_WRAP
will start the animation over from the beginning.update(float, int, float, float)
,
Controller
public void update(float time, int repeat, float speed, float blendRate)
update(float, int, float)
public boolean isValid()
public int subanimationCount()
public BoneAnimation getSubanimation(int i)
i
- the index to obtain the animation.
public void setTimes(float[] times)
times
- the times to set.public void setInterpolationTypes(int[] types)
If the interpolation type array is null, interpolation work will be skipped (performance benefit if interpolation not required).
types
- the interpolation types to set, or null for no interpolation.public java.lang.String getName()
public void setName(java.lang.String name)
name
- the name of this animation.public int getCurrentFrame()
public float getCurrentTime()
public int getEndFrame()
public void setEndFrame(int endFrame)
endFrame
- the end frame of the animation.public int getStartFrame()
public void setStartFrame(int startFrame)
startFrame
- the start frame of the animation.public boolean isInterpolate()
public void setInterpolate(boolean interpolate)
interpolate
- true to interpolate, false otherwise.public float getInterpolationRate()
public void setInterpolationRate(float interpolationRate)
interpolationRate
- the interpolation rate.public boolean hasChildren()
public float[] getKeyFrameTimes()
public java.util.ArrayList<BoneTransform> getBoneTransforms()
public void optimize(boolean removeChildren)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean assignSkeleton(Bone b)
b
- the skeleton to assign.
public void write(JMEExporter e) throws java.io.IOException
write
in interface Savable
java.io.IOException
public void read(JMEImporter e) throws java.io.IOException
read
in interface Savable
java.io.IOException
public java.lang.Class getClassTag()
getClassTag
in interface Savable
public void resetCurrentTime()
public void reset()
public Spatial getDestSpatial()
public void setDestSpatial(Spatial destSpatial)
public Bone getSourceBone()
public void setSourceBone(Bone sourceBone)
public AnimationProperties getAnimationProperties()
public void setAnimationProperties(AnimationProperties props)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |