From 115860590839d539fc2b0075894f379947c6b00c Mon Sep 17 00:00:00 2001 From: HumanoidSandvichDispenser Date: Sat, 9 Sep 2023 22:34:30 -0700 Subject: [PATCH] ensure animations point to same node and property --- Utils/AnimationManager.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Utils/AnimationManager.cs b/Utils/AnimationManager.cs index 4608aa3..ef2ca99 100644 --- a/Utils/AnimationManager.cs +++ b/Utils/AnimationManager.cs @@ -69,7 +69,9 @@ public partial class AnimationManager : Node private string NormPath(string path) { - return path.Replace("../", "").Replace("./", ""); + return path.Replace("../", "") + .Replace("./", "") + .Replace("%", ""); } private void CheckConflicts(AnimationPlayer p1, int p1Priority, @@ -87,11 +89,20 @@ public partial class AnimationManager : Node // compare each track to see if they conflict nodepaths for (int p1Track = 0; p1Track < anim1.GetTrackCount(); p1Track++) { - string anim1Node = NormPath(anim1.TrackGetPath(p1Track)); + NodePath anim1Path = anim1.TrackGetPath(p1Track); + NodePath anim1Prop = anim1Path.GetConcatenatedSubNames(); + NodePath anim1Name = anim1Path.GetConcatenatedNames(); + Node anim1Node = p1.GetParent().GetNode(anim1Name); + for (int p2Track = 0; p2Track < anim2.GetTrackCount(); p2Track++) { - string anim2Node = NormPath(anim2.TrackGetPath(p2Track)); - if (anim1Node == anim2Node) + NodePath anim2Path = anim2.TrackGetPath(p2Track); + NodePath anim2Prop = anim2Path.GetConcatenatedSubNames(); + NodePath anim2Name = anim2Path.GetConcatenatedNames(); + Node anim2Node = p2.GetParent().GetNode(anim2Name); + + // check if they point to the same node and property + if (anim1Node == anim2Node && anim1Prop == anim2Prop) { var hold = new AnimationHold(); if (p1Priority > p2Priority)