Add rename multiple actors

This commit is contained in:
ruan
2024-02-04 10:42:29 -04:00
parent 1094abce5a
commit 5d61e45ecd
3 changed files with 194 additions and 6 deletions

View File

@@ -13,7 +13,6 @@ using FlaxEditor.Scripting;
using FlaxEditor.States;
using FlaxEngine;
using FlaxEngine.GUI;
using static FlaxEditor.GUI.ItemsListContextMenu;
namespace FlaxEditor.Windows
{
@@ -138,10 +137,24 @@ namespace FlaxEditor.Windows
private void Rename()
{
var selection = Editor.SceneEditing.Selection;
if (selection.Count != 0 && selection[0] is ActorNode actor)
var selectionCount = selection.Count;
// Show a window with options to rename multiple actors.
if (selectionCount > 1)
{
if (selection.Count != 0)
Editor.SceneEditing.Select(actor);
var selectedActors = new Actor[selectionCount];
for (int i = 0; i < selectionCount; i++)
if (selection[i] is ActorNode actorNode)
selectedActors[i] = actorNode.Actor;
new RenameWindow(selectedActors, Editor).Show();
return;
}
if (selectionCount != 0 && selection[0] is ActorNode actor)
{
Editor.SceneEditing.Select(actor);
actor.TreeNode.StartRenaming(this, _sceneTreePanel);
}
}