Minor changes after backporting changes

This commit is contained in:
2026-08-08 06:31:00 +02:00
parent 53df912261
commit b8d403f32d
3 changed files with 19 additions and 4 deletions
@@ -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
/// </summary>
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;
@@ -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;
+7
View File
@@ -172,6 +172,11 @@ namespace FlaxEditor.GUI
/// </summary>
public event Action<ComboBox> PopupShowing;
/// <summary>
/// Occurs when popup is shown (after event). Can be used to customize item controls collection after creation.
/// </summary>
public event Action<ComboBox> PopupShown;
/// <summary>
/// Custom popup creation function.
/// </summary>
@@ -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);
}
}