refactor editor product architecture

This commit is contained in:
2026-04-30 20:23:23 +08:00
parent 5ceb9443e7
commit 08968b2df2
280 changed files with 7421 additions and 6816 deletions

View File

@@ -83,26 +83,32 @@ public:
UIEditorPanelRegistry panelRegistry,
UIEditorWorkspaceModel workspace,
UIEditorWorkspaceSession session);
static UIEditorWorkspaceController Bind(
const UIEditorPanelRegistry& panelRegistry,
UIEditorWorkspaceModel& workspace,
UIEditorWorkspaceSession& session);
void Rebind(
UIEditorWorkspaceModel& workspace,
UIEditorWorkspaceSession& session);
UIEditorWorkspaceController(const UIEditorWorkspaceController& other);
UIEditorWorkspaceController& operator=(const UIEditorWorkspaceController& other);
UIEditorWorkspaceController(UIEditorWorkspaceController&&) noexcept = default;
UIEditorWorkspaceController& operator=(UIEditorWorkspaceController&&) noexcept = default;
static UIEditorWorkspaceController BindToState(
UIEditorPanelRegistry panelRegistry,
UIEditorWorkspaceModel& workspace,
UIEditorWorkspaceSession& session);
const UIEditorPanelRegistry& GetPanelRegistry() const {
return m_panelRegistry;
}
const UIEditorWorkspaceModel& GetWorkspace() const {
return m_workspace;
return m_workspaceBinding != nullptr
? *m_workspaceBinding
: m_workspace;
}
const UIEditorWorkspaceSession& GetSession() const {
return m_session;
return m_sessionBinding != nullptr
? *m_sessionBinding
: m_session;
}
UIEditorWorkspaceControllerValidationResult ValidateState() const;
@@ -128,8 +134,6 @@ public:
UIEditorWorkspaceCommandResult Dispatch(const UIEditorWorkspaceCommand& command);
private:
void SyncBoundState();
UIEditorWorkspaceCommandResult BuildResult(
const UIEditorWorkspaceCommand& command,
UIEditorWorkspaceCommandStatus status,
@@ -148,14 +152,16 @@ private:
std::string message) const;
const UIEditorPanelDescriptor* FindPanelDescriptor(std::string_view panelId) const;
UIEditorWorkspaceModel& GetMutableWorkspace();
UIEditorWorkspaceSession& GetMutableSession();
UIEditorPanelRegistry m_panelRegistry = {};
UIEditorWorkspaceModel m_baselineWorkspace = {};
UIEditorWorkspaceSession m_baselineSession = {};
UIEditorWorkspaceModel m_workspace = {};
UIEditorWorkspaceSession m_session = {};
UIEditorWorkspaceModel* m_boundWorkspace = nullptr;
UIEditorWorkspaceSession* m_boundSession = nullptr;
UIEditorWorkspaceModel* m_workspaceBinding = nullptr;
UIEditorWorkspaceSession* m_sessionBinding = nullptr;
};
UIEditorWorkspaceController BuildDefaultUIEditorWorkspaceController(