Advance editor runtime and scripting integration

This commit is contained in:
2026-04-29 16:55:44 +08:00
parent 631bf32db2
commit 2e50c90167
60 changed files with 4071 additions and 228 deletions

View File

@@ -12,7 +12,6 @@ namespace XCEngine::UI::Editor::App {
namespace {
using ::XCEngine::UI::Editor::BuildEditorShellShortcutManager;
using ::XCEngine::UI::Editor::UIEditorWorkspacePanelPresentationModel;
using ::XCEngine::UI::Editor::AppendUIEditorRuntimeTrace;
@@ -65,7 +64,6 @@ bool EditorContext::Initialize(
m_session = {};
m_session.workspaceRoot = runtimePaths.workspaceRoot;
m_session.projectRoot = runtimePaths.projectRoot;
m_commandFocusService = {};
m_selectionService = {};
m_projectRuntime.Reset();
AppendUIEditorRuntimeTrace("startup", "EditorProjectRuntime::Initialize begin");
@@ -92,15 +90,7 @@ bool EditorContext::Initialize(
ResetEditorColorPickerToolState(m_colorPickerToolState);
ResetEditorUtilityWindowRequestState(m_utilityWindowRequestState);
SyncSessionFromSelectionService();
m_hostCommandBridge.BindSession(m_session);
m_hostCommandBridge.BindCommandFocusService(m_commandFocusService);
m_hostCommandBridge.BindRuntimeCommandOwner(&m_runtimeCoordinator);
SyncSessionFromCommandFocusService();
m_shortcutManager = BuildEditorShellShortcutManager(m_shellAsset);
m_shortcutManager.SetHostCommandHandler(&m_hostCommandBridge);
m_shellServices = {};
m_shellServices.commandDispatcher = &m_shortcutManager.GetCommandDispatcher();
m_shellServices.shortcutManager = &m_shortcutManager;
m_textMeasurer = nullptr;
m_lastStatus.clear();
m_lastMessage.clear();
SetReadyStatus();
@@ -111,7 +101,7 @@ bool EditorContext::Initialize(
void EditorContext::AttachTextMeasurer(
const UIEditorTextMeasurer& textMeasurer) {
m_shellServices.textMeasurer = &textMeasurer;
m_textMeasurer = &textMeasurer;
}
void EditorContext::SetSystemInteractionHost(
@@ -119,28 +109,6 @@ void EditorContext::SetSystemInteractionHost(
m_systemInteractionHost = systemInteractionHost;
}
void EditorContext::BindEditCommandRoutes(
EditorEditCommandRoute* hierarchyRoute,
EditorEditCommandRoute* projectRoute,
EditorEditCommandRoute* sceneRoute,
EditorEditCommandRoute* inspectorRoute) {
m_hostCommandBridge.BindEditCommandRoutes(
hierarchyRoute,
projectRoute,
sceneRoute,
inspectorRoute);
}
void EditorContext::SetExitRequestHandler(std::function<void()> handler) {
m_hostCommandBridge.SetExitRequestHandler(std::move(handler));
}
void EditorContext::SyncSessionFromWorkspace(
const UIEditorWorkspaceController& workspaceController) {
SyncEditorSessionFromWorkspace(m_session, workspaceController);
SyncSessionFromCommandFocusService();
}
void EditorContext::TickEditorRuntime() {
m_runtimeCoordinator.TickFrame();
}
@@ -161,14 +129,6 @@ const EditorSession& EditorContext::GetSession() const {
return m_session;
}
EditorCommandFocusService& EditorContext::GetCommandFocusService() {
return m_commandFocusService;
}
const EditorCommandFocusService& EditorContext::GetCommandFocusService() const {
return m_commandFocusService;
}
EditorProjectRuntime& EditorContext::GetProjectRuntime() {
return m_projectRuntime;
}
@@ -223,11 +183,6 @@ void EditorContext::SyncSessionFromSelectionService() {
m_session.selection = m_selectionService.GetSelection();
}
void EditorContext::SyncSessionFromCommandFocusService() {
m_session.activeRoute = m_commandFocusService.ResolveRoute(
ResolveEditorActionRoute(m_session.activePanelId));
}
UIEditorWorkspaceController EditorContext::BuildWorkspaceController() const {
return UIEditorWorkspaceController(
m_shellAsset.panelRegistry,
@@ -235,12 +190,8 @@ UIEditorWorkspaceController EditorContext::BuildWorkspaceController() const {
m_shellAsset.workspaceSession);
}
const UIEditorShellInteractionServices& EditorContext::GetShellServices() const {
return m_shellServices;
}
const UIEditorTextMeasurer* EditorContext::GetTextMeasurer() const {
return m_shellServices.textMeasurer;
return m_textMeasurer;
}
bool EditorContext::RequestOpenSceneAsset(const std::filesystem::path& scenePath) {