Merge branch 'keep-scroll-scene-play' of https://github.com/Tryibion/FlaxEngine into Tryibion-keep-scroll-scene-play

This commit is contained in:
Wojtek Figat
2025-07-01 15:34:07 +02:00

View File

@@ -27,6 +27,7 @@ namespace FlaxEditor.Windows
private Panel _sceneTreePanel;
private bool _isUpdatingSelection;
private bool _isMouseDown;
private bool _blockSceneTreeScroll = false;
private DragAssets _dragAssets;
private DragActorType _dragActorType;
@@ -111,6 +112,34 @@ namespace FlaxEditor.Windows
InputActions.Add(options => options.LockFocusSelection, () => Editor.Windows.EditWin.Viewport.LockFocusSelection());
InputActions.Add(options => options.Rename, RenameSelection);
}
/// <inheritdoc />
public override void OnPlayBeginning()
{
base.OnPlayBeginning();
_blockSceneTreeScroll = true;
}
/// <inheritdoc />
public override void OnPlayBegin()
{
base.OnPlayBegin();
_blockSceneTreeScroll = false;
}
/// <inheritdoc />
public override void OnPlayEnding()
{
base.OnPlayEnding();
_blockSceneTreeScroll = true;
}
/// <inheritdoc />
public override void OnPlayEnd()
{
base.OnPlayEnd();
_blockSceneTreeScroll = true;
}
/// <summary>
/// Enables or disables vertical and horizontal scrolling on the scene tree panel.
@@ -270,7 +299,7 @@ namespace FlaxEditor.Windows
_tree.Select(nodes);
// For single node selected scroll view so user can see it
if (nodes.Count == 1)
if (nodes.Count == 1 && !_blockSceneTreeScroll)
{
nodes[0].ExpandAllParents(true);
_sceneTreePanel.ScrollViewTo(nodes[0]);
@@ -280,6 +309,12 @@ namespace FlaxEditor.Windows
_isUpdatingSelection = false;
}
/// <inheritdoc />
public override void OnEditorStateChanged()
{
_blockSceneTreeScroll = Editor.StateMachine.ReloadingScriptsState.IsActive;
}
private bool ValidateDragAsset(AssetItem assetItem)
{
if (assetItem.IsOfType<SceneAsset>())