dont scroll to node after scripts compilation

This commit is contained in:
xxSeys1
2025-06-10 16:49:30 +02:00
parent dd4bb2f7f1
commit dacc0068e0

View File

@@ -27,7 +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 _isPlayStateChanging = false; private bool _blockSceneTreeScroll = false;
private DragAssets _dragAssets; private DragAssets _dragAssets;
private DragActorType _dragActorType; private DragActorType _dragActorType;
@@ -94,10 +94,10 @@ namespace FlaxEditor.Windows
_tree.Parent = _sceneTreePanel; _tree.Parent = _sceneTreePanel;
headerPanel.Parent = this; headerPanel.Parent = this;
Editor.PlayModeBeginning += () => _isPlayStateChanging = true; Editor.PlayModeBeginning += () => _blockSceneTreeScroll = true;
Editor.PlayModeBegin += () => _isPlayStateChanging = false; Editor.PlayModeBegin += () => _blockSceneTreeScroll = false;
Editor.PlayModeEnding += () => _isPlayStateChanging = true; Editor.PlayModeEnding += () => _blockSceneTreeScroll = true;
Editor.PlayModeEnd += () => _isPlayStateChanging = false; Editor.PlayModeEnd += () => _blockSceneTreeScroll = false;
// Setup input actions // Setup input actions
InputActions.Add(options => options.TranslateMode, () => Editor.MainTransformGizmo.ActiveMode = TransformGizmoBase.Mode.Translate); InputActions.Add(options => options.TranslateMode, () => Editor.MainTransformGizmo.ActiveMode = TransformGizmoBase.Mode.Translate);
@@ -256,7 +256,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 && !_isPlayStateChanging) if (nodes.Count == 1 && !_blockSceneTreeScroll)
{ {
nodes[0].ExpandAllParents(true); nodes[0].ExpandAllParents(true);
_sceneTreePanel.ScrollViewTo(nodes[0]); _sceneTreePanel.ScrollViewTo(nodes[0]);
@@ -266,6 +266,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>())