Refactor new editor state ownership model

This commit is contained in:
2026-04-19 04:36:52 +08:00
parent 48bfde28e3
commit f45b34a03a
46 changed files with 1979 additions and 217 deletions

View File

@@ -2,6 +2,7 @@
#include "Features/Project/ProjectBrowserModel.h"
#include "State/EditorSelectionService.h"
#include "State/EditorSession.h"
#include <XCEngine/UI/Types.h>
@@ -38,6 +39,7 @@ public:
};
bool Initialize(const std::filesystem::path& repoRoot);
void BindSelectionService(EditorSelectionService* selectionService);
void SetFolderIcon(const ::XCEngine::UI::UITextureHandle& icon);
void Refresh();
@@ -98,14 +100,15 @@ public:
std::string* movedFolderId = nullptr);
private:
void ApplySelection(
const ProjectBrowserModel::AssetEntry& asset,
bool preserveStamp);
EditorSelectionService& SelectionService();
const EditorSelectionService& SelectionService() const;
void ApplySelection(const ProjectBrowserModel::AssetEntry& asset);
void RevalidateSelection();
bool SelectionTargetsItem(std::string_view itemId) const;
ProjectBrowserModel m_browserModel = {};
EditorSelectionState m_selection = {};
EditorSelectionService m_ownedSelectionService = {};
EditorSelectionService* m_selectionService = &m_ownedSelectionService;
std::optional<std::filesystem::path> m_pendingSceneOpenPath = std::nullopt;
};