Refactor editor shell host layers
This commit is contained in:
@@ -1,16 +1,14 @@
|
||||
#include "Actions/EditorActions.h"
|
||||
#include "Actions/HierarchyActionRouter.h"
|
||||
#include "Actions/ActionRouting.h"
|
||||
#include "Commands/EntityCommands.h"
|
||||
#include "HierarchyPanel.h"
|
||||
#include "Core/IEditorContext.h"
|
||||
#include "Core/ISceneManager.h"
|
||||
#include "Core/ISelectionManager.h"
|
||||
#include "Core/IUndoManager.h"
|
||||
#include "Core/EditorEvents.h"
|
||||
#include "Core/EventBus.h"
|
||||
#include "UI/UI.h"
|
||||
#include <imgui.h>
|
||||
#include <cstring>
|
||||
|
||||
namespace XCEngine {
|
||||
namespace Editor {
|
||||
@@ -85,7 +83,7 @@ void HierarchyPanel::Render() {
|
||||
}
|
||||
|
||||
if (UI::BeginPopupContextWindow("HierarchyContextMenu", ImGuiPopupFlags_MouseButtonRight)) {
|
||||
RenderCreateMenu(nullptr);
|
||||
Actions::DrawHierarchyCreateActions(*m_context, nullptr);
|
||||
UI::EndPopup();
|
||||
}
|
||||
|
||||
@@ -199,7 +197,7 @@ void HierarchyPanel::RenderEntity(::XCEngine::Components::GameObject* gameObject
|
||||
HandleDragDrop(gameObject);
|
||||
|
||||
if (UI::BeginPopupContextItem("EntityContextMenu")) {
|
||||
RenderContextMenu(gameObject);
|
||||
Actions::DrawHierarchyContextActions(*m_context, gameObject);
|
||||
UI::EndPopup();
|
||||
}
|
||||
|
||||
@@ -214,60 +212,6 @@ void HierarchyPanel::RenderEntity(::XCEngine::Components::GameObject* gameObject
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
void HierarchyPanel::RenderContextMenu(::XCEngine::Components::GameObject* gameObject) {
|
||||
if (UI::DrawMenuScope("Create", [&]() {
|
||||
RenderCreateMenu(gameObject);
|
||||
})) {
|
||||
}
|
||||
|
||||
Actions::DrawMenuAction(Actions::MakeCreateChildEntityAction(gameObject), [&]() {
|
||||
Commands::CreateEmptyEntity(*m_context, gameObject, "Create Child", "GameObject");
|
||||
});
|
||||
Actions::DrawMenuSeparator();
|
||||
Actions::DrawMenuAction(Actions::MakeDetachEntityAction(gameObject), [&]() {
|
||||
Commands::DetachEntity(*m_context, gameObject);
|
||||
});
|
||||
Actions::DrawMenuAction(Actions::MakeRenameEntityAction(gameObject), [&]() {
|
||||
BeginRename(gameObject);
|
||||
});
|
||||
Actions::DrawMenuAction(Actions::MakeDeleteEntityAction(gameObject), [&]() {
|
||||
Commands::DeleteEntity(*m_context, gameObject->GetID());
|
||||
});
|
||||
Actions::DrawMenuSeparator();
|
||||
Actions::DrawMenuAction(Actions::MakeCopyEntityAction(gameObject), [&]() {
|
||||
Commands::CopyEntity(*m_context, gameObject->GetID());
|
||||
});
|
||||
Actions::DrawMenuAction(Actions::MakePasteEntityAction(*m_context), [&]() {
|
||||
Commands::PasteEntity(*m_context, gameObject->GetID());
|
||||
});
|
||||
Actions::DrawMenuAction(Actions::MakeDuplicateEntityAction(gameObject), [&]() {
|
||||
Commands::DuplicateEntity(*m_context, gameObject->GetID());
|
||||
});
|
||||
}
|
||||
|
||||
void HierarchyPanel::RenderCreateMenu(::XCEngine::Components::GameObject* parent) {
|
||||
Actions::DrawMenuAction(Actions::MakeCreateEmptyEntityAction(), [&]() {
|
||||
Commands::CreateEmptyEntity(*m_context, parent, "Create Entity", "GameObject");
|
||||
});
|
||||
Actions::DrawMenuSeparator();
|
||||
Actions::DrawMenuAction(Actions::MakeCreateCameraEntityAction(), [&]() {
|
||||
Commands::CreateCameraEntity(*m_context, parent);
|
||||
});
|
||||
Actions::DrawMenuAction(Actions::MakeCreateLightEntityAction(), [&]() {
|
||||
Commands::CreateLightEntity(*m_context, parent);
|
||||
});
|
||||
Actions::DrawMenuSeparator();
|
||||
Actions::DrawMenuAction(Actions::MakeCreateCubeEntityAction(), [&]() {
|
||||
Commands::CreateEmptyEntity(*m_context, parent, "Create Cube", "Cube");
|
||||
});
|
||||
Actions::DrawMenuAction(Actions::MakeCreateSphereEntityAction(), [&]() {
|
||||
Commands::CreateEmptyEntity(*m_context, parent, "Create Sphere", "Sphere");
|
||||
});
|
||||
Actions::DrawMenuAction(Actions::MakeCreatePlaneEntityAction(), [&]() {
|
||||
Commands::CreateEmptyEntity(*m_context, parent, "Create Plane", "Plane");
|
||||
});
|
||||
}
|
||||
|
||||
void HierarchyPanel::BeginRename(::XCEngine::Components::GameObject* gameObject) {
|
||||
if (!gameObject) {
|
||||
CancelRename();
|
||||
|
||||
Reference in New Issue
Block a user