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 travelling animation to an in-place animation.static com.jme3.anim.AnimClipextractAnimation(com.jme3.anim.AnimClip sourceClip, float startTime, float endTime, TweenTransforms techniques, String newClipName) Extract a range from the specified AnimClip.static com.jme3.animation.AnimationextractAnimation(com.jme3.animation.Animation sourceAnimation, float startTime, float endTime, TweenTransforms techniques, String newAnimationName) 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.AnimClipretargetAnimation(com.jme3.anim.AnimClip sourceClip, com.jme3.anim.Armature sourceArmature, com.jme3.anim.Armature targetArmature, SkeletonMapping map, String clipName) 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 animationName) 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 animationName) Re-target the specified Animation from the specified source Skeleton to the specified target Skeleton using the specified map.static com.jme3.anim.AnimClipreverseAnimation(com.jme3.anim.AnimClip sourceClip, String animationName) Reverse the specified AnimClip.static com.jme3.animation.AnimationreverseAnimation(com.jme3.animation.Animation sourceAnimation, String animationName) Reverse the specified Animation.static com.jme3.anim.AnimClipsetDuration(com.jme3.anim.AnimClip sourceClip, float newDuration, String animationName) Alter the duration of the specified AnimClip.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- (not null, alias created)track- (not null, modified)
-
convertToInPlace
public static com.jme3.anim.AnimClip convertToInPlace(com.jme3.anim.AnimClip sourceClip, String resultName) Copy the specified AnimClip, converting it from a travelling animation to an in-place animation. Rotations and scales aren't considered. Works best on cyclic animations.- Parameters:
sourceClip- the AnimClip to convert (not null, unaffected)resultName- name for the resulting AnimClip (not null)- Returns:
- a new AnimClip
-
extractAnimation
public static com.jme3.animation.Animation extractAnimation(com.jme3.animation.Animation sourceAnimation, float startTime, float endTime, TweenTransforms techniques, String newAnimationName) 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)newAnimationName- 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 newClipName) 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)newClipName- 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)
-
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 animationName) 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)animationName- name for the resulting Animation (not null)- Returns:
- a new Animation
-
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 animationName) 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)animationName- 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 clipName) 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)clipName- name for the resulting AnimClip (not null)- Returns:
- a new AnimClip
-
reverseAnimation
public static com.jme3.anim.AnimClip reverseAnimation(com.jme3.anim.AnimClip sourceClip, String animationName) Reverse the specified AnimClip.- Parameters:
sourceClip- the AnimClip to reverse (not null, unaffected)animationName- name for the resulting AnimClip (not null)- Returns:
- a new AnimClip
-
reverseAnimation
public static com.jme3.animation.Animation reverseAnimation(com.jme3.animation.Animation sourceAnimation, String animationName) Reverse the specified Animation. All tracks in the Animation must be bone/spatial tracks.- Parameters:
sourceAnimation- which Animation to reverse (not null, unaffected)animationName- name for the resulting Animation (not null)- Returns:
- a new Animation
-
setDuration
public static com.jme3.anim.AnimClip setDuration(com.jme3.anim.AnimClip sourceClip, float newDuration, String animationName) Alter the duration of the specified AnimClip.- Parameters:
sourceClip- the AnimClip to alter (not null, unaffected)newDuration- the desired duration (in seconds, ≥0)animationName- 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)
-