Align editor runtime scene handoff

This commit is contained in:
2026-04-29 04:05:54 +08:00
parent 2fde2f16c2
commit 595d39c4c3
32 changed files with 996 additions and 52 deletions

View File

@@ -406,6 +406,13 @@ void ProjectPanel::SetSystemInteractionHost(
m_systemInteractionHost = systemInteractionHost;
}
void ProjectPanel::SetSceneAssetOpenRequestHandler(
void* requester,
SceneAssetOpenRequestFn requestOpenSceneAsset) {
m_sceneAssetOpenRequester = requester;
m_requestOpenSceneAsset = requestOpenSceneAsset;
}
void ProjectPanel::SetIconService(EditorIconService* icons) {
m_icons = icons;
RebuildWindowTreeItems();
@@ -853,6 +860,11 @@ bool ProjectPanel::NavigateToFolder(std::string_view itemId, EventSource source)
return true;
}
bool ProjectPanel::RequestOpenSceneAsset(const AssetEntry& asset) {
return m_requestOpenSceneAsset != nullptr &&
m_requestOpenSceneAsset(m_sceneAssetOpenRequester, asset.absolutePath);
}
bool ProjectPanel::OpenProjectItem(std::string_view itemId, EventSource source) {
const AssetEntry* asset = FindAssetEntry(itemId);
if (asset == nullptr) {
@@ -882,6 +894,11 @@ bool ProjectPanel::OpenProjectItem(std::string_view itemId, EventSource source)
return false;
}
if (asset->kind == ProjectBrowserModel::ItemKind::Scene &&
!RequestOpenSceneAsset(*asset)) {
return false;
}
EmitEvent(EventKind::AssetOpened, source, asset);
return true;
}