Class AnimationEdit

java.lang.Object
jme3utilities.wes.AnimationEdit

public final class AnimationEdit extends Object
Utility methods for editing JME animations.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    addTrack(com.jme3.anim.AnimClip clip, com.jme3.anim.AnimTrack<?> track)
    Add the specified AnimTrack to the specified AnimClip.
    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.
    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.
    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.
    static int
    normalizeQuaternions(com.jme3.anim.AnimClip clip, float tolerance)
    Normalize all quaternions in an AnimClip.
    static int
    normalizeQuaternions(com.jme3.animation.Animation animation, float tolerance)
    Normalize all quaternions in an Animation.
    static int
    removeRepeats(com.jme3.anim.AnimClip clip)
    Remove repetitious keyframes from an AnimClip.
    static int
    removeRepeats(com.jme3.animation.Animation animation)
    Remove repetitious keyframes from an Animation.
    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.
    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.
    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.
    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.
    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 a SkeletonMap.
    static com.jme3.anim.AnimClip
    reverseAnimation(com.jme3.anim.AnimClip sourceClip, String resultName)
    Reverse the specified AnimClip.
    static com.jme3.animation.Animation
    reverseAnimation(com.jme3.animation.Animation sourceAnimation, String resultName)
    Reverse the specified Animation.
    static com.jme3.anim.AnimClip
    setDuration(com.jme3.anim.AnimClip sourceClip, float newDuration, String resultName)
    Alter the duration of the specified AnimClip.
    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.
    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.
    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.
    static int
    zeroFirst(com.jme3.anim.AnimClip clip)
    Repair all tracks in which the first keyframe isn't at time=0.
    static int
    zeroFirst(com.jme3.animation.Animation animation)
    Repair all tracks in which the first keyframe isn't at time=0.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 in sourceClip that'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 a SkeletonMap. 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 support
      resultName - name for the resulting AnimClip (not null)
      Returns:
      a new AnimClip with the specified name or null if 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 support
      resultName - name for the resulting AnimClip (not null)
      Returns:
      a new AnimClip with the specified name or null if 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 null if 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)