editor: remove shared panel services bag
This commit is contained in:
@@ -9,9 +9,11 @@
|
||||
#include "Scene/SceneEditCommandRoute.h"
|
||||
#include "Scene/SceneViewportFeature.h"
|
||||
#include "Product/EditorProductManifest.h"
|
||||
#include "Windowing/EditorFrameServices.h"
|
||||
|
||||
#include <XCEditor/Panels/UIEditorHostedPanelDispatch.h>
|
||||
|
||||
#include <filesystem>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
|
||||
@@ -26,6 +28,22 @@ constexpr int kProjectUpdatePriority = 20;
|
||||
constexpr int kInspectorUpdatePriority = 30;
|
||||
constexpr int kConsoleUpdatePriority = 40;
|
||||
|
||||
void RequestUtilityWindowFromFrameServices(
|
||||
void* requester,
|
||||
EditorUtilityWindowKind kind) {
|
||||
auto* frameServices = static_cast<EditorFrameServices*>(requester);
|
||||
if (frameServices != nullptr) {
|
||||
frameServices->RequestOpenUtilityWindow(kind);
|
||||
}
|
||||
}
|
||||
|
||||
bool RequestSceneAssetFromFrameServices(
|
||||
void* requester,
|
||||
const std::filesystem::path& scenePath) {
|
||||
auto* frameServices = static_cast<EditorFrameServices*>(requester);
|
||||
return frameServices != nullptr && frameServices->RequestOpenSceneAsset(scenePath);
|
||||
}
|
||||
|
||||
const UIEditorHostedPanelDispatchEntry& ResolveHostedPanelDispatchEntry(
|
||||
const UIEditorHostedPanelDispatchFrame& dispatchFrame,
|
||||
std::string_view panelId) {
|
||||
@@ -187,7 +205,7 @@ public:
|
||||
|
||||
void Update(const EditorWorkspacePanelUpdateContext& context) override {
|
||||
m_panel.Update(
|
||||
context.services.session,
|
||||
context.frameServices.GetSession(),
|
||||
ResolveHostedPanelDispatchEntry(
|
||||
context.shellFrame.hostedPanelDispatchFrame,
|
||||
GetPanelId()));
|
||||
@@ -230,10 +248,10 @@ public:
|
||||
}
|
||||
|
||||
void PrepareForShellDefinition(
|
||||
EditorPanelServices& services,
|
||||
EditorFrameServices& frameServices,
|
||||
UIEditorWorkspaceController&) override {
|
||||
m_panel.SetSceneRuntime(&services.sceneRuntime);
|
||||
m_panel.SetCommandFocusService(&services.commandFocusService);
|
||||
m_panel.SetSceneRuntime(&frameServices.GetSceneRuntime());
|
||||
m_panel.SetCommandFocusService(&frameServices.GetCommandFocusService());
|
||||
}
|
||||
|
||||
void Update(const EditorWorkspacePanelUpdateContext& context) override {
|
||||
@@ -291,9 +309,18 @@ public:
|
||||
}
|
||||
|
||||
void Update(const EditorWorkspacePanelUpdateContext& context) override {
|
||||
m_panel.SetCommandFocusService(&context.services.commandFocusService);
|
||||
m_panel.SetCommandFocusService(&context.frameServices.GetCommandFocusService());
|
||||
InspectorPanelContext panelContext{
|
||||
.session = context.frameServices.GetSession(),
|
||||
.projectRuntime = context.frameServices.GetProjectRuntime(),
|
||||
.sceneRuntime = context.frameServices.GetSceneRuntime(),
|
||||
.colorPickerToolState = context.frameServices.GetColorPickerToolState(),
|
||||
.textMeasurer = context.frameServices.GetTextMeasurer(),
|
||||
.utilityWindowRequester = &context.frameServices,
|
||||
.requestUtilityWindow = RequestUtilityWindowFromFrameServices,
|
||||
};
|
||||
m_panel.Update(
|
||||
context.services,
|
||||
panelContext,
|
||||
ResolveHostedPanelDispatchEntry(
|
||||
context.shellFrame.hostedPanelDispatchFrame,
|
||||
GetPanelId()),
|
||||
@@ -340,12 +367,12 @@ public:
|
||||
}
|
||||
|
||||
void Update(const EditorWorkspacePanelUpdateContext& context) override {
|
||||
m_panel.SetProjectRuntime(&context.services.projectRuntime);
|
||||
m_panel.SetCommandFocusService(&context.services.commandFocusService);
|
||||
m_panel.SetSystemInteractionHost(context.services.systemInteractionHost);
|
||||
m_panel.SetProjectRuntime(&context.frameServices.GetProjectRuntime());
|
||||
m_panel.SetCommandFocusService(&context.frameServices.GetCommandFocusService());
|
||||
m_panel.SetSystemInteractionHost(context.frameServices.GetSystemInteractionHost());
|
||||
m_panel.SetSceneAssetOpenRequestHandler(
|
||||
context.services.sceneAssetOpenRequester,
|
||||
context.services.requestOpenSceneAsset);
|
||||
&context.frameServices,
|
||||
RequestSceneAssetFromFrameServices);
|
||||
m_panel.Update(
|
||||
ResolveHostedPanelDispatchEntry(
|
||||
context.shellFrame.hostedPanelDispatchFrame,
|
||||
@@ -428,16 +455,16 @@ public:
|
||||
}
|
||||
|
||||
void PrepareForShellDefinition(
|
||||
EditorPanelServices& services,
|
||||
EditorFrameServices& frameServices,
|
||||
UIEditorWorkspaceController&) override {
|
||||
m_commandRoute.BindSceneRuntime(&services.sceneRuntime);
|
||||
m_feature.SetCommandFocusService(&services.commandFocusService);
|
||||
m_feature.SyncRenderRequest(services.sceneRuntime);
|
||||
m_commandRoute.BindSceneRuntime(&frameServices.GetSceneRuntime());
|
||||
m_feature.SetCommandFocusService(&frameServices.GetCommandFocusService());
|
||||
m_feature.SyncRenderRequest(frameServices.GetSceneRuntime());
|
||||
}
|
||||
|
||||
void Update(const EditorWorkspacePanelUpdateContext& context) override {
|
||||
m_feature.Update(
|
||||
context.services.sceneRuntime,
|
||||
context.frameServices.GetSceneRuntime(),
|
||||
context.shellInteractionState.workspaceInteractionState.composeState,
|
||||
context.shellFrame.workspaceInteractionFrame.composeFrame);
|
||||
}
|
||||
@@ -483,9 +510,9 @@ public:
|
||||
}
|
||||
|
||||
void PrepareForShellDefinition(
|
||||
EditorPanelServices& services,
|
||||
EditorFrameServices& frameServices,
|
||||
UIEditorWorkspaceController&) override {
|
||||
m_feature.SetCommandFocusService(&services.commandFocusService);
|
||||
m_feature.SetCommandFocusService(&frameServices.GetCommandFocusService());
|
||||
}
|
||||
|
||||
void Update(const EditorWorkspacePanelUpdateContext& context) override {
|
||||
|
||||
Reference in New Issue
Block a user