Add scrolling scene tree hierarchy to the newly spawned actor after drag and drop

This commit is contained in:
Wojtek Figat
2026-03-24 19:43:37 +01:00
parent d2ef0671e3
commit f0f1c57ff1

View File

@@ -198,6 +198,11 @@ namespace FlaxEditor.Viewport
actor.Position = PostProcessSpawnedActorLocation(actor, ref hitLocation);
_owner.Spawn(actor);
_viewport.Focus();
// Scroll to the new actor in the hierarchy
var actorNode = Editor.Instance.Scene.GetActorNode(actor);
if (actorNode?.TreeNode.ParentTree.Parent is Panel treePanel)
FlaxEngine.Scripting.InvokeOnUpdate(() => treePanel.ScrollViewTo(actorNode.TreeNode));
}
private void Spawn(ScriptItem item, SceneGraphNode hit, ref Float2 location, ref Vector3 hitLocation, ref Vector3 hitNormal)