Refactor new editor scene runtime ownership

This commit is contained in:
2026-04-18 00:45:14 +08:00
parent 2fe1076218
commit b48760ca3d
12 changed files with 792 additions and 326 deletions

View File

@@ -1,6 +1,7 @@
#include "EditorContext.h"
#include "Composition/EditorShellAssetBuilder.h"
#include "Scene/EditorSceneRuntime.h"
#include <sstream>
#include <utility>
@@ -28,7 +29,7 @@ std::string ComposeStatusText(
} // namespace
bool EditorContext::Initialize(const std::filesystem::path& repoRoot) {
m_shellAsset = BuildEditorShellAsset(repoRoot);
m_shellAsset = BuildEditorApplicationShellAsset(repoRoot);
m_shellValidation = ValidateEditorShellAsset(m_shellAsset);
if (!m_shellValidation.IsValid()) {
return false;
@@ -37,6 +38,8 @@ bool EditorContext::Initialize(const std::filesystem::path& repoRoot) {
m_session = {};
m_session.repoRoot = repoRoot;
m_session.projectRoot = (repoRoot / "project").lexically_normal();
m_sceneRuntime = {};
m_sceneRuntime.Initialize(m_session.projectRoot);
m_hostCommandBridge.BindSession(m_session);
m_shortcutManager = BuildEditorShellShortcutManager(m_shellAsset);
m_shortcutManager.SetHostCommandHandler(&m_hostCommandBridge);
@@ -83,6 +86,14 @@ const EditorSession& EditorContext::GetSession() const {
return m_session;
}
EditorSceneRuntime& EditorContext::GetSceneRuntime() {
return m_sceneRuntime;
}
const EditorSceneRuntime& EditorContext::GetSceneRuntime() const {
return m_sceneRuntime;
}
void EditorContext::SetSelection(EditorSelectionState selection) {
m_session.selection = std::move(selection);
}
@@ -106,7 +117,7 @@ UIEditorShellInteractionDefinition EditorContext::BuildShellDefinition(
const UIEditorWorkspaceController& workspaceController,
std::string_view captureText,
EditorShellVariant variant) const {
return BuildEditorShellInteractionDefinition(
return BuildEditorApplicationShellInteractionDefinition(
m_shellAsset,
workspaceController,
ComposeStatusText(m_lastStatus, m_lastMessage),