From b8d403f32df1decc1bc342ace97335b740892829 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sat, 8 Aug 2026 06:31:00 +0200 Subject: [PATCH] Minor changes after backporting changes --- .../CustomEditors/Editors/ActorLayerEditor.cs | 13 +++++++++++-- .../Editor/CustomEditors/Editors/GenericEditor.cs | 3 +-- Source/Editor/GUI/ComboBox.cs | 7 +++++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Source/Editor/CustomEditors/Editors/ActorLayerEditor.cs b/Source/Editor/CustomEditors/Editors/ActorLayerEditor.cs index b500dd61b..282e8fdac 100644 --- a/Source/Editor/CustomEditors/Editors/ActorLayerEditor.cs +++ b/Source/Editor/CustomEditors/Editors/ActorLayerEditor.cs @@ -1,10 +1,12 @@ // Copyright (c) Wojciech Figat. All rights reserved. -using System.Collections.Generic; using FlaxEditor.Content.Settings; using FlaxEditor.CustomEditors.Elements; using FlaxEditor.GUI; +using FlaxEditor.GUI.ContextMenu; using FlaxEngine; +using System.Collections.Generic; +using System.Linq; namespace FlaxEditor.CustomEditors.Editors { @@ -13,7 +15,7 @@ namespace FlaxEditor.CustomEditors.Editors /// public sealed class ActorLayerEditor : CustomEditor { - private const string AddOrEditLayersOption = "Add or Edit Layers"; + private const string AddOrEditLayersOption = "Add or Edit Layers..."; private ComboBoxElement element; private int _layerCount; @@ -28,6 +30,7 @@ namespace FlaxEditor.CustomEditors.Editors element = layout.ComboBox(); UpdateLayerItems((int)Values[0]); element.ComboBox.PopupShowing += OnPopupShowing; + element.ComboBox.PopupShown += OnPopupShown; element.ComboBox.SelectedIndexChanged += OnSelectedIndexChanged; } @@ -36,6 +39,12 @@ namespace FlaxEditor.CustomEditors.Editors UpdateLayerItems(HasDifferentValues ? -1 : (int)Values[0]); } + private void OnPopupShown(ComboBox comboBox) + { + var addOrEditLayersOption = (ContextMenuButton)comboBox.Popup.Items.FirstOrDefault(x => x is FlaxEditor.GUI.ContextMenu.ContextMenuButton b && b.Text == AddOrEditLayersOption); + addOrEditLayersOption?.Icon = Editor.Instance.Icons.Settings12; + } + private void UpdateLayerItems(int selectedIndex) { _updatingItems = true; diff --git a/Source/Editor/CustomEditors/Editors/GenericEditor.cs b/Source/Editor/CustomEditors/Editors/GenericEditor.cs index 113e6368b..f108136d4 100644 --- a/Source/Editor/CustomEditors/Editors/GenericEditor.cs +++ b/Source/Editor/CustomEditors/Editors/GenericEditor.cs @@ -271,8 +271,7 @@ namespace FlaxEditor.CustomEditors.Editors { var p = properties[i]; - // Indexed properties require arguments and cannot be represented by a normal property row. - // Trying to read one (for example IList.Item[index]) throws TargetParameterCountException. + // Indexed properties require arguments and cannot be represented by a normal property row (eg. IList.Item[index]) if (p.Type is PropertyInfo managedProperty && managedProperty.GetIndexParameters().Length != 0) continue; diff --git a/Source/Editor/GUI/ComboBox.cs b/Source/Editor/GUI/ComboBox.cs index 06eabd1da..693189889 100644 --- a/Source/Editor/GUI/ComboBox.cs +++ b/Source/Editor/GUI/ComboBox.cs @@ -172,6 +172,11 @@ namespace FlaxEditor.GUI /// public event Action PopupShowing; + /// + /// Occurs when popup is shown (after event). Can be used to customize item controls collection after creation. + /// + public event Action PopupShown; + /// /// Custom popup creation function. /// @@ -435,6 +440,8 @@ namespace FlaxEditor.GUI var position = _popupMenu.RootWindow.Window.Position; _popupMenu.RootWindow.Window.Position = new Float2(position.X, position.Y - Height); } + + PopupShown?.Invoke(this); } }