new_editor: close editor-layer app boundary

This commit is contained in:
2026-04-22 16:24:59 +08:00
parent a805803858
commit 2c2a8b8669
25 changed files with 1036 additions and 439 deletions

View File

@@ -1,6 +1,5 @@
#include "HierarchyPanel.h"
#include "Rendering/Assets/BuiltInIcons.h"
#include "Composition/EditorPanelIds.h"
#include <XCEditor/Foundation/UIEditorTheme.h>
#include "Scene/EditorSceneRuntime.h"
#include "State/EditorCommandFocusService.h"
@@ -98,17 +97,6 @@ void HierarchyPanel::ResetInteractionState() {
ResetTransientState();
}
const UIEditorPanelContentHostPanelState* HierarchyPanel::FindMountedHierarchyPanel(
const UIEditorPanelContentHostFrame& contentHostFrame) const {
for (const UIEditorPanelContentHostPanelState& panelState : contentHostFrame.panelStates) {
if (panelState.panelId == kHierarchyPanelId && panelState.mounted) {
return &panelState;
}
}
return nullptr;
}
void HierarchyPanel::ResetTransientState() {
m_frameEvents.clear();
TreeDrag::ResetTransientRequests(m_dragState);
@@ -497,17 +485,17 @@ UIEditorHostCommandDispatchResult HierarchyPanel::DispatchEditCommand(
void HierarchyPanel::ProcessDragAndFrameEvents(
const std::vector<UIInputEvent>& inputEvents,
const UIRect& bounds,
const PanelInputContext& inputContext) {
const UIEditorHostedPanelDispatchEntry& dispatchEntry) {
const std::vector<UIInputEvent> filteredEvents = BuildUIEditorTreePanelInputEvents(
bounds,
inputEvents,
UIEditorTreePanelInputFilterOptions{
.allowInteraction = inputContext.allowInteraction,
.hasInputFocus = inputContext.hasInputFocus,
.allowInteraction = dispatchEntry.allowInteraction,
.hasInputFocus = dispatchEntry.focused,
.captureActive = HasActivePointerCapture()
},
inputContext.focusGained,
inputContext.focusLost);
dispatchEntry.focusGained,
dispatchEntry.focusLost);
if (m_treeFrame.result.selectionChanged) {
SyncSceneRuntimeSelectionFromTree();
@@ -579,14 +567,11 @@ void HierarchyPanel::ProcessDragAndFrameEvents(
}
void HierarchyPanel::Update(
const UIEditorPanelContentHostFrame& contentHostFrame,
const std::vector<UIInputEvent>& inputEvents,
const PanelInputContext& inputContext) {
const UIEditorHostedPanelDispatchEntry& dispatchEntry,
const std::vector<UIInputEvent>& inputEvents) {
ResetTransientState();
const UIEditorPanelContentHostPanelState* panelState =
FindMountedHierarchyPanel(contentHostFrame);
if (panelState == nullptr) {
if (!dispatchEntry.mounted) {
m_visible = false;
m_treeFrame = {};
m_dragState = {};
@@ -604,23 +589,26 @@ void HierarchyPanel::Update(
m_visible = true;
const std::vector<UIInputEvent> filteredEvents = BuildUIEditorTreePanelInputEvents(
panelState->bounds,
dispatchEntry.bounds,
inputEvents,
UIEditorTreePanelInputFilterOptions{
.allowInteraction = inputContext.allowInteraction,
.hasInputFocus = inputContext.hasInputFocus,
.allowInteraction = dispatchEntry.allowInteraction,
.hasInputFocus = dispatchEntry.focused,
.captureActive = HasActivePointerCapture()
},
inputContext.focusGained,
inputContext.focusLost);
dispatchEntry.focusGained,
dispatchEntry.focusLost);
SyncTreeFocusState(filteredEvents);
ClaimCommandFocus(filteredEvents, panelState->bounds, inputContext.allowInteraction);
ClaimCommandFocus(
filteredEvents,
dispatchEntry.bounds,
dispatchEntry.allowInteraction);
const Widgets::UIEditorTreeViewMetrics treeMetrics =
ResolveUIEditorTreeViewMetrics();
const Widgets::UIEditorTreeViewLayout layout =
Widgets::BuildUIEditorTreeViewLayout(
panelState->bounds,
dispatchEntry.bounds,
m_treeItems,
m_expansion,
treeMetrics,
@@ -646,7 +634,7 @@ void HierarchyPanel::Update(
m_treeInteractionState,
m_treeSelection,
m_expansion,
panelState->bounds,
dispatchEntry.bounds,
m_treeItems,
interactionEvents,
treeMetrics);
@@ -660,8 +648,8 @@ void HierarchyPanel::Update(
ProcessDragAndFrameEvents(
inputEvents,
panelState->bounds,
inputContext);
dispatchEntry.bounds,
dispatchEntry);
}
void HierarchyPanel::Append(UIDrawList& drawList) const {