|
|
|
|
@ -7,36 +7,30 @@
|
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "panel_manager.h"
|
|
|
|
|
#include "editor.h"
|
|
|
|
|
#include "gui.h"
|
|
|
|
|
#include <gui/panel.h>
|
|
|
|
|
#include <utils/logger.h>
|
|
|
|
|
#include <dearimgui/imgui_internal.h> // To use the DockWindowXXX methods
|
|
|
|
|
#include <filesystem>
|
|
|
|
|
|
|
|
|
|
// Panels
|
|
|
|
|
#include "panels/about.h"
|
|
|
|
|
#include "panels/asset_browser.h"
|
|
|
|
|
#include "panels/world_tree.h"
|
|
|
|
|
#include "panels/world_view.h"
|
|
|
|
|
#include "panels/properties_view.h"
|
|
|
|
|
|
|
|
|
|
using namespace lunarium::gui;
|
|
|
|
|
|
|
|
|
|
namespace lunarium { namespace editor
|
|
|
|
|
namespace lunarium
|
|
|
|
|
{
|
|
|
|
|
PanelManager::PanelManager()
|
|
|
|
|
: mpEditor(nullptr), mResetDockSpace(false), mDockSpaceID(0), mSplitBottom(false)
|
|
|
|
|
: mResetDockSpace(false), mDockSpaceID(0), mSplitBottom(false)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OpRes PanelManager::Initialize(Editor* editor, std::string name, bool split_bottom)
|
|
|
|
|
OpRes PanelManager::Initialize(std::string name, bool split_bottom)
|
|
|
|
|
{
|
|
|
|
|
mpEditor = editor;
|
|
|
|
|
mName = name;
|
|
|
|
|
mSplitBottom = split_bottom;
|
|
|
|
|
|
|
|
|
|
memset(&mWindowClass, 0, sizeof(ImGuiWindowClass));
|
|
|
|
|
mWindowClass.ClassId = mpEditor->GetNextWindowID();
|
|
|
|
|
mWindowClass.ClassId = GUI::GetInstance().GetNextWindowID();
|
|
|
|
|
|
|
|
|
|
if (!std::filesystem::exists("imgui.ini"))
|
|
|
|
|
{
|
|
|
|
|
@ -52,7 +46,7 @@ namespace lunarium { namespace editor
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OpRes PanelManager::AddPanel(gui::Panel* panel, uint32_t& id)
|
|
|
|
|
OpRes PanelManager::AddPanel(Panel* panel, uint32_t& id)
|
|
|
|
|
{
|
|
|
|
|
if (mPanelsByName.find(panel->GetName()) != mPanelsByName.end())
|
|
|
|
|
{
|
|
|
|
|
@ -97,7 +91,7 @@ namespace lunarium { namespace editor
|
|
|
|
|
return mPanels[id];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Logger::Warn(mpEditor->GetLogCat(), "Requested panel not found: %d", id);
|
|
|
|
|
Logger::Warn(GUI::LogCat, "Requested panel not found: %d", id);
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -162,13 +156,13 @@ namespace lunarium { namespace editor
|
|
|
|
|
{
|
|
|
|
|
//ImGuiViewport* Viewport = ImGui::GetMainViewport();
|
|
|
|
|
ImGuiViewport* Viewport = ImGui::GetWindowViewport();
|
|
|
|
|
ImGuiID windowID = mpEditor->GetNextWindowID();
|
|
|
|
|
ImGuiID windowID = GUI::GetInstance().GetNextWindowID();
|
|
|
|
|
std::string dock_name = mName;
|
|
|
|
|
dock_name += " DockSpace";
|
|
|
|
|
mDockSpaceID = ImGui::DockSpace(ImGui::GetID(dock_name.c_str()), ImVec2(0, 0), 0, &mWindowClass);
|
|
|
|
|
if (!ImGui::DockBuilderGetNode(mDockSpaceID) || mResetDockSpace)
|
|
|
|
|
{
|
|
|
|
|
Logger::Trace(mpEditor->GetLogCat(), "Resetting Dockspace: %s", dock_name.c_str());
|
|
|
|
|
Logger::Trace(GUI::LogCat, "Resetting Dockspace: %s", dock_name.c_str());
|
|
|
|
|
|
|
|
|
|
mResetDockSpace = false;
|
|
|
|
|
ImGui::DockBuilderRemoveNode(mDockSpaceID);
|
|
|
|
|
@ -215,4 +209,4 @@ namespace lunarium { namespace editor
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
}
|