From 546501a553e3cb13c06bec56c0cb9654202656f8 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Sun, 16 Oct 2022 18:50:00 -0500 Subject: [PATCH 1/5] Added performing layout when deleting actors and scrolling to duplicated/ pasted actors when action is performed. --- Source/Editor/Modules/SceneEditingModule.cs | 10 ++++++++++ Source/Editor/Windows/SceneTreeWindow.cs | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/Source/Editor/Modules/SceneEditingModule.cs b/Source/Editor/Modules/SceneEditingModule.cs index 9ffbc514f..b04249214 100644 --- a/Source/Editor/Modules/SceneEditingModule.cs +++ b/Source/Editor/Modules/SceneEditingModule.cs @@ -450,7 +450,11 @@ namespace FlaxEditor.Modules SelectionDeleteEnd?.Invoke(); if (isSceneTreeFocus) + { Editor.Windows.SceneWin.Focus(); + Editor.Windows.SceneWin.PerformLayout(); + Editor.Windows.SceneWin.PerformLayout(); + } } /// @@ -514,6 +518,9 @@ namespace FlaxEditor.Modules Undo.AddAction(new MultiUndoAction(pasteAction, selectAction)); OnSelectionChanged(); } + + // Scroll to new selected node while pasting + Editor.Windows.SceneWin.ScrollToSelectedNode(); } /// @@ -611,6 +618,9 @@ namespace FlaxEditor.Modules Undo.AddAction(new MultiUndoAction(undoActions)); OnSelectionChanged(); } + + // Scroll to new selected node while duplicating + Editor.Windows.SceneWin.ScrollToSelectedNode(); } /// diff --git a/Source/Editor/Windows/SceneTreeWindow.cs b/Source/Editor/Windows/SceneTreeWindow.cs index b0bed2002..6e5b1f46e 100644 --- a/Source/Editor/Windows/SceneTreeWindow.cs +++ b/Source/Editor/Windows/SceneTreeWindow.cs @@ -209,6 +209,17 @@ namespace FlaxEditor.Windows if (_sceneTreePanel.HScrollBar != null) _sceneTreePanel.HScrollBar.ThumbEnabled = enabled; } + + /// + /// Scroll to selected node in the scene tree + /// + public void ScrollToSelectedNode() + { + // Scroll to node + var nodeSelection = _tree.Selection; + var scrollPosition = nodeSelection[nodeSelection.Count - 1]; + _sceneTreePanel.ScrollViewTo(scrollPosition); + } private void OnSearchBoxTextChanged() { From ef34ad760006d49e9be0fa572f2929dfe6ac9fb8 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Sun, 16 Oct 2022 19:05:41 -0500 Subject: [PATCH 2/5] Renamed scrollPosition to scrollControl for more accurate description --- Source/Editor/Windows/SceneTreeWindow.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Editor/Windows/SceneTreeWindow.cs b/Source/Editor/Windows/SceneTreeWindow.cs index 6e5b1f46e..17a0b7807 100644 --- a/Source/Editor/Windows/SceneTreeWindow.cs +++ b/Source/Editor/Windows/SceneTreeWindow.cs @@ -217,8 +217,8 @@ namespace FlaxEditor.Windows { // Scroll to node var nodeSelection = _tree.Selection; - var scrollPosition = nodeSelection[nodeSelection.Count - 1]; - _sceneTreePanel.ScrollViewTo(scrollPosition); + var scrollControl = nodeSelection[nodeSelection.Count - 1]; + _sceneTreePanel.ScrollViewTo(scrollControl); } private void OnSearchBoxTextChanged() From 14a9c99496940630a31082409ba67a70b1ba24ba Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Wed, 19 Oct 2022 14:50:39 -0500 Subject: [PATCH 3/5] fixed small bug of scene window not resizing when something is deleted but window isnt focused --- Source/Editor/Modules/SceneEditingModule.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/Editor/Modules/SceneEditingModule.cs b/Source/Editor/Modules/SceneEditingModule.cs index b04249214..7b28367ff 100644 --- a/Source/Editor/Modules/SceneEditingModule.cs +++ b/Source/Editor/Modules/SceneEditingModule.cs @@ -452,9 +452,11 @@ namespace FlaxEditor.Modules if (isSceneTreeFocus) { Editor.Windows.SceneWin.Focus(); - Editor.Windows.SceneWin.PerformLayout(); - Editor.Windows.SceneWin.PerformLayout(); } + + // fix scene window layout + Editor.Windows.SceneWin.PerformLayout(); + Editor.Windows.SceneWin.PerformLayout(); } /// From c6523ed9cdd582d736aad1c6ffa45a8082e79288 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sun, 23 Oct 2022 14:18:55 +0200 Subject: [PATCH 4/5] Fix crash when presenting task which swap chain is not ready --- Source/Engine/Graphics/GPUDevice.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Engine/Graphics/GPUDevice.cpp b/Source/Engine/Graphics/GPUDevice.cpp index 6a77fe858..b9f1aeba2 100644 --- a/Source/Engine/Graphics/GPUDevice.cpp +++ b/Source/Engine/Graphics/GPUDevice.cpp @@ -3,6 +3,7 @@ #include "GPUDevice.h" #include "RenderTargetPool.h" #include "GPUPipelineState.h" +#include "GPUSwapChain.h" #include "RenderTask.h" #include "RenderTools.h" #include "Graphics.h" @@ -12,7 +13,6 @@ #include "Engine/Content/Assets/Material.h" #include "Engine/Content/Content.h" #include "Engine/Content/SoftAssetReference.h" -#include "Engine/Platform/Windows/WindowsWindow.h" #include "Engine/Render2D/Render2D.h" #include "Engine/Engine/CommandLine.h" #include "Engine/Engine/Engine.h" @@ -408,7 +408,7 @@ void GPUDevice::DrawEnd() for (int32 i = RenderTask::Tasks.Count() - 1; i >= 0; i--) { const auto task = RenderTask::Tasks[i]; - if (task && task->LastUsedFrame == Engine::FrameCount && task->SwapChain) + if (task && task->LastUsedFrame == Engine::FrameCount && task->SwapChain && task->SwapChain->IsReady()) { lastWindowIndex = i; break; @@ -421,7 +421,7 @@ void GPUDevice::DrawEnd() for (int32 i = 0; i < RenderTask::Tasks.Count(); i++) { const auto task = RenderTask::Tasks[i]; - if (task && task->LastUsedFrame == Engine::FrameCount && task->SwapChain) + if (task && task->LastUsedFrame == Engine::FrameCount && task->SwapChain && task->SwapChain->IsReady()) { bool vsync = useVSync; if (lastWindowIndex != i) From 70c53a4f67e4470472a488e655b62e3c002b9bde Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sun, 23 Oct 2022 14:19:17 +0200 Subject: [PATCH 5/5] Fix error if nothing is selected --- Source/Editor/Windows/SceneTreeWindow.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Source/Editor/Windows/SceneTreeWindow.cs b/Source/Editor/Windows/SceneTreeWindow.cs index 17a0b7807..396bd3747 100644 --- a/Source/Editor/Windows/SceneTreeWindow.cs +++ b/Source/Editor/Windows/SceneTreeWindow.cs @@ -209,16 +209,19 @@ namespace FlaxEditor.Windows if (_sceneTreePanel.HScrollBar != null) _sceneTreePanel.HScrollBar.ThumbEnabled = enabled; } - + /// - /// Scroll to selected node in the scene tree + /// Scrolls to the selected node in the scene tree. /// public void ScrollToSelectedNode() { - // Scroll to node + // Scroll to node var nodeSelection = _tree.Selection; - var scrollControl = nodeSelection[nodeSelection.Count - 1]; - _sceneTreePanel.ScrollViewTo(scrollControl); + if (nodeSelection.Count != 0) + { + var scrollControl = nodeSelection[nodeSelection.Count - 1]; + _sceneTreePanel.ScrollViewTo(scrollControl); + } } private void OnSearchBoxTextChanged()