diff --git a/Source/Core/Editor/Menus/GUI_Menu_File/CMakeLists.txt b/Source/Core/Editor/Menus/GUI_Menu_File/CMakeLists.txt index cae0fc467b..b0667e3f09 100644 --- a/Source/Core/Editor/Menus/GUI_Menu_File/CMakeLists.txt +++ b/Source/Core/Editor/Menus/GUI_Menu_File/CMakeLists.txt @@ -39,7 +39,6 @@ target_link_libraries(Menu_File ERS_STRUCT_Scene GUI_Window_ProjectSettings - GUI_Window_ShaderEditor ERS_CLASS_VisualRenderer ) diff --git a/Source/Core/Editor/Menus/GUI_Menu_File/GUI_Menu_File.cpp b/Source/Core/Editor/Menus/GUI_Menu_File/GUI_Menu_File.cpp index d9e3d7c89e..d12c932f43 100644 --- a/Source/Core/Editor/Menus/GUI_Menu_File/GUI_Menu_File.cpp +++ b/Source/Core/Editor/Menus/GUI_Menu_File/GUI_Menu_File.cpp @@ -15,7 +15,6 @@ GUI_Menu_File::GUI_Menu_File(ERS_STRUCT_SystemUtils* SystemUtils, ERS_CLASS_Scen SceneWriter_ = std::make_unique(SystemUtils_); ImportAsset_ = std::make_unique(SystemUtils_); - ShaderEditor_ = std::make_unique(SystemUtils_, ProjectUtils_, VisualRenderer_); GUI_Window_ProjectSettings_ = std::make_unique(ProjectUtils, SystemUtils); } @@ -45,14 +44,7 @@ void GUI_Menu_File::Draw() { } ImGui::Separator(); - - // Shader Editor - if (ImGui::MenuItem("Shader Editor")) { - ShaderEditor_->Enabled_ = !ShaderEditor_->Enabled_; - } - ImGui::Separator(); - - // Save Options + // Scene Options if (ImGui::MenuItem("Save Active Scene")) { SceneWriter_->ProcessScene( SceneManager_->Scenes_[SceneManager_->ActiveScene_].get(), @@ -83,7 +75,6 @@ void GUI_Menu_File::Draw() { // Draw Subwindows ImportAsset_->Draw(); GUI_Window_ProjectSettings_->Draw(); - ShaderEditor_->Draw(); diff --git a/Source/Core/Editor/Menus/GUI_Menu_File/GUI_Menu_File.h b/Source/Core/Editor/Menus/GUI_Menu_File/GUI_Menu_File.h index fa2a15069a..5889a69707 100644 --- a/Source/Core/Editor/Menus/GUI_Menu_File/GUI_Menu_File.h +++ b/Source/Core/Editor/Menus/GUI_Menu_File/GUI_Menu_File.h @@ -30,7 +30,6 @@ #include #include -#include #include @@ -50,7 +49,6 @@ class GUI_Menu_File { std::unique_ptr ImportAsset_; /** GUI_Window_ProjectSettings_; /** ShaderEditor_; /**Logger_->Log("Editor Setting Up Window Menu", 4); - SystemUtils_->Logger_->Log("Initializing Editor Widgets", 5); + SystemUtils_->Logger_->Log("Initializing Editor Windows", 5); GUI_Window_ObjectProperties_ = std::make_unique(Cursors3D, SceneManager, ProjectUtils_); GUI_Window_RenderingSettings_ = std::make_unique(SystemUtils_); GUI_Window_FrameLatencyGraph_ = std::make_unique(SystemUtils_); GUI_Window_RAMGraph_ = std::make_unique(SystemUtils_); - - - SystemUtils_->Logger_->Log("Initializing Editor Windows", 5); GUI_Window_SceneTree_ = std::make_unique(SceneManager, SystemUtils_, ProjectUtils_, Cursors3D); GUI_Window_SystemLog_ = std::make_unique(SystemUtils_); GUI_Window_AssetExplorer_ = std::make_unique(SystemUtils_, ProjectUtils_); GUI_Window_ScriptEditor_ = std::make_unique(SystemUtils_, ProjectUtils_, VisualRenderer_); + GUI_Window_ShaderEditor_ = std::make_unique(SystemUtils_, ProjectUtils_, VisualRenderer_); + } @@ -102,6 +101,7 @@ void GUI_Menu_Window::Draw() { } ImGui::MenuItem("Script Editor", "", &GUI_Window_ScriptEditor_->Enabled_); + ImGui::MenuItem("Shader Editor", "", &GUI_Window_ShaderEditor_->Enabled_); ImGui::EndMenu(); @@ -127,5 +127,8 @@ void GUI_Menu_Window::Draw() { GUI_Window_AssetExplorer_->Draw(); GUI_Window_ScriptEditor_->Draw(); + GUI_Window_ShaderEditor_->Draw(); + + } \ No newline at end of file diff --git a/Source/Core/Editor/Menus/GUI_Menu_Window/GUI_Menu_Window.h b/Source/Core/Editor/Menus/GUI_Menu_Window/GUI_Menu_Window.h index ab7c931460..c4554f573a 100644 --- a/Source/Core/Editor/Menus/GUI_Menu_Window/GUI_Menu_Window.h +++ b/Source/Core/Editor/Menus/GUI_Menu_Window/GUI_Menu_Window.h @@ -34,6 +34,8 @@ #include #include #include +#include + #include #include @@ -62,6 +64,9 @@ class GUI_Menu_Window { std::unique_ptr GUI_Window_ObjectProperties_; /** GUI_Window_FrameLatencyGraph_; /** GUI_Window_ShaderEditor_; /** GUI_Window_SceneTree_; /** GUI_Window_SystemLog_; /**Scenes_[SceneManager_->ActiveScene_]->SceneObjects_.size() != 0)) { // LocRotScale Properties if (ImGui::CollapsingHeader("Physical Parameters", ImGuiTreeNodeFlags_DefaultOpen)) { diff --git a/Source/Core/Manager/ERS_SceneManager/ERS_SceneManager.cpp b/Source/Core/Manager/ERS_SceneManager/ERS_SceneManager.cpp index a01443309f..0f79edc054 100644 --- a/Source/Core/Manager/ERS_SceneManager/ERS_SceneManager.cpp +++ b/Source/Core/Manager/ERS_SceneManager/ERS_SceneManager.cpp @@ -21,6 +21,11 @@ ERS_CLASS_SceneManager::~ERS_CLASS_SceneManager() { void ERS_CLASS_SceneManager::UpdateLocRotScale(glm::vec3 Pos, glm::vec3 Rot, glm::vec3 Scale) { + // If The Scene Has No Models, Exit Early + if (Scenes_[ActiveScene_]->SceneObjects_.size() == 0) { + return; + } + unsigned long SelectedObject = Scenes_[ActiveScene_]->SelectedObject; if (Scenes_[ActiveScene_]->SceneObjects_[SelectedObject].Type_ == std::string("Model")) { diff --git a/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_ViewportMenu.cpp b/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_ViewportMenu.cpp index 06c8775378..7fe3b37b57 100644 --- a/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_ViewportMenu.cpp +++ b/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_ViewportMenu.cpp @@ -95,7 +95,21 @@ void ERS_CLASS_ViewportMenu::AddSpotLight(ERS_CLASS_ShadowMaps* ShadowMaps) { } +void ERS_CLASS_ViewportMenu::AddScene() { + + // Add Scene To List Of Scenes + ERS_STRUCT_Scene NewScene; + NewScene.ScenePath = SystemUtils_->ERS_IOSubsystem_->AllocateAssetID(); + NewScene.SceneName = "New Scene"; + NewScene.IsSceneLoaded = true; + NewScene.SceneFormatVersion = 1; + + ProjectUtils_->ProjectManager_->Project_.SceneIDs.push_back(NewScene.ScenePath); + + ProjectUtils_->SceneManager_->AddScene(NewScene); + +} void ERS_CLASS_ViewportMenu::DrawMenu(ERS_STRUCT_Viewport* Viewport, ERS_CLASS_ShadowMaps* ShadowMaps) { @@ -346,6 +360,10 @@ void ERS_CLASS_ViewportMenu::DrawMenu(ERS_STRUCT_Viewport* Viewport, ERS_CLASS_S } + if (ImGui::MenuItem("Scene")) { + AddScene(); + } + ImGui::EndMenu(); } diff --git a/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_ViewportMenu.h b/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_ViewportMenu.h index 157b74a0c6..b6326cad4e 100644 --- a/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_ViewportMenu.h +++ b/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_ViewportMenu.h @@ -76,6 +76,7 @@ class ERS_CLASS_ViewportMenu { void AddPointLight(ERS_CLASS_ShadowMaps* ShadowMaps); void AddDirectionalLight(ERS_CLASS_ShadowMaps* ShadowMaps); void AddSpotLight(ERS_CLASS_ShadowMaps* ShadowMaps); + void AddScene(); }; \ No newline at end of file diff --git a/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_VisualRenderer.cpp b/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_VisualRenderer.cpp index 8fcb1196e9..aa8bcac467 100644 --- a/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_VisualRenderer.cpp +++ b/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_VisualRenderer.cpp @@ -372,7 +372,7 @@ void ERS_CLASS_VisualRenderer::UpdateViewport(int Index, ERS_CLASS_SceneManager* // Update Cursor If Selection Changed ERS_STRUCT_Scene* ActiveScene = SceneManager->Scenes_[SceneManager->ActiveScene_].get(); - if (ActiveScene->HasSelectionChanged && DrawCursor) { + if (ActiveScene->HasSelectionChanged && DrawCursor && (ActiveScene->SceneObjects_.size() != 0)) { // Get Selected Model int SelectedObject = ActiveScene->SelectedObject;