Skip to content

Commit

Permalink
MyAnimation: add the isSpatialTrack() method
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Nov 19, 2024
1 parent c0008e4 commit c279908
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions HeartLibrary/src/main/java/jme3utilities/MyAnimation.java
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,26 @@ public static boolean isJointTrack(AnimTrack<?> track) {
return result;
}

/**
* Test whether the specified AnimTrack targets a Spatial.
*
* @param track the AnimTrack to test (may be null, unaffected)
* @return true if it targets a Spatial, otherwise false
*/
public static boolean isSpatialTrack(AnimTrack<?> track) {
boolean result = false;

if (track instanceof TransformTrack) {
TransformTrack transformTrack = (TransformTrack) track;
HasLocalTransform target = transformTrack.getTarget();
if (target instanceof Spatial) {
result = true;
}
}

return result;
}

/**
* Create a BoneTrack consisting of a single keyframe at t=0.
*
Expand Down

0 comments on commit c279908

Please sign in to comment.