From afb68ef8a9e399f2629510695dfba639071da6f8 Mon Sep 17 00:00:00 2001 From: Stephen Gold Date: Sun, 8 May 2022 10:09:58 -0700 Subject: [PATCH] solve issue #1813 (glTF loader loses keyframes) --- .../java/com/jme3/scene/plugins/gltf/TrackData.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/TrackData.java b/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/TrackData.java index ccd14503b4..674c1b1d8f 100644 --- a/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/TrackData.java +++ b/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/TrackData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2020 jMonkeyEngine + * Copyright (c) 2009-2022 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -90,7 +90,14 @@ public void update() { KeyFrame kf = keyFrames.get(j); if (Float.floatToIntBits(kf.time) != Float.floatToIntBits(time)) { if (time > kf.time) { - continue; + if (j < keyFrames.size() - 1) { + // Keep searching for the insertion point. + continue; + } + kf = new KeyFrame(); + kf.time = time; + // Add kf after the last keyframe in the list. + keyFrames.add(kf); } else { kf = new KeyFrame(); kf.time = time;