Class AnimationEdit


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

      All Methods Static Methods Concrete Methods 
      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, java.lang.String resultName)
      Copy the specified AnimClip, converting it from a travelling animation to an in-place animation.
      static com.jme3.anim.AnimClip extractAnimation​(com.jme3.anim.AnimClip sourceClip, float startTime, float endTime, TweenTransforms techniques, java.lang.String newClipName)
      Extract a range from the specified AnimClip.
      static com.jme3.animation.Animation extractAnimation​(com.jme3.animation.Animation sourceAnimation, float startTime, float endTime, TweenTransforms techniques, java.lang.String newAnimationName)
      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 retargetAnimation​(com.jme3.anim.AnimClip sourceClip, com.jme3.anim.Armature sourceArmature, com.jme3.anim.Armature targetArmature, SkeletonMapping map, java.lang.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.Animation retargetAnimation​(com.jme3.anim.AnimClip sourceClip, com.jme3.anim.Armature sourceArmature, com.jme3.animation.Skeleton targetSkeleton, SkeletonMapping map, java.lang.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.Animation retargetAnimation​(com.jme3.animation.Animation sourceAnimation, com.jme3.animation.Skeleton sourceSkeleton, com.jme3.animation.Skeleton targetSkeleton, SkeletonMapping map, TweenTransforms techniques, java.lang.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.AnimClip reverseAnimation​(com.jme3.anim.AnimClip sourceClip, java.lang.String animationName)
      Reverse the specified AnimClip.
      static com.jme3.animation.Animation reverseAnimation​(com.jme3.animation.Animation sourceAnimation, java.lang.String animationName)
      Reverse the specified Animation.
      static com.jme3.anim.AnimClip setDuration​(com.jme3.anim.AnimClip sourceClip, float newDuration, java.lang.String animationName)
      Alter the duration of the specified AnimClip.
      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 Detail

      • 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,
                                                              java.lang.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,
                                                                    java.lang.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,
                                                              java.lang.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,
                                                                     java.lang.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,
                                                                     java.lang.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,
                                                               java.lang.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,
                                                              java.lang.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,
                                                                    java.lang.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,
                                                         java.lang.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)