Working on new root canvas stuff

This commit is contained in:
2026-04-21 22:28:22 -04:00
parent 8e5d43fd24
commit 4420c52b74
4 changed files with 37 additions and 1 deletions

View File

@@ -256,6 +256,10 @@ void AlxPlayerControllerBase::BuildInputStack(TArray<UInputComponent*>& InputSta
void AlxPlayerControllerBase::UpdateInputMode() void AlxPlayerControllerBase::UpdateInputMode()
{ {
// Drain any deferred ZOrder writes from SetWidgetWindowManagement
// before we read the front-most slot.
RootCanvas->PropagateZOrderToSlate();
// Get all the various objects we need to be able to manipulate // Get all the various objects we need to be able to manipulate
// the input mode. // the input mode.
UGameViewportClient *GameViewportClient = GetWorld()->GetGameViewport(); UGameViewportClient *GameViewportClient = GetWorld()->GetGameViewport();

View File

@@ -54,6 +54,18 @@ int32 UlxRootCanvasPanel::GetMaxZOrder() const
return MaxZOrder; return MaxZOrder;
} }
void UlxRootCanvasPanel::PropagateZOrderToSlate()
{
if (!MustPropagateZOrderToSlate) return;
MustPropagateZOrderToSlate = false;
for (UPanelSlot *PanelSlot : Slots)
{
UlxRootCanvasSlot *TypedSlot = Cast<UlxRootCanvasSlot>(PanelSlot);
check(TypedSlot);
TypedSlot->SetZOrder(TypedSlot->GetZOrder());
}
}
TArray<UlxRootCanvasSlot*> UlxRootCanvasPanel::GetSortedUserWidgets() TArray<UlxRootCanvasSlot*> UlxRootCanvasPanel::GetSortedUserWidgets()
{ {
TArray<UlxRootCanvasSlot*> Result; TArray<UlxRootCanvasSlot*> Result;
@@ -95,7 +107,15 @@ void UlxRootCanvasPanel::SetWidgetWindowManagement(class UUserWidget *Widget,
Widget->SetDesiredFocusWidget(DesiredFocusWidget); Widget->SetDesiredFocusWidget(DesiredFocusWidget);
if (BringToFront) if (BringToFront)
{ {
Slot->SetZOrder(Panel->GetMaxZOrder() + 1); // Write the int32 ZOrder UPROPERTY directly and defer the
// Slate-side push to PropagateZOrderToSlate. Going through SetZOrder
// here is unsafe when called from Event Construct: the FSlot
// has been Exposed but its Owner isn't set yet, which fires
// an ensure in SConstraintCanvas::FSlot::SetZOrder.
PRAGMA_DISABLE_DEPRECATION_WARNINGS
Slot->ZOrder = Panel->GetMaxZOrder() + 1;
PRAGMA_ENABLE_DEPRECATION_WARNINGS
Panel->MustPropagateZOrderToSlate = true;
} }
} }

View File

@@ -91,6 +91,13 @@ public:
// Used as the basis for placing new widgets on top. // Used as the basis for placing new widgets on top.
int32 GetMaxZOrder() const; int32 GetMaxZOrder() const;
// SetZOrder is buggy: if you call it inside Event Construct,
// it crashes. So we've developed a hack to make it reliable.
// To set the zorder, you store the value in the slot property,
// without calling SetZorder. This routine, which is used later,
// propagates that value into the slate widgets.
void PropagateZOrderToSlate();
// This function updates several window-management-related properties // This function updates several window-management-related properties
// which are stored in the UserWidget and the lxRootCanvasSlot. Note that // which are stored in the UserWidget and the lxRootCanvasSlot. Note that
// it is perfectly legal to edit these properties by other means: this // it is perfectly legal to edit these properties by other means: this
@@ -115,6 +122,10 @@ protected:
// UPanelWidget // UPanelWidget
virtual UClass* GetSlotClass() const override; virtual UClass* GetSlotClass() const override;
public:
bool MustPropagateZOrderToSlate = false;
}; };

View File

@@ -168,6 +168,7 @@ def UEFStringSummaryProvider(valobj, dict):
############################################################ ############################################################
def UEFNameSummaryProvider(valobj, dict): def UEFNameSummaryProvider(valobj, dict):
valobj = valobj.GetNonSyntheticValue()
target = valobj.GetTarget() target = valobj.GetTarget()
process = target.GetProcess() process = target.GetProcess()
entry_id = valobj.GetChildMemberWithName('DisplayIndex') entry_id = valobj.GetChildMemberWithName('DisplayIndex')