Support undo.

This commit is contained in:
Jean-Baptiste Perrier
2021-02-16 17:36:23 +01:00
parent 44afa732f1
commit f4a587faf9
3 changed files with 97 additions and 40 deletions

View File

@@ -55,28 +55,30 @@ namespace FlaxEditor.Windows
b = contextMenu.AddButton("Duplicate", Editor.SceneEditing.Duplicate);
b.Enabled = hasSthSelected;
var convertMenu = contextMenu.AddChildMenu("Convert");
var convertActorCm = convertMenu.ContextMenu;
for (int i = 0; i < SpawnActorsGroups.Length; i++)
if (Editor.SceneEditing.SelectionCount == 1)
{
var group = SpawnActorsGroups[i];
var convertMenu = contextMenu.AddChildMenu("Convert");
var convertActorCm = convertMenu.ContextMenu;
for (int i = 0; i < SpawnActorsGroups.Length; i++)
{
var group = SpawnActorsGroups[i];
if (group.Types.Length == 1)
{
var type = group.Types[0].Value;
convertActorCm.AddButton(group.Types[0].Key, () => Convert(type));
}
else
{
var groupCm = convertActorCm.AddChildMenu(group.Name).ContextMenu;
for (int j = 0; j < group.Types.Length; j++)
if (group.Types.Length == 1)
{
var type = group.Types[j].Value;
groupCm.AddButton(group.Types[j].Key, () => Convert(type));
var type = group.Types[0].Value;
convertActorCm.AddButton(group.Types[0].Key, () => Editor.SceneEditing.Convert(type));
}
else
{
var groupCm = convertActorCm.AddChildMenu(group.Name).ContextMenu;
for (int j = 0; j < group.Types.Length; j++)
{
var type = group.Types[j].Value;
groupCm.AddButton(group.Types[j].Key, () => Editor.SceneEditing.Convert(type));
}
}
}
}
b = contextMenu.AddButton("Delete", Editor.SceneEditing.Delete);
b.Enabled = hasSthSelected;