refactor(new_editor): streamline internal layout and command routing
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user