|
@@ -1,5 +1,5 @@
|
|
|
/*
|
|
|
- * Copyright (c) 2009-2021 jMonkeyEngine
|
|
|
+ * Copyright (c) 2009-2023 jMonkeyEngine
|
|
|
* All rights reserved.
|
|
|
*
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
@@ -91,7 +91,23 @@ public final class FbxToJmeTrack {
|
|
|
public SpatialTrack toJmeSpatialTrack() {
|
|
|
return (SpatialTrack) toJmeTrackInternal(-1, null);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Counts how many keyframes there are in the included curves.
|
|
|
+ *
|
|
|
+ * @return the total number of keyframes (≥0)
|
|
|
+ */
|
|
|
+ public int countKeyframes() {
|
|
|
+ int count = 0;
|
|
|
+ for (FbxAnimCurveNode curveNode : animCurves.values()) {
|
|
|
+ for (FbxAnimCurve curve : curveNode.getCurves()) {
|
|
|
+ count += curve.getKeyTimes().length;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return count;
|
|
|
+ }
|
|
|
+
|
|
|
public float getDuration() {
|
|
|
long[] keyframes = getKeyTimes();
|
|
|
return (float) (keyframes[keyframes.length - 1] * FbxAnimUtil.SECONDS_PER_UNIT);
|