editor: centralize engine runtime access

This commit is contained in:
2026-04-28 17:23:10 +08:00
parent 23aab98a09
commit 357dc136fe
36 changed files with 337 additions and 102 deletions

View File

@@ -1,5 +1,6 @@
#include "ViewportHostService.h"
#include "Engine/EditorEngineServices.h"
#include "Panels/EditorPanelIds.h"
#include "Product/EditorProductManifest.h"
#include "Viewport/SceneViewportResourcePaths.h"
@@ -41,12 +42,18 @@ private:
} // namespace
ViewportHostService::ViewportHostService() = default;
ViewportHostService::ViewportHostService(EditorEngineServices* engineServices)
: m_engineServices(engineServices) {}
ViewportHostService::~ViewportHostService() = default;
void ViewportHostService::Initialize(const EditorRuntimePaths& runtimePaths) {
m_sceneViewportRuntime.Initialize(BuildSceneViewportShaderPaths(runtimePaths));
void ViewportHostService::Initialize(
const EditorRuntimePaths& runtimePaths,
EditorEngineServices& engineServices) {
m_engineServices = &engineServices;
m_sceneViewportRuntime.Initialize(
BuildSceneViewportShaderPaths(runtimePaths),
engineServices);
m_placeholderRenderers.clear();
for (const EditorProductPanelDescriptor& panel : GetEditorProductPanels()) {
if (panel.presentationKind != UIEditorPanelPresentationKind::ViewportShell) {
@@ -123,6 +130,7 @@ void ViewportHostService::Shutdown() {
m_windowRenderer = nullptr;
m_device = nullptr;
m_surfacePresentationEnabled = false;
m_engineServices = nullptr;
m_entries.clear();
m_retiredTargetsBySlot.clear();
}