Refactor new editor scene runtime ownership
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
#include "Features/Project/ProjectPanel.h"
|
||||
#include "Composition/EditorShellRuntime.h"
|
||||
|
||||
#include <XCEditor/App/EditorPanelIds.h>
|
||||
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
|
||||
@@ -114,15 +116,20 @@ void ApplyHierarchySelection(
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.itemId.empty()) {
|
||||
context.ClearSelection();
|
||||
const EditorSceneRuntime& sceneRuntime = context.GetSceneRuntime();
|
||||
if (!sceneRuntime.HasSceneSelection()) {
|
||||
if (context.GetSession().selection.kind == EditorSelectionKind::HierarchyNode) {
|
||||
context.ClearSelection();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
EditorSelectionState selection = {};
|
||||
selection.kind = EditorSelectionKind::HierarchyNode;
|
||||
selection.itemId = event.itemId;
|
||||
selection.displayName = event.label.empty() ? event.itemId : event.label;
|
||||
selection.itemId = sceneRuntime.GetSelectedItemId();
|
||||
selection.displayName = sceneRuntime.GetSelectedDisplayName().empty()
|
||||
? selection.itemId
|
||||
: sceneRuntime.GetSelectedDisplayName();
|
||||
context.SetSelection(std::move(selection));
|
||||
}
|
||||
|
||||
@@ -166,14 +173,14 @@ std::vector<WorkspaceTraceEntry> SyncWorkspaceEvents(
|
||||
ApplyHierarchySelection(context, event);
|
||||
const std::string message = DescribeHierarchyPanelEvent(event);
|
||||
context.SetStatus("Hierarchy", message);
|
||||
entries.push_back(WorkspaceTraceEntry{ "hierarchy", std::move(message) });
|
||||
entries.push_back(WorkspaceTraceEntry{ std::string(kHierarchyPanelId), std::move(message) });
|
||||
}
|
||||
|
||||
for (const ProjectPanel::Event& event : runtime.GetProjectPanelEvents()) {
|
||||
ApplyProjectSelection(context, event);
|
||||
const std::string message = DescribeProjectPanelEvent(event);
|
||||
context.SetStatus("Project", message);
|
||||
entries.push_back(WorkspaceTraceEntry{ "project", std::move(message) });
|
||||
entries.push_back(WorkspaceTraceEntry{ std::string(kProjectPanelId), std::move(message) });
|
||||
}
|
||||
|
||||
return entries;
|
||||
|
||||
Reference in New Issue
Block a user