From 0c90627a52a8ec71c70784fdcdfb109a7e1fbf48 Mon Sep 17 00:00:00 2001 From: emerycp Date: Sat, 29 Jul 2023 21:12:09 -0400 Subject: [PATCH 1/4] NK-70 - Add Menu Bar Shortcuts --- Editor/src/Windows/EditorInterface.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Editor/src/Windows/EditorInterface.cpp b/Editor/src/Windows/EditorInterface.cpp index 111074bb..485e2cb5 100644 --- a/Editor/src/Windows/EditorInterface.cpp +++ b/Editor/src/Windows/EditorInterface.cpp @@ -1528,6 +1528,31 @@ namespace Nuake { return; } + // Shortcuts + if(ImGui::IsKeyDown(ImGuiKey_LeftCtrl)) + { + if(ImGui::IsKeyPressed(ImGuiKey_S)) + { + Engine::GetProject()->Save(); + Engine::GetCurrentScene()->Save(); + + Selection = EditorSelection(); + } + else if(ImGui::IsKeyPressed(ImGuiKey_O)) + { + OpenProject(); + + Selection = EditorSelection(); + } + else if(ImGui::IsKeyDown(ImGuiKey_LeftShift) && ImGui::IsKeyPressed(ImGuiKey_S)) + { + std::string savePath = FileDialog::SaveFile("*.project"); + Engine::GetProject()->SaveAs(savePath); + + Selection = EditorSelection(); + } + } + if (_WelcomeWindow->IsProjectQueued() && frameCount > 0) { // draw splash From 0cdb826f91f29970ad6d9228b54e84fa2ea5c7a1 Mon Sep 17 00:00:00 2001 From: emerycp Date: Mon, 31 Jul 2023 11:14:16 -0400 Subject: [PATCH 2/4] NK-70 - Changed Open Project for Open Scene --- Editor/src/Windows/EditorInterface.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Editor/src/Windows/EditorInterface.cpp b/Editor/src/Windows/EditorInterface.cpp index 485e2cb5..78a0aa67 100644 --- a/Editor/src/Windows/EditorInterface.cpp +++ b/Editor/src/Windows/EditorInterface.cpp @@ -1375,7 +1375,7 @@ namespace Nuake { Selection = EditorSelection(); } - if (ImGui::MenuItem("Open...", "CTRL+O")) + if (ImGui::MenuItem("Open...")) { OpenProject(); @@ -1406,7 +1406,7 @@ namespace Nuake { Engine::LoadScene(Scene::New()); Selection = EditorSelection(); } - if (ImGui::MenuItem("Open scene...", "CTRL+SHIFT+O")) + if (ImGui::MenuItem("Open scene...", "CTRL+O")) { OpenScene(); Selection = EditorSelection(); @@ -1540,7 +1540,7 @@ namespace Nuake { } else if(ImGui::IsKeyPressed(ImGuiKey_O)) { - OpenProject(); + OpenScene(); Selection = EditorSelection(); } From fe44329a173366b52ea0875892d016b2f1a516ad Mon Sep 17 00:00:00 2001 From: Antoine Pilote Date: Mon, 31 Jul 2023 11:27:16 -0400 Subject: [PATCH 3/4] Fixed compile error --- premake5.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/premake5.lua b/premake5.lua index 98745469..73cfe316 100644 --- a/premake5.lua +++ b/premake5.lua @@ -90,10 +90,16 @@ project "Editor" objdir ("bin-int/" .. outputdir .. "/%{prj.name}") debugdir ("%{prj.name}") + defines + { + + } + files { - "%{prj.name}/**.h", - "%{prj.name}/**.cpp", + "%{prj.name}/Editor.cpp", + "%{prj.name}/src/**.cpp", + "%{prj.name}/src/**.h", "%{prj.name}/resources/*.rc", "%{prj.name}/resources/**.ico" } From 1221e58fcdc0ddf43cb1b7ea88fd1a5504dc3c6e Mon Sep 17 00:00:00 2001 From: Antoine Pilote Date: Tue, 1 Aug 2023 19:29:09 -0400 Subject: [PATCH 4/4] Changed alpha of gizmo wireframes to 0.5f and fixed viewport selection --- Editor/src/Misc/GizmoDrawer.cpp | 6 +++--- Editor/src/Misc/Gizmos/CapsuleGizmo.cpp | 24 ++++++++++++------------ Editor/src/Misc/Gizmos/CylinderGizmo.cpp | 20 ++++++++++---------- Editor/src/Windows/EditorInterface.cpp | 2 +- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Editor/src/Misc/GizmoDrawer.cpp b/Editor/src/Misc/GizmoDrawer.cpp index 5ea50b5c..51edc163 100644 --- a/Editor/src/Misc/GizmoDrawer.cpp +++ b/Editor/src/Misc/GizmoDrawer.cpp @@ -35,7 +35,7 @@ GizmoDrawer::GizmoDrawer() GenerateSphereGizmo(); // Box - const Color cubeColor = Color(1, 0, 0, 1); + const Color cubeColor = Color(1, 0, 0, 0.5f); std::vector mBoxVertices = { LineVertex{Vector3(-1.f, -1.f, -1.f), cubeColor}, @@ -110,8 +110,8 @@ void GizmoDrawer::GenerateSphereGizmo() vert2 = Vector3(x2, 0, z2); } - circleVertices.push_back(LineVertex{ vert1, Color(1.0, 0, 0.0, 1.0) }); - circleVertices.push_back(LineVertex{ vert2, Color(1.0, 0, 0.0, 1.0) }); + circleVertices.push_back(LineVertex{ vert1, Color(1.0, 0, 0.0, 0.5) }); + circleVertices.push_back(LineVertex{ vert2, Color(1.0, 0, 0.0, 0.5) }); } mCircleBuffer = CreateRef(); diff --git a/Editor/src/Misc/Gizmos/CapsuleGizmo.cpp b/Editor/src/Misc/Gizmos/CapsuleGizmo.cpp index abb3fd4e..c6a31363 100644 --- a/Editor/src/Misc/Gizmos/CapsuleGizmo.cpp +++ b/Editor/src/Misc/Gizmos/CapsuleGizmo.cpp @@ -62,8 +62,8 @@ void CapsuleGizmo::CreateMesh() vert2 = Vector3(x2, bottomCircleHeight, z2); } - _CapsuleVertices.push_back(LineVertex{ vert1, Color(1.0, 0, 0.0, 1.0) }); - _CapsuleVertices.push_back(LineVertex{ vert2, Color(1.0, 0, 0.0, 1.0) }); + _CapsuleVertices.push_back(LineVertex{ vert1, Color(1.0, 0, 0.0, 0.5) }); + _CapsuleVertices.push_back(LineVertex{ vert2, Color(1.0, 0, 0.0, 0.5) }); } for (int i = 0; i < subDivision * 2.0; i++) @@ -94,21 +94,21 @@ void CapsuleGizmo::CreateMesh() vert2 = Vector3(0, z2 + heightOffset, x2); } - _CapsuleVertices.push_back(LineVertex{ vert1, Color(1.0, 0, 0.0, 1.0) }); - _CapsuleVertices.push_back(LineVertex{ vert2, Color(1.0, 0, 0.0, 1.0) }); + _CapsuleVertices.push_back(LineVertex{ vert1, Color(1.0, 0, 0.0, 0.5) }); + _CapsuleVertices.push_back(LineVertex{ vert2, Color(1.0, 0, 0.0, 0.5) }); } - _CapsuleVertices.push_back(LineVertex{ Vector3(radius, bottomCircleHeight, 0), Color(1.0, 0, 0.0, 1.0) }); - _CapsuleVertices.push_back(LineVertex{ Vector3(radius, topCircleHeight, 0), Color(1.0, 0, 0.0, 1.0) }); + _CapsuleVertices.push_back(LineVertex{ Vector3(radius, bottomCircleHeight, 0), Color(1.0, 0, 0.0, 0.5) }); + _CapsuleVertices.push_back(LineVertex{ Vector3(radius, topCircleHeight, 0), Color(1.0, 0, 0.0, 0.5) }); - _CapsuleVertices.push_back(LineVertex{ Vector3(-radius, bottomCircleHeight, 0), Color(1.0, 0, 0.0, 1.0) }); - _CapsuleVertices.push_back(LineVertex{ Vector3(-radius, topCircleHeight, 0), Color(1.0, 0, 0.0, 1.0) }); + _CapsuleVertices.push_back(LineVertex{ Vector3(-radius, bottomCircleHeight, 0), Color(1.0, 0, 0.0, 0.5) }); + _CapsuleVertices.push_back(LineVertex{ Vector3(-radius, topCircleHeight, 0), Color(1.0, 0, 0.0, 0.5) }); - _CapsuleVertices.push_back(LineVertex{ Vector3(0, bottomCircleHeight, radius), Color(1.0, 0, 0.0, 1.0) }); - _CapsuleVertices.push_back(LineVertex{ Vector3(0, topCircleHeight, radius), Color(1.0, 0, 0.0, 1.0) }); + _CapsuleVertices.push_back(LineVertex{ Vector3(0, bottomCircleHeight, radius), Color(1.0, 0, 0.0, 0.5) }); + _CapsuleVertices.push_back(LineVertex{ Vector3(0, topCircleHeight, radius), Color(1.0, 0, 0.0, 0.5) }); - _CapsuleVertices.push_back(LineVertex{ Vector3(0, bottomCircleHeight, -radius), Color(1.0, 0, 0.0, 1.0) }); - _CapsuleVertices.push_back(LineVertex{ Vector3(0, topCircleHeight, -radius), Color(1.0, 0, 0.0, 1.0) }); + _CapsuleVertices.push_back(LineVertex{ Vector3(0, bottomCircleHeight, -radius), Color(1.0, 0, 0.0, 0.5) }); + _CapsuleVertices.push_back(LineVertex{ Vector3(0, topCircleHeight, -radius), Color(1.0, 0, 0.0, 0.5) }); _CapsuleBuffer = CreateRef(); _CapsuleBuffer->Bind(); diff --git a/Editor/src/Misc/Gizmos/CylinderGizmo.cpp b/Editor/src/Misc/Gizmos/CylinderGizmo.cpp index dc86ce3d..89d26df7 100644 --- a/Editor/src/Misc/Gizmos/CylinderGizmo.cpp +++ b/Editor/src/Misc/Gizmos/CylinderGizmo.cpp @@ -62,21 +62,21 @@ void CylinderGizmo::CreateMesh() vert2 = Vector3(x2, bottomCircleHeight, z2); } - _CylinderVertices.push_back(LineVertex{ vert1, Color(1.0, 0, 0.0, 1.0) }); - _CylinderVertices.push_back(LineVertex{ vert2, Color(1.0, 0, 0.0, 1.0) }); + _CylinderVertices.push_back(LineVertex{ vert1, Color(1.0, 0, 0.0, 0.5) }); + _CylinderVertices.push_back(LineVertex{ vert2, Color(1.0, 0, 0.0, 0.5) }); } - _CylinderVertices.push_back(LineVertex{ Vector3(radius, bottomCircleHeight, 0), Color(1.0, 0, 0.0, 1.0) }); - _CylinderVertices.push_back(LineVertex{ Vector3(radius, topCircleHeight, 0), Color(1.0, 0, 0.0, 1.0) }); + _CylinderVertices.push_back(LineVertex{ Vector3(radius, bottomCircleHeight, 0), Color(1.0, 0, 0.0, 0.5) }); + _CylinderVertices.push_back(LineVertex{ Vector3(radius, topCircleHeight, 0), Color(1.0, 0, 0.0, 0.5) }); - _CylinderVertices.push_back(LineVertex{ Vector3(-radius, bottomCircleHeight, 0), Color(1.0, 0, 0.0, 1.0) }); - _CylinderVertices.push_back(LineVertex{ Vector3(-radius, topCircleHeight, 0), Color(1.0, 0, 0.0, 1.0) }); + _CylinderVertices.push_back(LineVertex{ Vector3(-radius, bottomCircleHeight, 0), Color(1.0, 0, 0.0, 0.5) }); + _CylinderVertices.push_back(LineVertex{ Vector3(-radius, topCircleHeight, 0), Color(1.0, 0, 0.0, 0.5) }); - _CylinderVertices.push_back(LineVertex{ Vector3(0, bottomCircleHeight, radius), Color(1.0, 0, 0.0, 1.0) }); - _CylinderVertices.push_back(LineVertex{ Vector3(0, topCircleHeight, radius), Color(1.0, 0, 0.0, 1.0) }); + _CylinderVertices.push_back(LineVertex{ Vector3(0, bottomCircleHeight, radius), Color(1.0, 0, 0.0, 0.5) }); + _CylinderVertices.push_back(LineVertex{ Vector3(0, topCircleHeight, radius), Color(1.0, 0, 0.0, 0.5) }); - _CylinderVertices.push_back(LineVertex{ Vector3(0, bottomCircleHeight, -radius), Color(1.0, 0, 0.0, 1.0) }); - _CylinderVertices.push_back(LineVertex{ Vector3(0, topCircleHeight, -radius), Color(1.0, 0, 0.0, 1.0) }); + _CylinderVertices.push_back(LineVertex{ Vector3(0, bottomCircleHeight, -radius), Color(1.0, 0, 0.0, 0.5) }); + _CylinderVertices.push_back(LineVertex{ Vector3(0, topCircleHeight, -radius), Color(1.0, 0, 0.0, 0.5) }); _CylinderBuffer = CreateRef(); _CylinderBuffer->Bind(); diff --git a/Editor/src/Windows/EditorInterface.cpp b/Editor/src/Windows/EditorInterface.cpp index 111074bb..226759d2 100644 --- a/Editor/src/Windows/EditorInterface.cpp +++ b/Editor/src/Windows/EditorInterface.cpp @@ -246,7 +246,7 @@ namespace Nuake { } m_IsViewportFocused = ImGui::IsWindowFocused(); - if (m_IsHoveringViewport && Input::IsMouseButtonPressed(GLFW_MOUSE_BUTTON_2) && !ImGuizmo::IsUsing()) + if (m_IsHoveringViewport && Input::IsMouseButtonPressed(GLFW_MOUSE_BUTTON_1) && !ImGuizmo::IsUsing()) { ImGui::FocusWindow(ImGui::GetCurrentWindow());