From 15b1e0a9843c382d4208b2c716837a9edb8d2478 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sun, 24 Sep 2023 13:20:19 +0200 Subject: [PATCH] Minor fixes --- .../Editors/BehaviorKnowledgeSelectorEditor.cs | 18 ++++++++++-------- Source/Engine/AI/BehaviorKnowledgeSelector.h | 5 +++++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Source/Editor/CustomEditors/Editors/BehaviorKnowledgeSelectorEditor.cs b/Source/Editor/CustomEditors/Editors/BehaviorKnowledgeSelectorEditor.cs index a326adcb7..8ac6a51cb 100644 --- a/Source/Editor/CustomEditors/Editors/BehaviorKnowledgeSelectorEditor.cs +++ b/Source/Editor/CustomEditors/Editors/BehaviorKnowledgeSelectorEditor.cs @@ -61,6 +61,8 @@ namespace FlaxEditor.CustomEditors.Editors } set { + if (string.Equals(Path, value, StringComparison.Ordinal)) + return; var v = Values[0]; if (v is BehaviorKnowledgeSelectorAny) v = new BehaviorKnowledgeSelectorAny(value); @@ -102,14 +104,6 @@ namespace FlaxEditor.CustomEditors.Editors // Create menu with tree-like structure and search box var menu = Utilities.Utils.CreateSearchPopup(out var searchBox, out var tree, 0, true); var selected = Path; - tree.SelectedChanged += delegate(List before, List after) - { - if (after.Count == 1) - { - menu.Hide(); - Path = after[0].Tag as string; - } - }; // Empty var noneNode = new TreeNode @@ -148,6 +142,14 @@ namespace FlaxEditor.CustomEditors.Editors goalsNode.ExpandAll(true); } + tree.SelectedChanged += delegate(List before, List after) + { + if (after.Count == 1) + { + menu.Hide(); + Path = after[0].Tag as string; + } + }; menu.Show(_label, new Float2(0, _label.Height)); } diff --git a/Source/Engine/AI/BehaviorKnowledgeSelector.h b/Source/Engine/AI/BehaviorKnowledgeSelector.h index 2ce4623f5..976711282 100644 --- a/Source/Engine/AI/BehaviorKnowledgeSelector.h +++ b/Source/Engine/AI/BehaviorKnowledgeSelector.h @@ -50,6 +50,11 @@ API_STRUCT(NoDefault, MarshalAs=StringAnsi) struct FLAXENGINE_API BehaviorKnowle { return Path; } + + String ToString() const + { + return Path.ToString(); + } }; ///