Explorar o código

Animation Track interface: add getKeyFrameTimes() method

shadowislord %!s(int64=10) %!d(string=hai) anos
pai
achega
c5359c7359

+ 5 - 0
jme3-core/src/main/java/com/jme3/animation/AudioTrack.java

@@ -150,6 +150,11 @@ public class AudioTrack implements ClonableTrack {
         return length;
     }
 
+    @Override
+    public float[] getKeyFrameTimes() {
+        return new float[] { startOffset };
+    }
+    
     /**
      * Clone this track
      *

+ 5 - 0
jme3-core/src/main/java/com/jme3/animation/BoneTrack.java

@@ -257,6 +257,11 @@ public final class BoneTrack implements Track {
         return times == null ? 0 : times[times.length - 1] - times[0];
     }
 
+    @Override
+    public float[] getKeyFrameTimes() {
+        return times;
+    }
+    
     /**
      * This method creates a clone of the current object.
      * @return a clone of the current object

+ 5 - 0
jme3-core/src/main/java/com/jme3/animation/EffectTrack.java

@@ -239,6 +239,11 @@ public class EffectTrack implements ClonableTrack {
         return length;
     }
 
+    @Override
+    public float[] getKeyFrameTimes() {
+        return new float[] { startOffset };
+    }
+    
     /**
      * Clone this track
      *

+ 5 - 0
jme3-core/src/main/java/com/jme3/animation/PoseTrack.java

@@ -165,6 +165,11 @@ public final class PoseTrack implements Track {
         return times == null ? 0 : times[times.length - 1] - times[0];
     }
     
+    @Override
+    public float[] getKeyFrameTimes() {
+        return times;
+    }
+    
     /**
      * This method creates a clone of the current object.
      * @return a clone of the current object

+ 5 - 0
jme3-core/src/main/java/com/jme3/animation/SpatialTrack.java

@@ -235,6 +235,11 @@ public class SpatialTrack implements Track {
     public float getLength() {
             return times == null ? 0 : times[times.length - 1] - times[0];
     }
+    
+    @Override
+    public float[] getKeyFrameTimes() {
+        return times;
+    }
 
     /**
      * This method creates a clone of the current object.

+ 11 - 0
jme3-core/src/main/java/com/jme3/animation/Track.java

@@ -60,4 +60,15 @@ public interface Track extends Savable, Cloneable {
      * @return a clone of the current object
      */
     public Track clone();
+    
+    /**
+     * Get the times in seconds for all keyframes.
+     * 
+     * All keyframe times should be between 0.0 and {@link #getLength() length}.
+     * Modifying the provided array is not allowed, as it may corrupt internal
+     * state.
+     * 
+     * @return the keyframe times
+     */
+    public float[] getKeyFrameTimes();
 }