From 360bfec048de1fcb54840d00a1f4e1773cc98ce7 Mon Sep 17 00:00:00 2001 From: NaoyaKohda Date: Sun, 17 Nov 2024 06:18:06 +0900 Subject: [PATCH] =?UTF-8?q?value=20=E3=81=8C=E5=90=8C=E4=B8=80=E3=81=AE?= =?UTF-8?q?=E5=A0=B4=E5=90=88=E3=81=AE=E3=81=BF=E3=83=95=E3=83=AC=E3=83=BC?= =?UTF-8?q?=E3=83=A0=E3=82=92=E5=89=8A=E9=99=A4=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/ArtNet/Editor/KeyFrameReducer.cs | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/Assets/ArtNet/Editor/KeyFrameReducer.cs b/Assets/ArtNet/Editor/KeyFrameReducer.cs index f3612ed..7d2837f 100644 --- a/Assets/ArtNet/Editor/KeyFrameReducer.cs +++ b/Assets/ArtNet/Editor/KeyFrameReducer.cs @@ -15,8 +15,7 @@ public static List Reduce(List keyFrameData) for (var i = 1; i < keyFrameData.Count - 1; i++) { var current = keyFrameData[i]; - var next = keyFrameData[i + 1]; - if (IsOmittedFrame(latest, current, next)) continue; + if (latest.Value == current.Value) continue; newDmxFrameData.Add(current); latest = current; @@ -25,19 +24,5 @@ public static List Reduce(List keyFrameData) newDmxFrameData.Add(keyFrameData[^1]); return newDmxFrameData; } - - private static bool IsOmittedFrame( - KeyFrameData prev, - KeyFrameData current, - KeyFrameData next, - float tolerance = 0.01f) - { - var prevDiffValue = current.Value - prev.Value; - var prevDiffTime = current.Time - prev.Time; - var nextDiffValue = next.Value - current.Value; - var nextDiffTime = next.Time - current.Time; - - return Math.Abs(prevDiffValue / prevDiffTime - nextDiffValue / nextDiffTime) <= tolerance; - } } }