diff --git a/SHADE_Engine/src/Editor/EditorWindow/ViewportWindow/SHEditorViewport.cpp b/SHADE_Engine/src/Editor/EditorWindow/ViewportWindow/SHEditorViewport.cpp index d6ef8d19..7b3b5411 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/ViewportWindow/SHEditorViewport.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/ViewportWindow/SHEditorViewport.cpp @@ -40,6 +40,7 @@ namespace SHADE shouldUpdateCamera = false; } ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f)); + SHEditor* editor = SHSystemManager::GetSystem(); if (Begin()) { @@ -51,7 +52,6 @@ namespace SHADE beginCursorPos = ImGui::GetCursorScreenPos(); viewportMousePos = { mousePos.x - beginCursorPos.x, mousePos.y - beginCursorPos.y }; gfxSystem->GetMousePickSystem()->SetViewportMousePos(viewportMousePos); - ImGui::Image((ImTextureID)descriptorSet, { beginContentRegionAvailable.x, beginContentRegionAvailable.y }); if (ImGui::IsWindowHovered() && ImGui::IsMouseDown(ImGuiMouseButton_Right)) @@ -64,24 +64,25 @@ namespace SHADE shouldUpdateCamera = true; } - if (ImGui::IsWindowFocused() && !ImGui::IsMouseDown(ImGuiMouseButton_Right)) + if (editor->editorState != SHEditor::State::PLAY && ImGui::IsWindowFocused() && !ImGui::IsMouseDown(ImGuiMouseButton_Right)) { - if (ImGui::IsKeyReleased(ImGuiKey_Q)) + if (ImGui::IsKeyReleased(ImGuiKey_W)) { transformGizmo.operation = SHTransformGizmo::Operation::TRANSLATE; } - if (ImGui::IsKeyReleased(ImGuiKey_W)) + if (ImGui::IsKeyReleased(ImGuiKey_E)) { transformGizmo.operation = SHTransformGizmo::Operation::ROTATE; } - if (ImGui::IsKeyReleased(ImGuiKey_E)) + if (ImGui::IsKeyReleased(ImGuiKey_R)) { transformGizmo.operation = SHTransformGizmo::Operation::SCALE; } } } ImGuizmo::SetRect(beginCursorPos.x, beginCursorPos.y, beginContentRegionAvailable.x, beginContentRegionAvailable.y); - transformGizmo.Draw(); + if(editor->editorState != SHEditor::State::PLAY) + transformGizmo.Draw(); ImGui::End(); ImGui::PopStyleVar(); }