refactor(new_editor): streamline internal layout and command routing

This commit is contained in:
2026-04-15 19:30:58 +08:00
parent 9654f4d91a
commit df8f433fbb
84 changed files with 3250 additions and 3008 deletions

View File

@@ -65,6 +65,37 @@ const ProjectPanel::AssetEntry* ProjectPanel::FindAssetEntry(std::string_view it
return m_browserModel.FindAssetEntry(itemId);
}
std::optional<ProjectPanel::EditCommandTarget> ProjectPanel::ResolveEditCommandTarget() const {
if (m_assetSelection.HasSelection()) {
const AssetEntry* asset = FindAssetEntry(m_assetSelection.GetSelectedId());
if (asset != nullptr) {
EditCommandTarget target = {};
target.itemId = asset->itemId;
target.absolutePath = asset->absolutePath;
target.displayName = asset->displayName;
target.directory = asset->directory;
return target;
}
}
if (!m_folderSelection.HasSelection()) {
return std::nullopt;
}
const FolderEntry* folder = FindFolderEntry(m_folderSelection.GetSelectedId());
if (folder == nullptr) {
return std::nullopt;
}
EditCommandTarget target = {};
target.itemId = folder->itemId;
target.absolutePath = folder->absolutePath;
target.displayName = folder->label;
target.directory = true;
target.assetsRoot = folder->absolutePath == m_browserModel.GetAssetsRootPath();
return target;
}
const UIEditorPanelContentHostPanelState* ProjectPanel::FindMountedProjectPanel(
const UIEditorPanelContentHostFrame& contentHostFrame) const {
for (const UIEditorPanelContentHostPanelState& panelState : contentHostFrame.panelStates) {