Merge branch 'add-order-in-spawn' of https://github.com/Tryibion/FlaxEngine into Tryibion-add-order-in-spawn
This commit is contained in:
@@ -32,9 +32,9 @@ namespace FlaxEditor.Windows.Assets
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Spawn(Actor actor, Actor parent)
|
||||
public override void Spawn(Actor actor, Actor parent, int orderInParent = -1)
|
||||
{
|
||||
_window.Spawn(actor, parent);
|
||||
_window.Spawn(actor, parent, orderInParent);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -486,7 +486,8 @@ namespace FlaxEditor.Windows.Assets
|
||||
/// </summary>
|
||||
/// <param name="actor">The actor.</param>
|
||||
/// <param name="parent">The parent.</param>
|
||||
public void Spawn(Actor actor, Actor parent)
|
||||
/// <param name="orderInParent">The order of the actor under the parent.</param>
|
||||
public void Spawn(Actor actor, Actor parent, int orderInParent = -1)
|
||||
{
|
||||
if (actor == null)
|
||||
throw new ArgumentNullException(nameof(actor));
|
||||
@@ -494,6 +495,10 @@ namespace FlaxEditor.Windows.Assets
|
||||
// Link it
|
||||
actor.Parent = parent ?? throw new ArgumentNullException(nameof(parent));
|
||||
|
||||
// Set order in parent
|
||||
if (orderInParent != -1)
|
||||
actor.OrderInParent = orderInParent;
|
||||
|
||||
// Peek spawned node
|
||||
var actorNode = SceneGraphFactory.FindNode(actor.ID) as ActorNode ?? SceneGraphFactory.BuildActorNode(actor);
|
||||
if (actorNode == null)
|
||||
|
||||
Reference in New Issue
Block a user