|
|
|
|
@ -9,7 +9,6 @@
|
|
|
|
|
#include "panel_manager.h"
|
|
|
|
|
#include "editor.h"
|
|
|
|
|
#include <utils/logger.h>
|
|
|
|
|
#include <gui/dearimgui/imgui.h>
|
|
|
|
|
#include <gui/dearimgui/imgui_internal.h> // To use the DockWindowXXX methods
|
|
|
|
|
#include <filesystem>
|
|
|
|
|
|
|
|
|
|
@ -52,10 +51,8 @@ namespace lunarium { namespace editor
|
|
|
|
|
{
|
|
|
|
|
mpEditor = editor;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//mpMainPanel = &MainPanel::GetInstance();
|
|
|
|
|
// mpMainPanel->SetEditor(mpEditor);
|
|
|
|
|
//mpMainPanel->ResetDockSpace();
|
|
|
|
|
memset(&mWindowClass, 0, sizeof(ImGuiWindowClass));
|
|
|
|
|
mWindowClass.ClassId = mpEditor->GetNextWindowID();
|
|
|
|
|
|
|
|
|
|
if (!std::filesystem::exists("imgui.ini"))
|
|
|
|
|
{
|
|
|
|
|
@ -70,7 +67,6 @@ namespace lunarium { namespace editor
|
|
|
|
|
void PanelManager::Shutdown()
|
|
|
|
|
{
|
|
|
|
|
DestoryPanels();
|
|
|
|
|
//MainPanel::FreeInstance();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PanelManager::OpenPanel(PanelType type)
|
|
|
|
|
@ -118,6 +114,11 @@ namespace lunarium { namespace editor
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ImGuiWindowClass* PanelManager::GetWindowClass() const
|
|
|
|
|
{
|
|
|
|
|
return &mWindowClass;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PanelManager::ResetDocking()
|
|
|
|
|
{
|
|
|
|
|
mResetDockSpace = true;
|
|
|
|
|
@ -161,6 +162,7 @@ namespace lunarium { namespace editor
|
|
|
|
|
{
|
|
|
|
|
if (iter->second->IsOpen())
|
|
|
|
|
{
|
|
|
|
|
ImGui::SetNextWindowClass(&mWindowClass);
|
|
|
|
|
iter->second->DoFrame();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -193,11 +195,13 @@ namespace lunarium { namespace editor
|
|
|
|
|
void PanelManager::MakeDockSpaces()
|
|
|
|
|
{
|
|
|
|
|
ImGuiViewport* Viewport = ImGui::GetMainViewport();
|
|
|
|
|
mDockSpaceID = ImGui::DockSpace(ImGui::GetID("Lunarium Editor Dockspace"));
|
|
|
|
|
ImGuiID windowID = mpEditor->GetNextWindowID();
|
|
|
|
|
mDockSpaceID = ImGui::DockSpace(ImGui::GetID("Lunarium Editor Dockspace"), ImVec2(0, 0), 0, &mWindowClass);
|
|
|
|
|
if (!ImGui::DockBuilderGetNode(mDockSpaceID) || mResetDockSpace)
|
|
|
|
|
{
|
|
|
|
|
Logger::Log(mpEditor->GetLogCat(), LogLevel::INFO, "Resetting Dockspaces");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mResetDockSpace = false;
|
|
|
|
|
ImGui::DockBuilderRemoveNode(mDockSpaceID);
|
|
|
|
|
ImGui::DockBuilderAddNode(mDockSpaceID, ImGuiDockNodeFlags_DockSpace);
|
|
|
|
|
|