From 8ee2bf8d76b151bf3d467a5186584b8e760eb558 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Tue, 20 Feb 2024 20:57:15 -0600 Subject: [PATCH 1/2] Change category drop panel o look similar to other panels. Add flax engine scripts to flax engine category. --- Source/Editor/GUI/ItemsListContextMenu.cs | 13 +++++++++++-- Source/Engine/AI/Behavior.h | 2 +- .../Engine/Networking/Components/NetworkTransform.h | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Source/Editor/GUI/ItemsListContextMenu.cs b/Source/Editor/GUI/ItemsListContextMenu.cs index c8c2a9c22..df250a832 100644 --- a/Source/Editor/GUI/ItemsListContextMenu.cs +++ b/Source/Editor/GUI/ItemsListContextMenu.cs @@ -134,9 +134,13 @@ namespace FlaxEditor.GUI Render2D.FillRectangle(rect, color); } } + // Indent for drop panel items is handled by drop panel margin + var indent = Float2.Zero; + if (Parent is not DropPanel) + indent = new Float2(Editor.Instance.Icons.ArrowRight12.Size.X + 2, 0); // Draw name - Render2D.DrawText(style.FontSmall, Name, textRect, TintColor * (Enabled ? style.Foreground : style.ForegroundDisabled), TextAlignment.Near, TextAlignment.Center); + Render2D.DrawText(style.FontSmall, Name, textRect + indent, TintColor * (Enabled ? style.Foreground : style.ForegroundDisabled), TextAlignment.Near, TextAlignment.Center); } /// @@ -338,9 +342,14 @@ namespace FlaxEditor.GUI var categoryPanel = new DropPanel { HeaderText = item.Category, + ArrowImageOpened = new SpriteBrush(Editor.Instance.Icons.ArrowDown12), + ArrowImageClosed = new SpriteBrush(Editor.Instance.Icons.ArrowRight12), + EnableDropDownIcon = true, + ItemsMargin = new Margin(28, 0, 2, 2), + HeaderColor = Style.Current.Background, Parent = parent, }; - categoryPanel.Open(false); + categoryPanel.Close(false); _categoryPanels.Add(categoryPanel); parent = categoryPanel; } diff --git a/Source/Engine/AI/Behavior.h b/Source/Engine/AI/Behavior.h index 0bf69354d..c8381ca6d 100644 --- a/Source/Engine/AI/Behavior.h +++ b/Source/Engine/AI/Behavior.h @@ -11,7 +11,7 @@ /// /// Behavior instance script that runs Behavior Tree execution. /// -API_CLASS() class FLAXENGINE_API Behavior : public Script +API_CLASS(Attributes="Category(\"Flax Engine\")") class FLAXENGINE_API Behavior : public Script { API_AUTO_SERIALIZATION(); DECLARE_SCRIPTING_TYPE(Behavior); diff --git a/Source/Engine/Networking/Components/NetworkTransform.h b/Source/Engine/Networking/Components/NetworkTransform.h index 7a9b30ea6..ab358745f 100644 --- a/Source/Engine/Networking/Components/NetworkTransform.h +++ b/Source/Engine/Networking/Components/NetworkTransform.h @@ -10,7 +10,7 @@ /// Actor script component that synchronizes the Transform over the network. /// /// Interpolation and prediction logic based on https://www.gabrielgambetta.com/client-server-game-architecture.html. -API_CLASS(Namespace="FlaxEngine.Networking") class FLAXENGINE_API NetworkTransform : public Script, public INetworkSerializable +API_CLASS(Namespace="FlaxEngine.Networking", Attributes="Category(\"Flax Engine\")") class FLAXENGINE_API NetworkTransform : public Script, public INetworkSerializable { API_AUTO_SERIALIZATION(); DECLARE_SCRIPTING_TYPE(NetworkTransform); From 0a7662a37b51a0c641d3c7aeb4af7bdc809255f8 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Tue, 20 Feb 2024 21:13:28 -0600 Subject: [PATCH 2/2] Open drop panels while searching. --- Source/Editor/GUI/ItemsListContextMenu.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Source/Editor/GUI/ItemsListContextMenu.cs b/Source/Editor/GUI/ItemsListContextMenu.cs index df250a832..c52331b96 100644 --- a/Source/Editor/GUI/ItemsListContextMenu.cs +++ b/Source/Editor/GUI/ItemsListContextMenu.cs @@ -266,6 +266,10 @@ namespace FlaxEditor.GUI } } category.Visible = anyVisible; + if (string.IsNullOrEmpty(_searchBox.Text)) + category.Close(false); + else + category.Open(false); } } @@ -391,6 +395,7 @@ namespace FlaxEditor.GUI item2.UpdateFilter(null); } category.Visible = true; + category.Close(false); } }