Merge branch 'Tryibion-keep-scroll-scene-play'

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

View File

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