refactor(editor): Phase 1 architecture refactoring

- Decouple Panel from Core::Layer (P0 issue resolved)
- Add EventBus with type-safe event system
- Add ISelectionManager interface with SelectionManagerImpl
- Add IEditorContext for dependency injection
- Update EditorLayer to use new architecture
- Update Application to create and inject EditorContext

New files:
- editor/src/Core/EventBus.h
- editor/src/Core/EditorEvents.h
- editor/src/Core/ISelectionManager.h
- editor/src/Core/SelectionManagerImpl.h
- editor/src/Core/IEditorContext.h
- editor/src/Core/EditorContextImpl.h

This enables future improvements: Undo/Redo, serialization, component extensibility.
This commit is contained in:
2026-03-25 15:35:00 +08:00
parent 3478fb414a
commit 56ec2e9b85
13 changed files with 941 additions and 20 deletions

View File

@@ -1,5 +1,6 @@
#include "Application.h"
#include "Layers/EditorLayer.h"
#include "Core/EditorContextImpl.h"
#include <XCEngine/Debug/Logger.h>
#include <XCEngine/Debug/FileLogSink.h>
#include <XCEngine/Debug/ConsoleLogSink.h>
@@ -115,8 +116,11 @@ bool Application::Initialize(HWND hwnd) {
m_srvHeap->GetCPUDescriptorHandleForHeapStart(),
m_srvHeap->GetGPUDescriptorHandleForHeapStart());
m_editorContext = std::make_shared<EditorContextImpl>();
m_editorContext->SetProjectPath(exeDir);
m_editorLayer = new EditorLayer();
m_editorLayer->SetProjectPath(exeDir);
m_editorLayer->SetContext(m_editorContext);
m_layerStack.pushLayer(std::unique_ptr<Core::Layer>(m_editorLayer));
m_layerStack.onAttach();