Add support for custom SceneGraphNode to handle delete with undo

This commit is contained in:
Wojtek Figat
2021-02-01 13:51:32 +01:00
parent bf80827bfd
commit bab236c081
3 changed files with 136 additions and 30 deletions

View File

@@ -194,8 +194,8 @@ namespace FlaxEditor.Windows.Assets
private class CustomDeleteActorsAction : DeleteActorsAction
{
public CustomDeleteActorsAction(List<SceneGraphNode> objects, bool isInverted = false)
: base(objects, isInverted)
public CustomDeleteActorsAction(List<SceneGraphNode> nodes, bool isInverted = false)
: base(nodes, isInverted)
{
}
@@ -207,7 +207,8 @@ namespace FlaxEditor.Windows.Assets
// Unlink nodes from parents (actors spawned for prefab editing are not in a gameplay and may not send some important events)
for (int i = 0; i < nodes.Length; i++)
{
nodes[i].Actor.Parent = null;
if (nodes[i] is ActorNode actorNode)
actorNode.Actor.Parent = null;
}
base.Delete();