From f2aae3586c301eb2a4ee2d431de5b57d558b396f Mon Sep 17 00:00:00 2001 From: Acid Bubbles Date: Tue, 9 Apr 2024 00:16:41 -0400 Subject: [PATCH] Fix crash when toggling loop in imported animations --- src/AtomAnimations/Animations/AtomAnimationClip.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/AtomAnimations/Animations/AtomAnimationClip.cs b/src/AtomAnimations/Animations/AtomAnimationClip.cs index 94102d77..20319a3f 100644 --- a/src/AtomAnimations/Animations/AtomAnimationClip.cs +++ b/src/AtomAnimations/Animations/AtomAnimationClip.cs @@ -305,7 +305,15 @@ public bool loop { if (curve.length != 2) continue; var keyframe = curve.GetLastFrame(); - keyframe.curveType = value ? curve.GetFirstFrame().curveType : CurveTypeValues.CopyPrevious; + if (value) + { + keyframe.curveType = curve.GetFirstFrame().curveType; + + } + else + { + keyframe.curveType = CurveTypeValues.CopyPrevious; + } curve.SetLastFrame(keyframe); } } @@ -324,6 +332,7 @@ public bool loop UpdateForcedNextAnimationTime(); if (!_skipNextAnimationSettingsModified) onAnimationSettingsChanged.Invoke(nameof(loop)); DirtyAll(); + onAnimationKeyframesDirty.Invoke(); } }