From 47b3141f187a31a78f41048270cf75ad84da9697 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Thu, 16 May 2024 23:00:32 -0500 Subject: [PATCH] Clear item search on select prefab --- Source/Editor/CustomEditors/Dedicated/ActorEditor.cs | 6 +++++- Source/Editor/Modules/PrefabsModule.cs | 1 + Source/Editor/Windows/ContentWindow.Search.cs | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/Editor/CustomEditors/Dedicated/ActorEditor.cs b/Source/Editor/CustomEditors/Dedicated/ActorEditor.cs index bdbf22ee9..1f2211571 100644 --- a/Source/Editor/CustomEditors/Dedicated/ActorEditor.cs +++ b/Source/Editor/CustomEditors/Dedicated/ActorEditor.cs @@ -75,7 +75,11 @@ namespace FlaxEditor.CustomEditors.Dedicated // Selecting actor prefab asset var selectPrefab = panel.Button("Select Prefab"); - selectPrefab.Button.Clicked += () => Editor.Instance.Windows.ContentWin.Select(prefab); + selectPrefab.Button.Clicked += () => + { + Editor.Instance.Windows.ContentWin.ClearItemsSearch(); + Editor.Instance.Windows.ContentWin.Select(prefab); + }; // Viewing changes applied to this actor var viewChanges = panel.Button("View Changes"); diff --git a/Source/Editor/Modules/PrefabsModule.cs b/Source/Editor/Modules/PrefabsModule.cs index e0ae29299..3b3054987 100644 --- a/Source/Editor/Modules/PrefabsModule.cs +++ b/Source/Editor/Modules/PrefabsModule.cs @@ -202,6 +202,7 @@ namespace FlaxEditor.Modules var prefabId = ((ActorNode)selection[0]).Actor.PrefabID; var prefab = FlaxEngine.Content.LoadAsync(prefabId); + Editor.Windows.ContentWin.ClearItemsSearch(); Editor.Windows.ContentWin.Select(prefab); } diff --git a/Source/Editor/Windows/ContentWindow.Search.cs b/Source/Editor/Windows/ContentWindow.Search.cs index b5449dfca..a4b031d60 100644 --- a/Source/Editor/Windows/ContentWindow.Search.cs +++ b/Source/Editor/Windows/ContentWindow.Search.cs @@ -131,7 +131,7 @@ namespace FlaxEditor.Windows public void ClearItemsSearch() { // Skip if already cleared - if (_itemsSearchBox.TextLength == 0 && !_viewDropdown.HasSelection) + if (_itemsSearchBox.TextLength == 0) return; IsLayoutLocked = true;