Package jme3utilities.wes
Class AnimationEdit
java.lang.Object
jme3utilities.wes.AnimationEdit
Utility methods for editing JME animations.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddTrack(com.jme3.anim.AnimClip clip, com.jme3.anim.AnimTrack<?> track) Add the specified AnimTrack to the specified AnimClip.static com.jme3.anim.AnimClipconvertToInPlace(com.jme3.anim.AnimClip sourceClip, String resultName) Copy the specified AnimClip, converting it from a traveling animation to an in-place animation.static com.jme3.anim.AnimClipextractAnimation(com.jme3.anim.AnimClip sourceClip, float startTime, float endTime, TweenTransforms techniques, String resultName) Extract a range from the specified AnimClip.static com.jme3.animation.AnimationextractAnimation(com.jme3.animation.Animation sourceAnimation, float startTime, float endTime, TweenTransforms techniques, String resultName) Extract a range from the specified Animation.static intnormalizeQuaternions(com.jme3.anim.AnimClip clip, float tolerance) Normalize all quaternions in an AnimClip.static intnormalizeQuaternions(com.jme3.animation.Animation animation, float tolerance) Normalize all quaternions in an Animation.static intremoveRepeats(com.jme3.anim.AnimClip clip) Remove repetitious keyframes from an AnimClip.static intremoveRepeats(com.jme3.animation.Animation animation) Remove repetitious keyframes from an Animation.static com.jme3.anim.AnimClipreplaceTranslations(com.jme3.anim.AnimClip sourceClip, com.jme3.anim.TransformTrack sourceTrack, com.jme3.math.Vector3f[] translations, String resultName) Copy the specified AnimClip, replacing all translations in the specified track.static com.jme3.anim.AnimClipretargetAnimation(com.jme3.anim.AnimClip sourceClip, com.jme3.anim.Armature sourceArmature, com.jme3.anim.Armature targetArmature, SkeletonMapping map, String resultName) Re-target the specified AnimClip from the specified source armature to the specified target armature using the specified map.static com.jme3.animation.AnimationretargetAnimation(com.jme3.anim.AnimClip sourceClip, com.jme3.anim.Armature sourceArmature, com.jme3.animation.Skeleton targetSkeleton, SkeletonMapping map, String resultName) Re-target the specified Animation from the specified source armature to the specified target skeleton using the specified map.static com.jme3.animation.AnimationretargetAnimation(com.jme3.animation.Animation sourceAnimation, com.jme3.animation.Skeleton sourceSkeleton, com.jme3.animation.Skeleton targetSkeleton, SkeletonMapping map, TweenTransforms techniques, String resultName) Re-target the specified Animation from the specified source Skeleton to the specified target Skeleton using the specified map.static com.jme3.anim.AnimClipretargetClip(com.jme3.anim.AnimClip clip, com.jme3.anim.Armature armature, String clipName) Retarget an AnimClip to the specified Armature without using aSkeletonMap.static com.jme3.anim.AnimClipreverseAnimation(com.jme3.anim.AnimClip sourceClip, String resultName) Reverse the specified AnimClip.static com.jme3.animation.AnimationreverseAnimation(com.jme3.animation.Animation sourceAnimation, String resultName) Reverse the specified Animation.static com.jme3.anim.AnimClipsetDuration(com.jme3.anim.AnimClip sourceClip, float newDuration, String resultName) Alter the duration of the specified AnimClip.static com.jme3.anim.AnimCliptranslateForInitialSupport(com.jme3.anim.AnimClip sourceClip, int jointIndex, com.jme3.anim.Armature armature, com.jme3.scene.Spatial subtree, float supportY, String resultName) Translate the targeted track of the specified clip to put the initial point of support at the specified Y-coordinate.static com.jme3.anim.AnimCliptranslateForSupport(com.jme3.anim.AnimClip sourceClip, int jointIndex, com.jme3.anim.Armature armature, com.jme3.scene.Spatial subtree, float supportY, String resultName) Translate the targeted track of the specified clip to put the point of support continuously at the specified Y-coordinate.static com.jme3.anim.AnimCliptranslateForTraction(com.jme3.anim.AnimClip sourceClip, int jointIndex, com.jme3.anim.Armature armature, com.jme3.scene.Spatial subtree, String resultName) Translate the targeted track of the specified clip to simulate traction at the point of support.static intzeroFirst(com.jme3.anim.AnimClip clip) Repair all tracks in which the first keyframe isn't at time=0.static intzeroFirst(com.jme3.animation.Animation animation) Repair all tracks in which the first keyframe isn't at time=0.
-
Method Details
-
addTrack
public static void addTrack(com.jme3.anim.AnimClip clip, com.jme3.anim.AnimTrack<?> track) Add the specified AnimTrack to the specified AnimClip.- Parameters:
clip- the clip to augment (not null, modified)track- the track to add (not null, alias created)
-
convertToInPlace
public static com.jme3.anim.AnimClip convertToInPlace(com.jme3.anim.AnimClip sourceClip, String resultName) Copy the specified AnimClip, converting it from a traveling animation to an in-place animation. Rotations and scales aren't considered. Works best on cyclic animations.- Parameters:
sourceClip- the AnimClip to copy (not null, unaffected)resultName- name for the resulting AnimClip (not null)- Returns:
- a new AnimClip with the specified name
-
extractAnimation
public static com.jme3.animation.Animation extractAnimation(com.jme3.animation.Animation sourceAnimation, float startTime, float endTime, TweenTransforms techniques, String resultName) Extract a range from the specified Animation.- Parameters:
sourceAnimation- the Animation to extract from (not null, unaffected)startTime- the start of the range (in seconds, >0, ≤endTime)endTime- the end of the range (in seconds, ≥startTime)techniques- tweening techniques to use (unaffected)resultName- a name for the resulting Animation (not null)- Returns:
- a new Animation
-
extractAnimation
public static com.jme3.anim.AnimClip extractAnimation(com.jme3.anim.AnimClip sourceClip, float startTime, float endTime, TweenTransforms techniques, String resultName) Extract a range from the specified AnimClip.- Parameters:
sourceClip- the AnimClip to extract from (not null, unaffected)startTime- the start of the range (in seconds, >0, ≤endTime)endTime- the end of the range (in seconds, ≥startTime)techniques- tweening techniques to use (unaffected)resultName- a name for the resulting AnimClip (not null)- Returns:
- a new AnimClip
-
normalizeQuaternions
public static int normalizeQuaternions(com.jme3.animation.Animation animation, float tolerance) Normalize all quaternions in an Animation.- Parameters:
animation- (not null, modified)tolerance- for norms (≥0)- Returns:
- the number of tracks edited (≥0)
-
normalizeQuaternions
public static int normalizeQuaternions(com.jme3.anim.AnimClip clip, float tolerance) Normalize all quaternions in an AnimClip.- Parameters:
clip- (not null, modified)tolerance- for norms (≥0)- Returns:
- the number of tracks edited (≥0)
-
removeRepeats
public static int removeRepeats(com.jme3.animation.Animation animation) Remove repetitious keyframes from an Animation.- Parameters:
animation- (not null, modified)- Returns:
- the number of tracks edited (≥0)
-
removeRepeats
public static int removeRepeats(com.jme3.anim.AnimClip clip) Remove repetitious keyframes from an AnimClip.- Parameters:
clip- (not null, modified)- Returns:
- the number of tracks edited (≥0)
-
replaceTranslations
public static com.jme3.anim.AnimClip replaceTranslations(com.jme3.anim.AnimClip sourceClip, com.jme3.anim.TransformTrack sourceTrack, com.jme3.math.Vector3f[] translations, String resultName) Copy the specified AnimClip, replacing all translations in the specified track.- Parameters:
sourceClip- the AnimClip to copy (not null, unaffected)sourceTrack- the track insourceClipthat's to be modified (not null, unaffected)translations- the desired translations for the modified track (not null, alias created)resultName- name for the resulting AnimClip (not null)- Returns:
- a new AnimClip with the specified name
-
retargetAnimation
public static com.jme3.animation.Animation retargetAnimation(com.jme3.animation.Animation sourceAnimation, com.jme3.animation.Skeleton sourceSkeleton, com.jme3.animation.Skeleton targetSkeleton, SkeletonMapping map, TweenTransforms techniques, String resultName) Re-target the specified Animation from the specified source Skeleton to the specified target Skeleton using the specified map.- Parameters:
sourceAnimation- which Animation to re-target (not null, unaffected)sourceSkeleton- (not null, unaffected)targetSkeleton- (not null, unaffected)map- the skeleton map to use (not null, unaffected)techniques- the tweening techniques to use (not null, unaffected)resultName- name for the resulting Animation (not null)- Returns:
- a new Animation
-
retargetAnimation
public static com.jme3.anim.AnimClip retargetAnimation(com.jme3.anim.AnimClip sourceClip, com.jme3.anim.Armature sourceArmature, com.jme3.anim.Armature targetArmature, SkeletonMapping map, String resultName) Re-target the specified AnimClip from the specified source armature to the specified target armature using the specified map.- Parameters:
sourceClip- which AnimClip to re-target (not null, unaffected)sourceArmature- (not null, unaffected)targetArmature- (not null, unaffected)map- the skeleton map to use (not null, unaffected)resultName- name for the resulting AnimClip (not null)- Returns:
- a new AnimClip
-
retargetAnimation
public static com.jme3.animation.Animation retargetAnimation(com.jme3.anim.AnimClip sourceClip, com.jme3.anim.Armature sourceArmature, com.jme3.animation.Skeleton targetSkeleton, SkeletonMapping map, String resultName) Re-target the specified Animation from the specified source armature to the specified target skeleton using the specified map.- Parameters:
sourceClip- which AnimClip to re-target (not null, unaffected)sourceArmature- (not null, unaffected)targetSkeleton- (not null, unaffected)map- the skeleton map to use (not null, unaffected)resultName- name for the resulting Animation (not null)- Returns:
- a new Animation
-
retargetClip
public static com.jme3.anim.AnimClip retargetClip(com.jme3.anim.AnimClip clip, com.jme3.anim.Armature armature, String clipName) Retarget an AnimClip to the specified Armature without using aSkeletonMap. This technique preserves any translation and/or scaling in the joint tracks.- Parameters:
clip- the clip to retarget (not null)armature- the target armature (not null, unaffected)clipName- desired name for the new clip- Returns:
- a new clip containing modified pre-existing tracks
-
reverseAnimation
public static com.jme3.animation.Animation reverseAnimation(com.jme3.animation.Animation sourceAnimation, String resultName) Reverse the specified Animation. All tracks in the Animation must be bone/spatial tracks.- Parameters:
sourceAnimation- which Animation to reverse (not null, unaffected)resultName- name for the resulting Animation (not null)- Returns:
- a new Animation with the specified name
-
reverseAnimation
public static com.jme3.anim.AnimClip reverseAnimation(com.jme3.anim.AnimClip sourceClip, String resultName) Reverse the specified AnimClip.- Parameters:
sourceClip- the AnimClip to reverse (not null, unaffected)resultName- name for the resulting AnimClip (not null)- Returns:
- a new AnimClip with the specified name
-
translateForInitialSupport
public static com.jme3.anim.AnimClip translateForInitialSupport(com.jme3.anim.AnimClip sourceClip, int jointIndex, com.jme3.anim.Armature armature, com.jme3.scene.Spatial subtree, float supportY, String resultName) Translate the targeted track of the specified clip to put the initial point of support at the specified Y-coordinate.- Parameters:
sourceClip- the clip to be translated (not null, unaffected)jointIndex- the index of the targeted Joint (≥0)armature- the Armature of the model (not null, unaffected)subtree- the scene-graph subtree containing all vertices to consider (not null, unaffected)supportY- world Y-coordinate for initial supportresultName- name for the resulting AnimClip (not null)- Returns:
- a new AnimClip with the specified name or
nullif unsuccessful
-
translateForSupport
public static com.jme3.anim.AnimClip translateForSupport(com.jme3.anim.AnimClip sourceClip, int jointIndex, com.jme3.anim.Armature armature, com.jme3.scene.Spatial subtree, float supportY, String resultName) Translate the targeted track of the specified clip to put the point of support continuously at the specified Y-coordinate.- Parameters:
sourceClip- the clip to be translated (not null, unaffected)jointIndex- the index of the targeted Joint (≥0)armature- the Armature of the model (not null, unaffected)subtree- the scene-graph subtree containing all vertices to consider (not null, unaffected)supportY- world Y-coordinate for supportresultName- name for the resulting AnimClip (not null)- Returns:
- a new AnimClip with the specified name or
nullif unsuccessful
-
translateForTraction
public static com.jme3.anim.AnimClip translateForTraction(com.jme3.anim.AnimClip sourceClip, int jointIndex, com.jme3.anim.Armature armature, com.jme3.scene.Spatial subtree, String resultName) Translate the targeted track of the specified clip to simulate traction at the point of support.- Parameters:
sourceClip- the clip to be translated (not null, unaffected)jointIndex- the index of the targeted Joint (≥0)armature- the Armature of the model (not null, unaffected)subtree- the scene-graph subtree containing all vertices to consider (not null, unaffected)resultName- name for the resulting AnimClip (not null)- Returns:
- a new AnimClip with the specified name or
nullif unsuccessful
-
setDuration
public static com.jme3.anim.AnimClip setDuration(com.jme3.anim.AnimClip sourceClip, float newDuration, String resultName) Alter the duration of the specified AnimClip.- Parameters:
sourceClip- the AnimClip to alter (not null, unaffected)newDuration- the desired duration (in seconds, ≥0)resultName- name for the resulting AnimClip (not null)- Returns:
- a new AnimClip
-
zeroFirst
public static int zeroFirst(com.jme3.animation.Animation animation) Repair all tracks in which the first keyframe isn't at time=0.- Parameters:
animation- (not null)- Returns:
- the number of tracks edited (≥0)
-
zeroFirst
public static int zeroFirst(com.jme3.anim.AnimClip clip) Repair all tracks in which the first keyframe isn't at time=0.- Parameters:
clip- the AnimClip to repair (not null)- Returns:
- the number of tracks edited (≥0)
-