From a9d460f503f4d09a4c0e00164c6ca1ba3f8725dd Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 11 Sep 2021 19:50:15 +0800 Subject: *misc --- Assets/ActionTool/Editor/ActionEditor.cs | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'Assets/ActionTool/Editor/ActionEditor.cs') diff --git a/Assets/ActionTool/Editor/ActionEditor.cs b/Assets/ActionTool/Editor/ActionEditor.cs index 2abe9a2b..15b8e9f1 100644 --- a/Assets/ActionTool/Editor/ActionEditor.cs +++ b/Assets/ActionTool/Editor/ActionEditor.cs @@ -163,13 +163,8 @@ namespace ActionTool bool isFavorite = false; if (animationAssets != null && animationAssets.ContainsKey(file)) { - var labels = AssetDatabase.GetLabels(animationAssets[file]); - for (int j = 0; j < labels.Length; ++j) - { - if (labels[j] == "GoodAnimation") - isFavorite = true; - } - } + isFavorite = IsFavoritAnimation(animationAssets[file]); + } if ((!animationAssets.ContainsKey(file) || animationAssets[file] == null) && coLoadAnimationAssets == null) { coLoadAnimationAssets = CoLoadAnimationAssets(); @@ -209,7 +204,18 @@ namespace ActionTool } } - IEnumerator CoLoadAnimationAssets() + bool IsFavoritAnimation(Object animationFile) + { + var labels = AssetDatabase.GetLabels(animationFile); + for (int j = 0; j < labels.Length; ++j) + { + if (labels[j] == "GoodAnimation") + return true; + } + return false; + } + + IEnumerator CoLoadAnimationAssets() { if (!ActionManager.HasSelectObj()) yield break; @@ -237,8 +243,11 @@ namespace ActionTool { animationAssets.Add(file, animFile); } - this.Repaint(); - yield return null; + if (IsFavoritAnimation(animFile)) + { + this.Repaint(); + } + yield return null; } } -- cgit v1.1-26-g67d0