Update sprite group name when sprite name is changed.

This commit is contained in:
Chandler Cox
2024-08-29 11:40:30 -05:00
parent ec412d9be0
commit 62dff3fa20

View File

@@ -6,6 +6,7 @@ using FlaxEditor.Content;
using FlaxEditor.Content.Import;
using FlaxEditor.CustomEditors;
using FlaxEditor.CustomEditors.Editors;
using FlaxEditor.CustomEditors.Elements;
using FlaxEditor.GUI;
using FlaxEditor.GUI.ContextMenu;
using FlaxEditor.Scripting;
@@ -133,10 +134,21 @@ namespace FlaxEditor.Windows.Assets
group.Panel.Tag = i;
group.Panel.MouseButtonRightClicked += OnGroupPanelMouseButtonRightClicked;
group.Object(new ListValueContainer(elementType, i, Values));
var stringNameElement = group.Editors[0].ChildrenEditors.Find(x => x is StringEditor).Layout.Children.Find(x => x is TextBoxElement) as TextBoxElement;
if (stringNameElement != null)
{
stringNameElement.TextBox.TextBoxEditEnd += (textbox) => OnNameChanged(group.Panel, (TextBox)textbox);
}
}
}
}
private void OnNameChanged(DropPanel panel, TextBox textbox)
{
panel.HeaderText = textbox.Text;
}
private void OnGroupPanelMouseButtonRightClicked(DropPanel groupPanel, Float2 location)
{
var menu = new ContextMenu();