Cleanup 8

This commit is contained in:
W2.Wizard
2021-02-21 14:27:44 +01:00
parent a4409c729b
commit 68f6e0251c
13 changed files with 73 additions and 84 deletions

View File

@@ -215,20 +215,17 @@ namespace FlaxEditor.Windows.Assets
{
if (actor == null)
throw new ArgumentNullException(nameof(actor));
if (parent == null)
throw new ArgumentNullException(nameof(parent));
// Link it
actor.Parent = parent;
actor.Parent = parent ?? throw new ArgumentNullException(nameof(parent));
// Peek spawned node
var actorNode = SceneGraphFactory.FindNode(actor.ID) as ActorNode ?? SceneGraphFactory.BuildActorNode(actor);
if (actorNode == null)
throw new InvalidOperationException("Failed to create scene node for the spawned actor.");
var parentNode = SceneGraphFactory.FindNode(parent.ID) as ActorNode;
if (parentNode == null)
throw new InvalidOperationException("Missing scene graph node for the spawned parent actor.");
actorNode.ParentNode = parentNode;
actorNode.ParentNode = parentNode ?? throw new InvalidOperationException("Missing scene graph node for the spawned parent actor.");
// Call post spawn action (can possibly setup custom default values)
actorNode.PostSpawn();