Advance editor runtime and scripting integration
This commit is contained in:
@@ -12,10 +12,20 @@ namespace XCEngine::UI::Editor::App {
|
||||
EditorShellRuntime::EditorShellRuntime(
|
||||
EditorWorkspacePanelRuntimeSet workspacePanels,
|
||||
std::unique_ptr<EditorIconService> iconService,
|
||||
std::unique_ptr<EditorViewportRuntimeServices> viewportRuntimeServices)
|
||||
std::unique_ptr<EditorViewportRuntimeServices> viewportRuntimeServices,
|
||||
UIEditorShortcutManager shortcutManager,
|
||||
EditorHostCommandBridge::RuntimeCommandOwner& runtimeCommandOwner,
|
||||
std::function<void()> requestExit)
|
||||
: m_iconService(std::move(iconService))
|
||||
, m_viewportRuntimeServices(std::move(viewportRuntimeServices))
|
||||
, m_workspacePanels(std::move(workspacePanels)) {}
|
||||
, m_workspacePanels(std::move(workspacePanels))
|
||||
, m_shortcutManager(std::move(shortcutManager)) {
|
||||
m_hostCommandBridge.BindRuntimeCommandOwner(&runtimeCommandOwner);
|
||||
m_hostCommandBridge.SetExitRequestHandler(std::move(requestExit));
|
||||
m_shortcutManager.SetHostCommandHandler(&m_hostCommandBridge);
|
||||
m_shellServices.commandDispatcher = &m_shortcutManager.GetCommandDispatcher();
|
||||
m_shellServices.shortcutManager = &m_shortcutManager;
|
||||
}
|
||||
|
||||
void EditorShellRuntime::Initialize(
|
||||
const EditorRuntimePaths& runtimePaths,
|
||||
@@ -37,6 +47,7 @@ void EditorShellRuntime::Initialize(
|
||||
sceneViewportEngineBridge,
|
||||
gameViewportEngineBridge,
|
||||
shaderProvider);
|
||||
m_shellServices.textMeasurer = &textMeasurer;
|
||||
m_workspacePanels.Initialize(
|
||||
EditorWorkspacePanelInitializationContext{
|
||||
.runtimePaths = runtimePaths,
|
||||
@@ -71,6 +82,7 @@ void EditorShellRuntime::Shutdown() {
|
||||
m_traceEntries.clear();
|
||||
m_workspacePanels.Shutdown(EditorWorkspacePanelShutdownContext{});
|
||||
m_workspacePanels = {};
|
||||
m_shellServices.textMeasurer = nullptr;
|
||||
if (m_iconService != nullptr) {
|
||||
m_iconService->Shutdown();
|
||||
}
|
||||
@@ -165,11 +177,17 @@ bool EditorShellRuntime::HasInteractiveCapture() const {
|
||||
std::unique_ptr<EditorWorkspaceShellRuntime> CreateEditorWorkspaceShellRuntime(
|
||||
EditorWorkspacePanelRuntimeSet workspacePanels,
|
||||
std::unique_ptr<EditorIconService> iconService,
|
||||
std::unique_ptr<EditorViewportRuntimeServices> viewportRuntimeServices) {
|
||||
std::unique_ptr<EditorViewportRuntimeServices> viewportRuntimeServices,
|
||||
UIEditorShortcutManager shortcutManager,
|
||||
EditorHostCommandBridge::RuntimeCommandOwner& runtimeCommandOwner,
|
||||
std::function<void()> requestExit) {
|
||||
return std::make_unique<EditorShellRuntime>(
|
||||
std::move(workspacePanels),
|
||||
std::move(iconService),
|
||||
std::move(viewportRuntimeServices));
|
||||
std::move(viewportRuntimeServices),
|
||||
std::move(shortcutManager),
|
||||
runtimeCommandOwner,
|
||||
std::move(requestExit));
|
||||
}
|
||||
|
||||
} // namespace XCEngine::UI::Editor::App
|
||||
@@ -219,6 +237,14 @@ void EditorShellRuntime::Update(
|
||||
return;
|
||||
}
|
||||
|
||||
m_hostCommandBridge.BindCommandFocusService(
|
||||
m_workspacePanels.GetCommandFocusService());
|
||||
m_hostCommandBridge.BindEditCommandRoutes(
|
||||
m_workspacePanels.FindCommandRoute(EditorActionRoute::Hierarchy),
|
||||
m_workspacePanels.FindCommandRoute(EditorActionRoute::Project),
|
||||
m_workspacePanels.FindCommandRoute(EditorActionRoute::Scene),
|
||||
m_workspacePanels.FindCommandRoute(EditorActionRoute::Inspector));
|
||||
|
||||
const auto buildDefinition = [&]() {
|
||||
return m_sessionCoordinator.PrepareShellDefinition(
|
||||
EditorShellSessionCoordinatorContext{
|
||||
@@ -237,7 +263,7 @@ void EditorShellRuntime::Update(
|
||||
.workspaceController = workspaceController,
|
||||
.bounds = bounds,
|
||||
.inputEvents = inputEvents,
|
||||
.shellServices = frameServices.GetShellServices(),
|
||||
.shellServices = m_shellServices,
|
||||
.buildDefinition = buildDefinition,
|
||||
.hostedContentCaptureActive = HasHostedContentCapture(),
|
||||
.useDetachedTitleBarTabStrip = useDetachedTitleBarTabStrip,
|
||||
@@ -258,7 +284,6 @@ void EditorShellRuntime::Update(
|
||||
});
|
||||
m_traceEntries = frameServices.SyncWorkspacePanelFrameEvents(
|
||||
m_workspacePanels.CollectFrameEvents());
|
||||
frameServices.TickEditorRuntime();
|
||||
}
|
||||
|
||||
} // namespace XCEngine::UI::Editor::App
|
||||
|
||||
Reference in New Issue
Block a user