From 06afd384af2cb63da4373947971ee84d8dffac31 Mon Sep 17 00:00:00 2001 From: Kah Wei Date: Sat, 5 Nov 2022 14:56:52 +0800 Subject: [PATCH 1/2] Scenes are now reloaded and scripts are no longer lost when building scripts --- .../src/Editor/EditorWindow/MenuBar/SHEditorMenuBar.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SHADE_Engine/src/Editor/EditorWindow/MenuBar/SHEditorMenuBar.cpp b/SHADE_Engine/src/Editor/EditorWindow/MenuBar/SHEditorMenuBar.cpp index af2d5517..d1e359b6 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/MenuBar/SHEditorMenuBar.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/MenuBar/SHEditorMenuBar.cpp @@ -120,12 +120,16 @@ namespace SHADE if (ImGui::Selectable("Build Scripts - Debug")) { auto* scriptEngine = static_cast(SHSystemManager::GetSystem()); + SHSerialization::SerializeSceneToFile(SHSceneManager::GetCurrentSceneAssetID()); scriptEngine->BuildScriptAssembly(true, true); + SHSceneManager::RestartScene(SHSceneManager::GetCurrentSceneAssetID()); } if (ImGui::Selectable("Build Scripts - Release")) { auto* scriptEngine = static_cast(SHSystemManager::GetSystem()); - scriptEngine->BuildScriptAssembly(false, true); + SHSerialization::SerializeSceneToFile(SHSceneManager::GetCurrentSceneAssetID()); + scriptEngine->BuildScriptAssembly(false, true); + SHSceneManager::RestartScene(SHSceneManager::GetCurrentSceneAssetID()); } ImGui::EndMenu(); } From 04e2c255b0d6c8f3baa82ca7db7ade914906edc5 Mon Sep 17 00:00:00 2001 From: Kah Wei Date: Sat, 5 Nov 2022 15:34:56 +0800 Subject: [PATCH 2/2] Build script options are now disabled when in play or pause mode --- .../src/Editor/EditorWindow/MenuBar/SHEditorMenuBar.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SHADE_Engine/src/Editor/EditorWindow/MenuBar/SHEditorMenuBar.cpp b/SHADE_Engine/src/Editor/EditorWindow/MenuBar/SHEditorMenuBar.cpp index d1e359b6..c18f0c8c 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/MenuBar/SHEditorMenuBar.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/MenuBar/SHEditorMenuBar.cpp @@ -117,6 +117,7 @@ namespace SHADE auto* scriptEngine = static_cast(SHSystemManager::GetSystem()); scriptEngine->GenerateScriptsCsProjFile(); } + ImGui::BeginDisabled(SHSystemManager::GetSystem()->editorState != SHEditor::State::STOP); if (ImGui::Selectable("Build Scripts - Debug")) { auto* scriptEngine = static_cast(SHSystemManager::GetSystem()); @@ -131,6 +132,7 @@ namespace SHADE scriptEngine->BuildScriptAssembly(false, true); SHSceneManager::RestartScene(SHSceneManager::GetCurrentSceneAssetID()); } + ImGui::EndDisabled(); ImGui::EndMenu(); }