Added display of editor camera position #368

Merged
srishamharan merged 6 commits from SP3-4-Editor into main 2023-02-27 11:59:58 +08:00
1 changed files with 35 additions and 1 deletions
Showing only changes of commit dabc94a845 - Show all commits

View File

@ -26,6 +26,8 @@
#include "Serialization/Configurations/SHConfigurationManager.h"
#include "Editor/EditorWindow/SHEditorWindowManager.h"
#include "Physics/System/SHPhysicsDebugDrawSystem.h"
#include "Camera/SHCameraSystem.h"
#include "Tools/Utilities/SHClipboardUtilities.h"
const std::string LAYOUT_FOLDER_PATH{ std::string(ASSET_ROOT) + "/Editor/Layouts" };
@ -154,7 +156,39 @@ namespace SHADE
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImGui::GetStyle().Colors[ImGuiCol_MenuBarBg]);
if (ImGui::BeginViewportSideBar("MainStatusBar", ImGui::GetMainViewport(), ImGuiDir_Down, menuBarHeight, editorMenuBarFlags))
{
ImGui::Text("Entity count: %zu", SHEntityManager::GetEntityCount());
auto camSystem = SHSystemManager::GetSystem<SHCameraSystem>();
std::string editorCamPosText{};
auto editorCam = camSystem->GetEditorCamera();
if(editorCam)
{
auto editorCamPos = editorCam->GetPosition();
editorCamPosText = std::format("Editor Cam [X: {:.3f}, Y: {:.3f}, Z: {:.3f}]", editorCamPos.x, editorCamPos.y, editorCamPos.z);
//ImGui::Text(editorCamPosText.data());
}
ImGui::Text("Entity count: %zu %s", SHEntityManager::GetEntityCount(), editorCamPosText.data());
if(ImGui::BeginPopupContextItem("EditorCamPosContext"))
{
if(editorCam)
{
if(ImGui::Selectable("Copy Editor Cam Pos X"))
{
auto editorCamPos = editorCam->GetPosition();
SHClipboardUtilities::WriteToClipboard(std::format("{:.3f}", editorCamPos.x));
}
if (ImGui::Selectable("Copy Editor Cam Pos Y"))
{
auto editorCamPos = editorCam->GetPosition();
SHClipboardUtilities::WriteToClipboard(std::format("{:.3f}", editorCamPos.y));
}
if (ImGui::Selectable("Copy Editor Cam Pos Z"))
{
auto editorCamPos = editorCam->GetPosition();
SHClipboardUtilities::WriteToClipboard(std::format("{:.3f}", editorCamPos.z));
}
}
ImGui::EndPopup();
}
}
ImGui::End();
ImGui::PopStyleColor();