From c78463b4eec80ddc794675c5e6cc946942979347 Mon Sep 17 00:00:00 2001 From: KillzXGaming Date: Tue, 5 Mar 2024 19:14:01 -0500 Subject: [PATCH] Fix skeletal animations not interpolating correctly when edited in editor --- .../Editing/AnimConversion/SkeletalAnimConverter.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Plugins/CafeLibrary/Bfres/Editing/AnimConversion/SkeletalAnimConverter.cs b/Plugins/CafeLibrary/Bfres/Editing/AnimConversion/SkeletalAnimConverter.cs index f4e0cbd..c1d5c70 100644 --- a/Plugins/CafeLibrary/Bfres/Editing/AnimConversion/SkeletalAnimConverter.cs +++ b/Plugins/CafeLibrary/Bfres/Editing/AnimConversion/SkeletalAnimConverter.cs @@ -118,11 +118,18 @@ static CurveAnimHelper ConvertCurve(BfresAnimationTrack track, string target) else { curve.Interpolation = AnimCurveType.Linear; - foreach (STKeyFrame key in track.KeyFrames) + for (int i = 0; i < track.KeyFrames.Count; i++) { - curve.KeyFrames.Add(key.Frame, new KeyFrame() + var key = track.KeyFrames[i]; + + float delta = 0; + if (i < track.KeyFrames.Count - 1) + delta = track.KeyFrames[i + 1].Value - key.Value; + + curve.KeyFrames.Add(key.Frame, new LinearKeyFrame() { Value = (float)key.Value, + Delta = delta, }); } }