Class TrackEdit

java.lang.Object
jme3utilities.wes.TrackEdit

public final class TrackEdit extends Object
Utility methods for editing JME animation tracks.
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.jme3.anim.MorphTrack
    behead(com.jme3.anim.MorphTrack oldTrack, float neckTime, float[] neckWeights)
    Copy a MorphTrack, deleting everything before the specified time and making that the start of the new track.
    static com.jme3.anim.TransformTrack
    behead(com.jme3.anim.TransformTrack oldTrack, float neckTime, com.jme3.math.Transform neckTransform)
    Copy a TransformTrack, deleting everything before the specified time and making that the start of the new track.
    static com.jme3.animation.Track
    behead(com.jme3.animation.Track oldTrack, float neckTime, com.jme3.math.Transform neckTransform, float oldDuration)
    Copy a bone/spatial track, deleting everything before the specified time and making that the start of the track.
    static com.jme3.animation.Track
    chain(com.jme3.animation.Track track1, com.jme3.animation.Track track2, float startTime2, float newDuration)
    Chain 2 bone/spatial tracks together to create a new track.
    static <T> T
    cloneTrack(T track)
    Clone the specified track without cloning its target.
    static com.jme3.anim.TransformTrack
    convertToInPlace(com.jme3.anim.TransformTrack oldTrack)
    Copy a TransformTrack, converting it from a travelling animation to an in-place animation.
    static com.jme3.animation.Track
    delayAll(com.jme3.animation.Track oldTrack, float delayAmount, float newDuration)
    Copy a track, delaying all its keyframes by the specified amount.
    static com.jme3.anim.TransformTrack
    deleteRange(com.jme3.anim.TransformTrack oldTrack, int startIndex, int deleteCount)
    Copy a TransformTrack, deleting the indexed range of keyframes (which mustn't include the first keyframe).
    static com.jme3.animation.Track
    deleteRange(com.jme3.animation.Track oldTrack, int startIndex, int deleteCount)
    Copy a bone/spatial track, deleting the indexed range of keyframes (which mustn't include the first keyframe).
    static com.jme3.anim.TransformTrack
    insertKeyframe(com.jme3.anim.TransformTrack oldTrack, float frameTime, com.jme3.math.Transform transform)
    Copy a TransformTrack, inserting a keyframe at the specified time (which mustn't already have a keyframe).
    static com.jme3.animation.Track
    insertKeyframe(com.jme3.animation.Track oldTrack, float frameTime, com.jme3.math.Transform transform)
    Copy a bone/spatial track, inserting a keyframe at the specified time (which mustn't already have a keyframe).
    static com.jme3.animation.Track
    newTrack(com.jme3.animation.Track oldTrack, float[] times, com.jme3.math.Vector3f[] translations, com.jme3.math.Quaternion[] rotations, com.jme3.math.Vector3f[] scales)
    Create a new bone/spatial track.
    static com.jme3.anim.AnimTrack<?>
    normalizeQuaternions(com.jme3.anim.AnimTrack<?> inputTrack, float tolerance)
    Normalize all quaternions in a morph/transform track if any of them are out of tolerance.
    static com.jme3.animation.Track
    normalizeQuaternions(com.jme3.animation.Track inputTrack, float tolerance)
    Normalize all quaternions in a bone/spatial track if any of them are out of tolerance.
    static com.jme3.anim.TransformTrack
    reduce(com.jme3.anim.TransformTrack oldTrack, int factor)
    Copy a TransformTrack, uniformly reducing the number of keyframes by the specified factor.
    static com.jme3.animation.Track
    reduce(com.jme3.animation.Track oldTrack, int factor)
    Copy a bone/spatial track, uniformly reducing the number of keyframes by the specified factor.
    static boolean
    removeRepeats(com.jme3.anim.MorphTrack track)
    Remove all repetitious keyframes from a MorphTrack.
    static boolean
    removeRepeats(com.jme3.anim.TransformTrack track)
    Remove all repetitious keyframes from a TransformTrack.
    static boolean
    removeRepeats(com.jme3.animation.Track track)
    Remove all repetitious keyframes from a bone/spatial track.
    static com.jme3.anim.TransformTrack
    replaceKeyframe(com.jme3.anim.TransformTrack oldTrack, int frameIndex, com.jme3.math.Transform transform)
    Copy a TransformTrack, setting the indexed keyframe to the specified transform.
    static com.jme3.animation.Track
    replaceKeyframe(com.jme3.animation.Track oldTrack, int frameIndex, com.jme3.math.Transform transform)
    Copy a bone/spatial track, setting the indexed keyframe to the specified transform.
    static com.jme3.anim.TransformTrack
    resample(com.jme3.anim.TransformTrack oldTrack, float[] newTimes)
    Copy a TransformTrack, resampling at the specified times.
    static com.jme3.anim.TransformTrack
    resampleAtRate(com.jme3.anim.TransformTrack oldTrack, float sampleRate, float duration)
    Copy a TransformTrack, resampling it at the specified rate.
    static com.jme3.anim.TransformTrack
    resampleToNumber(com.jme3.anim.TransformTrack oldTrack, int numSamples, float duration)
    Copy a TransformTrack, resampling to the specified number of samples.
    static com.jme3.anim.TransformTrack
    retargetTrack(com.jme3.anim.AnimClip sourceClip, com.jme3.anim.TransformTrack sourceTrack, com.jme3.anim.Armature sourceArmature, com.jme3.anim.Armature targetArmature, com.jme3.anim.Joint targetJoint, SkeletonMapping map, Map<Float,Pose> cache)
    Re-target the specified AnimClip from the specified source armature to the specified target armature using the specified map.
    static com.jme3.animation.BoneTrack
    retargetTrack(com.jme3.anim.AnimClip sourceClip, com.jme3.anim.TransformTrack sourceTrack, com.jme3.anim.Armature sourceArmature, com.jme3.animation.Skeleton targetSkeleton, int targetBoneIndex, SkeletonMapping map, Map<Float,Pose> cache)
    Re-target the specified AnimClip from the specified source armature to the specified target skeleton using the specified map.
    static com.jme3.animation.BoneTrack
    retargetTrack(com.jme3.animation.Animation sourceAnimation, com.jme3.animation.BoneTrack sourceTrack, com.jme3.animation.Skeleton sourceSkeleton, com.jme3.animation.Skeleton targetSkeleton, int targetBoneIndex, SkeletonMapping map, TweenTransforms techniques, Map<Float,Pose> cache)
    Re-target the specified BoneTrack from the specified source skeleton to the specified target skeleton using the specified map.
    static com.jme3.anim.AnimTrack<?>
    reverse(com.jme3.anim.AnimTrack<?> inputTrack)
    Copy the specified transform/morph track, reversing the sequence of its frames.
    static com.jme3.animation.Track
    reverse(com.jme3.animation.Track inputTrack)
    Copy the specified bone/spatial track, reversing the sequence of its frames.
    static com.jme3.anim.MorphTrack
    setDuration(com.jme3.anim.MorphTrack oldTrack, float newDuration)
    Copy a MorphTrack, altering its duration and adjusting all its keyframe times proportionately.
    static com.jme3.anim.TransformTrack
    setDuration(com.jme3.anim.TransformTrack oldTrack, float newDuration)
    Copy a TransformTrack, altering its duration and adjusting all its keyframe times proportionately.
    static com.jme3.animation.Track
    setDuration(com.jme3.animation.Track oldTrack, float newDuration)
    Copy a track, altering its duration and adjusting all its keyframe times proportionately.
    static com.jme3.animation.Track
    setFrameTime(com.jme3.animation.Track oldTrack, int frameIndex, float newTime)
    Copy the specified track, adjusting the animation time of the indexed frame.
    static void
    setKeyframes(com.jme3.animation.Track track, float[] times, com.jme3.math.Vector3f[] translations, com.jme3.math.Quaternion[] rotations, com.jme3.math.Vector3f[] scales)
    Alter the keyframes in a bone/spatial track.
    static com.jme3.anim.TransformTrack
    simplify(com.jme3.anim.TransformTrack oldTrack)
    Copy a TransformTrack, deleting any components that consist entirely of identities.
    static com.jme3.anim.TransformTrack
    simplify(com.jme3.anim.TransformTrack oldTrack, float tolerance)
    Copy a TransformTrack, deleting the scale component if it consists entirely of approximate identities.
    static com.jme3.animation.Track
    simplify(com.jme3.animation.Track oldTrack)
    Copy a bone/spatial track, deleting any optional components that consist entirely of identities.
    static com.jme3.anim.TransformTrack
    smooth(com.jme3.anim.TransformTrack oldTrack, float width, SmoothVectors smoothTranslations, SmoothRotations smoothRotations, SmoothVectors smoothScales, float duration)
    Copy a TransformTrack, smoothing it using the specified techniques.
    static com.jme3.animation.Track
    smooth(com.jme3.animation.Track oldTrack, float width, SmoothVectors smoothTranslations, SmoothRotations smoothRotations, SmoothVectors smoothScales, float duration)
    Copy a bone/spatial track, smoothing it using the specified techniques.
    static com.jme3.anim.MorphTrack
    truncate(com.jme3.anim.MorphTrack oldTrack, float endTime, float[] endWeights)
    Copy a MorphTrack, truncating it at the specified time.
    static com.jme3.anim.TransformTrack
    truncate(com.jme3.anim.TransformTrack oldTrack, float endTime, com.jme3.math.Transform endTransform)
    Copy a TransformTrack, truncating it at the specified time.
    static com.jme3.animation.Track
    truncate(com.jme3.animation.Track oldTrack, float endTime)
    Copy a bone/spatial track, truncating it at the specified time.
    static com.jme3.anim.TransformTrack
    wrap(com.jme3.anim.TransformTrack oldTrack, float duration, float endWeight)
    Copy a TransformTrack, altering the track's first keyframe and end-time keyframe so that they precisely match.
    static com.jme3.animation.Track
    wrap(com.jme3.animation.Track oldTrack, float duration, float endWeight)
    Copy a bone/spatial track, altering the track's first keyframe and end-time keyframe so that they precisely match.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • behead

      public static com.jme3.anim.MorphTrack behead(com.jme3.anim.MorphTrack oldTrack, float neckTime, float[] neckWeights)
      Copy a MorphTrack, deleting everything before the specified time and making that the start of the new track.
      Parameters:
      oldTrack - the input MorphTrack (not null, unaffected)
      neckTime - the cutoff time (in seconds, >0)
      neckWeights - the weights at the neck time (not null, unaffected)
      Returns:
      a new MorphTrack with the same target and t[0]=0
    • behead

      public static com.jme3.animation.Track behead(com.jme3.animation.Track oldTrack, float neckTime, com.jme3.math.Transform neckTransform, float oldDuration)
      Copy a bone/spatial track, deleting everything before the specified time and making that the start of the track.
      Parameters:
      oldTrack - input bone/spatial track (not null, unaffected)
      neckTime - cutoff time (in seconds, >0)
      neckTransform - transform of bone/spatial at the neck time (not null, unaffected)
      oldDuration - (in seconds, ≥neckTime)
      Returns:
      a new track of the same type as oldTrack
    • behead

      public static com.jme3.anim.TransformTrack behead(com.jme3.anim.TransformTrack oldTrack, float neckTime, com.jme3.math.Transform neckTransform)
      Copy a TransformTrack, deleting everything before the specified time and making that the start of the new track.
      Parameters:
      oldTrack - the input TransformTrack (not null, unaffected)
      neckTime - the cutoff time (in seconds, >0)
      neckTransform - the Transform of target at the neck time (not null, unaffected)
      Returns:
      a new TransformTrack with the same target and t[0]=0
    • chain

      public static com.jme3.animation.Track chain(com.jme3.animation.Track track1, com.jme3.animation.Track track2, float startTime2, float newDuration)
      Chain 2 bone/spatial tracks together to create a new track.
      Parameters:
      track1 - the track to play first (not null, unaffected)
      track2 - the track to play last (not null, unaffected)
      startTime2 - start time for track2 in the result (in seconds, ≥0, ≤newDuration)
      newDuration - duration of the result (in seconds, ≥start2)
      Returns:
      a new track of the same type
    • cloneTrack

      public static <T> T cloneTrack(T track)
      Clone the specified track without cloning its target.
      Type Parameters:
      T - the type of track to be cloned
      Parameters:
      track - an AnimTrack or Track (not null)
      Returns:
      a new track of the same type with the same target
    • convertToInPlace

      public static com.jme3.anim.TransformTrack convertToInPlace(com.jme3.anim.TransformTrack oldTrack)
      Copy a TransformTrack, converting it from a travelling animation to an in-place animation. This is accomplished by zeroing out any average linear velocity between (the translations of) the first and last frames. Rotations and scales aren't considered. Works best on cyclic animations.
      Parameters:
      oldTrack - the input/source track (not null, must contain 2 or more translations, unaffected)
      Returns:
      a new track with the same target
    • delayAll

      public static com.jme3.animation.Track delayAll(com.jme3.animation.Track oldTrack, float delayAmount, float newDuration)
      Copy a track, delaying all its keyframes by the specified amount.
      Parameters:
      oldTrack - base track (not null, unaffected)
      delayAmount - delay interval (in seconds, ≥0, ≤newDuration)
      newDuration - duration of the result (in seconds, ≥delayAmount)
      Returns:
      a new track of the same type as oldTrack
    • deleteRange

      public static com.jme3.animation.Track deleteRange(com.jme3.animation.Track oldTrack, int startIndex, int deleteCount)
      Copy a bone/spatial track, deleting the indexed range of keyframes (which mustn't include the first keyframe).
      Parameters:
      oldTrack - input bone/spatial track (not null, unaffected)
      startIndex - the index of the first keyframe to delete (>0, ≤lastIndex)
      deleteCount - number of keyframes to delete (>0, <lastIndex)
      Returns:
      a new track of the same type as oldTrack
    • deleteRange

      public static com.jme3.anim.TransformTrack deleteRange(com.jme3.anim.TransformTrack oldTrack, int startIndex, int deleteCount)
      Copy a TransformTrack, deleting the indexed range of keyframes (which mustn't include the first keyframe).
      Parameters:
      oldTrack - input TransformTrack (not null, unaffected)
      startIndex - the index of the first keyframe to delete (>0, ≤lastIndex)
      deleteCount - number of keyframes to delete (>0, <lastIndex)
      Returns:
      a new TransformTrack
    • insertKeyframe

      public static com.jme3.animation.Track insertKeyframe(com.jme3.animation.Track oldTrack, float frameTime, com.jme3.math.Transform transform)
      Copy a bone/spatial track, inserting a keyframe at the specified time (which mustn't already have a keyframe).
      Parameters:
      oldTrack - input bone/spatial track (not null, unaffected)
      frameTime - when to insert (>0)
      transform - transform to insert (not null, unaffected)
      Returns:
      a new track of the same type
    • insertKeyframe

      public static com.jme3.anim.TransformTrack insertKeyframe(com.jme3.anim.TransformTrack oldTrack, float frameTime, com.jme3.math.Transform transform)
      Copy a TransformTrack, inserting a keyframe at the specified time (which mustn't already have a keyframe).
      Parameters:
      oldTrack - input TransformTrack (not null, unaffected)
      frameTime - when to insert (>0)
      transform - transform to insert (not null, unaffected)
      Returns:
      a new TransformTrack
    • newTrack

      public static com.jme3.animation.Track newTrack(com.jme3.animation.Track oldTrack, float[] times, com.jme3.math.Vector3f[] translations, com.jme3.math.Quaternion[] rotations, com.jme3.math.Vector3f[] scales)
      Create a new bone/spatial track.
      Parameters:
      oldTrack - to identify the track type and target bone/spatial (not null, unaffected)
      times - (not null, alias created)
      translations - (either null or same length as times)
      rotations - (either null or same length as times)
      scales - (either null or same length as times)
      Returns:
      a new track of the same type as oldTrack
    • normalizeQuaternions

      public static com.jme3.anim.AnimTrack<?> normalizeQuaternions(com.jme3.anim.AnimTrack<?> inputTrack, float tolerance)
      Normalize all quaternions in a morph/transform track if any of them are out of tolerance.
      Parameters:
      inputTrack - the input transform/morph track (not null, unaffected)
      tolerance - the tolerance for norms (≥0)
      Returns:
      a new track if changes were made, or else inputTrack
    • normalizeQuaternions

      public static com.jme3.animation.Track normalizeQuaternions(com.jme3.animation.Track inputTrack, float tolerance)
      Normalize all quaternions in a bone/spatial track if any of them are out of tolerance.
      Parameters:
      inputTrack - the input bone/spatial track (not null, unaffected)
      tolerance - the tolerance for norms (≥0)
      Returns:
      a new track if changes are made, or else oldTrack
    • reduce

      public static com.jme3.animation.Track reduce(com.jme3.animation.Track oldTrack, int factor)
      Copy a bone/spatial track, uniformly reducing the number of keyframes by the specified factor.
      Parameters:
      oldTrack - input bone/spatial track (not null, unaffected)
      factor - reduction factor (≥2)
      Returns:
      a new track of the same type as oldTrack
    • reduce

      public static com.jme3.anim.TransformTrack reduce(com.jme3.anim.TransformTrack oldTrack, int factor)
      Copy a TransformTrack, uniformly reducing the number of keyframes by the specified factor.
      Parameters:
      oldTrack - input TransformTrack (not null, unaffected)
      factor - reduction factor (≥2)
      Returns:
      a new TransformTrack
    • removeRepeats

      public static boolean removeRepeats(com.jme3.anim.MorphTrack track)
      Remove all repetitious keyframes from a MorphTrack.
      Parameters:
      track - the input track (not null, modified)
      Returns:
      true if 1 or more keyframes were removed, otherwise false
    • removeRepeats

      public static boolean removeRepeats(com.jme3.animation.Track track)
      Remove all repetitious keyframes from a bone/spatial track.
      Parameters:
      track - input bone/spatial track (not null, modified)
      Returns:
      true if 1 or more keyframes were removed, otherwise false
    • removeRepeats

      public static boolean removeRepeats(com.jme3.anim.TransformTrack track)
      Remove all repetitious keyframes from a TransformTrack.
      Parameters:
      track - the input track (not null, modified)
      Returns:
      true if 1 or more keyframes were removed, otherwise false
    • replaceKeyframe

      public static com.jme3.animation.Track replaceKeyframe(com.jme3.animation.Track oldTrack, int frameIndex, com.jme3.math.Transform transform)
      Copy a bone/spatial track, setting the indexed keyframe to the specified transform.
      Parameters:
      oldTrack - input bone/spatial track (not null, unaffected)
      frameIndex - which keyframe (≥0, <numFrames)
      transform - transform to apply (not null, unaffected)
      Returns:
      a new track of the same type as oldTrack
    • replaceKeyframe

      public static com.jme3.anim.TransformTrack replaceKeyframe(com.jme3.anim.TransformTrack oldTrack, int frameIndex, com.jme3.math.Transform transform)
      Copy a TransformTrack, setting the indexed keyframe to the specified transform.
      Parameters:
      oldTrack - the input track (not null, unaffected)
      frameIndex - which keyframe (≥0, <numFrames)
      transform - transform to apply (not null, unaffected)
      Returns:
      a new TransformTrack
    • resample

      public static com.jme3.anim.TransformTrack resample(com.jme3.anim.TransformTrack oldTrack, float[] newTimes)
      Copy a TransformTrack, resampling at the specified times.
      Parameters:
      oldTrack - the input track (not null, unaffected)
      newTimes - sample times (not null, alias created)
      Returns:
      a new instance
    • resampleAtRate

      public static com.jme3.anim.TransformTrack resampleAtRate(com.jme3.anim.TransformTrack oldTrack, float sampleRate, float duration)
      Copy a TransformTrack, resampling it at the specified rate.
      Parameters:
      oldTrack - the input track (not null, unaffected)
      sampleRate - the desired sample rate (in frames per second, >0)
      duration - the duration of the AnimClip (in seconds, ≥0)
      Returns:
      a new instance
    • resampleToNumber

      public static com.jme3.anim.TransformTrack resampleToNumber(com.jme3.anim.TransformTrack oldTrack, int numSamples, float duration)
      Copy a TransformTrack, resampling to the specified number of samples.
      Parameters:
      oldTrack - the input track (not null, unaffected)
      numSamples - the desired number of samples (≥2)
      duration - the duration of the AnimClip (in seconds, ≥0)
      Returns:
      a new instance
    • retargetTrack

      public static com.jme3.anim.TransformTrack retargetTrack(com.jme3.anim.AnimClip sourceClip, com.jme3.anim.TransformTrack sourceTrack, com.jme3.anim.Armature sourceArmature, com.jme3.anim.Armature targetArmature, com.jme3.anim.Joint targetJoint, SkeletonMapping map, Map<Float,Pose> cache)
      Re-target the specified AnimClip from the specified source armature to the specified target armature using the specified map.
      Parameters:
      sourceClip - the AnimClip to re-target (not null, unaffected)
      sourceTrack - the input joint track (not null, unaffected)
      sourceArmature - (not null, unaffected)
      targetArmature - (not null, unaffected)
      targetJoint - the target joint (not null, alias created)
      map - skeleton map to use (not null, unaffected)
      cache - previously calculated poses (not null, added to)
      Returns:
      a new TransformTrack
    • retargetTrack

      public static com.jme3.animation.BoneTrack retargetTrack(com.jme3.anim.AnimClip sourceClip, com.jme3.anim.TransformTrack sourceTrack, com.jme3.anim.Armature sourceArmature, com.jme3.animation.Skeleton targetSkeleton, int targetBoneIndex, SkeletonMapping map, Map<Float,Pose> cache)
      Re-target the specified AnimClip from the specified source armature to the specified target skeleton using the specified map.
      Parameters:
      sourceClip - the AnimClip to re-target (not null, unaffected)
      sourceTrack - the input joint track (not null, unaffected)
      sourceArmature - (not null, unaffected)
      targetSkeleton - (not null, unaffected)
      targetBoneIndex - index of the target bone (≥0)
      map - skeleton map to use (not null, unaffected)
      cache - previously calculated poses (not null, added to)
      Returns:
      a new BoneTrack
    • retargetTrack

      public static com.jme3.animation.BoneTrack retargetTrack(com.jme3.animation.Animation sourceAnimation, com.jme3.animation.BoneTrack sourceTrack, com.jme3.animation.Skeleton sourceSkeleton, com.jme3.animation.Skeleton targetSkeleton, int targetBoneIndex, SkeletonMapping map, TweenTransforms techniques, Map<Float,Pose> cache)
      Re-target the specified BoneTrack from the specified source skeleton to the specified target skeleton using the specified map.
      Parameters:
      sourceAnimation - the Animation to re-target, or null for bind pose
      sourceTrack - the input BoneTrack (not null, unaffected)
      sourceSkeleton - (not null, unaffected)
      targetSkeleton - (not null, unaffected)
      targetBoneIndex - index of the target bone (≥0)
      map - skeleton map to use (not null, unaffected)
      techniques - tweening techniques to use (not null, unaffected)
      cache - previously calculated poses (not null, added to)
      Returns:
      a new bone track
    • reverse

      public static com.jme3.anim.AnimTrack<?> reverse(com.jme3.anim.AnimTrack<?> inputTrack)
      Copy the specified transform/morph track, reversing the sequence of its frames.
      Parameters:
      inputTrack - the input transform/morph track (not null, unaffected)
      Returns:
      a new AnimTrack with the same type and target as oldTrack, with t[0]=0
    • reverse

      public static com.jme3.animation.Track reverse(com.jme3.animation.Track inputTrack)
      Copy the specified bone/spatial track, reversing the sequence of its frames.
      Parameters:
      inputTrack - the input bone/spatial track (not null, unaffected)
      Returns:
      a new Track of the same type as oldTrack
    • setDuration

      public static com.jme3.anim.MorphTrack setDuration(com.jme3.anim.MorphTrack oldTrack, float newDuration)
      Copy a MorphTrack, altering its duration and adjusting all its keyframe times proportionately.
      Parameters:
      oldTrack - input track (not null, unaffected)
      newDuration - the desired duration (in seconds, ≥0)
      Returns:
      a new MorphTrack with the same target and t[0]=0
    • setDuration

      public static com.jme3.animation.Track setDuration(com.jme3.animation.Track oldTrack, float newDuration)
      Copy a track, altering its duration and adjusting all its keyframe times proportionately.
      Parameters:
      oldTrack - input track (not null, unaffected)
      newDuration - new duration (in seconds, ≥0)
      Returns:
      a new track of the same type as oldTrack
    • setDuration

      public static com.jme3.anim.TransformTrack setDuration(com.jme3.anim.TransformTrack oldTrack, float newDuration)
      Copy a TransformTrack, altering its duration and adjusting all its keyframe times proportionately.
      Parameters:
      oldTrack - input track (not null, unaffected)
      newDuration - the desired duration (in seconds, ≥0)
      Returns:
      a new TransformTrack with the same target and t[0]=0
    • setFrameTime

      public static com.jme3.animation.Track setFrameTime(com.jme3.animation.Track oldTrack, int frameIndex, float newTime)
      Copy the specified track, adjusting the animation time of the indexed frame.
      Parameters:
      oldTrack - the track to copy (not null, unaffected)
      frameIndex - the index of the frame to adjust (>0)
      newTime - new time for the frame (in seconds, >0)
      Returns:
      a new track of the same type as oldTrack, or null if unsuccessful
    • setKeyframes

      public static void setKeyframes(com.jme3.animation.Track track, float[] times, com.jme3.math.Vector3f[] translations, com.jme3.math.Quaternion[] rotations, com.jme3.math.Vector3f[] scales)
      Alter the keyframes in a bone/spatial track.
      Parameters:
      track - (not null, modified)
      times - (not null, alias created)
      translations - (either null or same length as times)
      rotations - (either null or same length as times)
      scales - (either null or same length as times)
    • simplify

      public static com.jme3.animation.Track simplify(com.jme3.animation.Track oldTrack)
      Copy a bone/spatial track, deleting any optional components that consist entirely of identities.
      Parameters:
      oldTrack - input bone/spatial track (not null, unaffected)
      Returns:
      a new track, or null if all track components in the input consist entirely of identities
    • simplify

      public static com.jme3.anim.TransformTrack simplify(com.jme3.anim.TransformTrack oldTrack)
      Copy a TransformTrack, deleting any components that consist entirely of identities.
      Parameters:
      oldTrack - the input track (not null, unaffected)
      Returns:
      a new TransformTrack with the same target
    • simplify

      public static com.jme3.anim.TransformTrack simplify(com.jme3.anim.TransformTrack oldTrack, float tolerance)
      Copy a TransformTrack, deleting the scale component if it consists entirely of approximate identities. TODO handle translation and rotation identities
      Parameters:
      oldTrack - the input track (not null, unaffected)
      tolerance - the tolerance to use when testing for identity (≥0)
      Returns:
      a new TransformTrack with the same target
    • smooth

      public static com.jme3.animation.Track smooth(com.jme3.animation.Track oldTrack, float width, SmoothVectors smoothTranslations, SmoothRotations smoothRotations, SmoothVectors smoothScales, float duration)
      Copy a bone/spatial track, smoothing it using the specified techniques.
      Parameters:
      oldTrack - input bone/spatial track (not null, unaffected)
      width - width of time window (≥0, ≤duration)
      smoothTranslations - technique for translations (not null)
      smoothRotations - technique for translations (not null)
      smoothScales - technique for scales (not null)
      duration - animation duration (in seconds, ≥0)
      Returns:
      a new track of the same type as oldTrack
    • smooth

      public static com.jme3.anim.TransformTrack smooth(com.jme3.anim.TransformTrack oldTrack, float width, SmoothVectors smoothTranslations, SmoothRotations smoothRotations, SmoothVectors smoothScales, float duration)
      Copy a TransformTrack, smoothing it using the specified techniques.
      Parameters:
      oldTrack - input bone/spatial track (not null, unaffected)
      width - width of time window (≥0, ≤duration)
      smoothTranslations - technique for translations (not null)
      smoothRotations - technique for translations (not null)
      smoothScales - technique for scales (not null)
      duration - animation duration (in seconds, ≥0)
      Returns:
      a new track of the same type as oldTrack
    • truncate

      public static com.jme3.anim.MorphTrack truncate(com.jme3.anim.MorphTrack oldTrack, float endTime, float[] endWeights)
      Copy a MorphTrack, truncating it at the specified time.
      Parameters:
      oldTrack - input MorphTrack (not null, unaffected)
      endTime - cutoff time (≥0)
      endWeights - weights at the end time (not null, unaffected)
      Returns:
      a new MorphTrack with the same target and t[0]=0
    • truncate

      public static com.jme3.animation.Track truncate(com.jme3.animation.Track oldTrack, float endTime)
      Copy a bone/spatial track, truncating it at the specified time.
      Parameters:
      oldTrack - input bone/spatial track (not null, unaffected)
      endTime - cutoff time (≥0)
      Returns:
      a new track of the same type as oldTrack
    • truncate

      public static com.jme3.anim.TransformTrack truncate(com.jme3.anim.TransformTrack oldTrack, float endTime, com.jme3.math.Transform endTransform)
      Copy a TransformTrack, truncating it at the specified time.
      Parameters:
      oldTrack - input TransformTrack (not null, unaffected)
      endTime - cutoff time (≥0)
      endTransform - transform of target at the end time (unaffected)
      Returns:
      a new TransformTrack with the same target and t[0]=0
    • wrap

      public static com.jme3.animation.Track wrap(com.jme3.animation.Track oldTrack, float duration, float endWeight)
      Copy a bone/spatial track, altering the track's first keyframe and end-time keyframe so that they precisely match. If the track doesn't end with a keyframe, append one.
      Parameters:
      oldTrack - input bone/spatial track (not null, unaffected)
      duration - duration of the animation (in seconds, >0)
      endWeight - how much weight to give to the pre-existing end-time keyframe, if one exists (≥0, ≤1)
      Returns:
      a new Track of the same type as oldTrack
    • wrap

      public static com.jme3.anim.TransformTrack wrap(com.jme3.anim.TransformTrack oldTrack, float duration, float endWeight)
      Copy a TransformTrack, altering the track's first keyframe and end-time keyframe so that they precisely match. If the track doesn't end with a keyframe, append one.
      Parameters:
      oldTrack - the input TransformTrack (not null, unaffected)
      duration - duration of the animation (in seconds, >0)
      endWeight - how much weight to give to the pre-existing end-time keyframe, if one exists (≥0, ≤1)
      Returns:
      a new TransformTrack