From 1a3b3577fdce59eb43019c489d9f25de61d87a02 Mon Sep 17 00:00:00 2001 From: ssdfasd <2156608475@qq.com> Date: Wed, 22 Apr 2026 16:37:20 +0800 Subject: [PATCH] new_editor: decouple workspace event sync --- new_editor/app/Composition/EditorShellRuntime.cpp | 13 ++++--------- new_editor/app/Composition/EditorShellRuntime.h | 2 -- new_editor/app/Composition/WorkspaceEventSync.cpp | 10 ++++------ new_editor/app/Composition/WorkspaceEventSync.h | 7 +++++-- 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/new_editor/app/Composition/EditorShellRuntime.cpp b/new_editor/app/Composition/EditorShellRuntime.cpp index a49fae7a..6721e988 100644 --- a/new_editor/app/Composition/EditorShellRuntime.cpp +++ b/new_editor/app/Composition/EditorShellRuntime.cpp @@ -76,14 +76,6 @@ const std::vector& EditorShellRuntime::GetTraceEntries() co return m_traceEntries; } -const std::vector& EditorShellRuntime::GetHierarchyPanelEvents() const { - return m_hierarchyPanel.GetFrameEvents(); -} - -const std::vector& EditorShellRuntime::GetProjectPanelEvents() const { - return m_projectPanel.GetFrameEvents(); -} - const std::string& EditorShellRuntime::GetBuiltInIconError() const { return m_builtInIcons.GetLastError(); } @@ -226,7 +218,10 @@ void EditorShellRuntime::Update( .projectPanel = m_projectPanel, .sceneViewportFeature = m_sceneViewportFeature, }); - m_traceEntries = SyncWorkspaceEvents(context, *this); + m_traceEntries = SyncWorkspaceEvents( + context, + m_hierarchyPanel.GetFrameEvents(), + m_projectPanel.GetFrameEvents()); } } // namespace XCEngine::UI::Editor::App diff --git a/new_editor/app/Composition/EditorShellRuntime.h b/new_editor/app/Composition/EditorShellRuntime.h index deb97394..5fdb12d3 100644 --- a/new_editor/app/Composition/EditorShellRuntime.h +++ b/new_editor/app/Composition/EditorShellRuntime.h @@ -78,8 +78,6 @@ public: const UIEditorShellInteractionFrame& GetShellFrame() const; const UIEditorShellInteractionState& GetShellInteractionState() const; const std::vector& GetTraceEntries() const; - const std::vector& GetHierarchyPanelEvents() const; - const std::vector& GetProjectPanelEvents() const; const std::string& GetBuiltInIconError() const; void SetExternalDockHostDropPreview( const Widgets::UIEditorDockHostDropPreviewState& preview); diff --git a/new_editor/app/Composition/WorkspaceEventSync.cpp b/new_editor/app/Composition/WorkspaceEventSync.cpp index edf942ba..fb1f3a68 100644 --- a/new_editor/app/Composition/WorkspaceEventSync.cpp +++ b/new_editor/app/Composition/WorkspaceEventSync.cpp @@ -1,9 +1,6 @@ #include "Composition/WorkspaceEventSync.h" #include "Composition/EditorContext.h" -#include "Features/Hierarchy/HierarchyPanel.h" -#include "Features/Project/ProjectPanel.h" -#include "Composition/EditorShellRuntime.h" #include "Composition/EditorPanelIds.h" @@ -142,7 +139,8 @@ std::string DescribeHierarchyPanelEvent(const HierarchyPanel::Event& event) { std::vector SyncWorkspaceEvents( EditorContext& context, - const EditorShellRuntime& runtime) { + const std::vector& hierarchyPanelEvents, + const std::vector& projectPanelEvents) { std::vector entries = {}; context.SyncSessionFromSelectionService(); if (const std::optional scenePath = @@ -152,13 +150,13 @@ std::vector SyncWorkspaceEvents( context.SyncSessionFromSelectionService(); } - for (const HierarchyPanel::Event& event : runtime.GetHierarchyPanelEvents()) { + for (const HierarchyPanel::Event& event : hierarchyPanelEvents) { const std::string message = DescribeHierarchyPanelEvent(event); context.SetStatus("Hierarchy", message); entries.push_back(WorkspaceTraceEntry{ std::string(kHierarchyPanelId), std::move(message) }); } - for (const ProjectPanel::Event& event : runtime.GetProjectPanelEvents()) { + for (const ProjectPanel::Event& event : projectPanelEvents) { const std::string message = DescribeProjectPanelEvent(event); context.SetStatus("Project", message); entries.push_back(WorkspaceTraceEntry{ std::string(kProjectPanelId), std::move(message) }); diff --git a/new_editor/app/Composition/WorkspaceEventSync.h b/new_editor/app/Composition/WorkspaceEventSync.h index 88c074d8..49160d4a 100644 --- a/new_editor/app/Composition/WorkspaceEventSync.h +++ b/new_editor/app/Composition/WorkspaceEventSync.h @@ -1,12 +1,14 @@ #pragma once +#include "Features/Hierarchy/HierarchyPanel.h" +#include "Features/Project/ProjectPanel.h" + #include #include namespace XCEngine::UI::Editor::App { class EditorContext; -class EditorShellRuntime; struct WorkspaceTraceEntry { std::string channel = {}; @@ -15,7 +17,8 @@ struct WorkspaceTraceEntry { std::vector SyncWorkspaceEvents( EditorContext& context, - const EditorShellRuntime& runtime); + const std::vector& hierarchyPanelEvents, + const std::vector& projectPanelEvents); } // namespace XCEngine::UI::Editor::App