Description

The child widget of Retainerbox was applied incorrectly offset the RenderTranslation of the parent widget and draws it. This issue is 4.24 only. it's fine as well as the preview on UMG Designer in 4.22 and 4.23.

Steps to Reproduce
  1. Create New UserWidget.
  2. Adding Retainerbox and set value "Size X=200", Size Y=200", "Translation.X=100.0", "Translation.Y=100.0".
  3. Adding Text Block as child widget of Retainerbox.
  4. Adding CreateWidget and AddToViewport, show UserWidgeet.
  5. Play In Editor.

Result:

 TextBlock displayed with wrong offset. . (offset: x=200.0, y=200.0)

Expect:

 TextBlock displayed correct. (offset: x=100.0, y=100.0)

 

Workaround:

Applying the following change.

int32 SRetainerWidget::PaintSlowPath(const FSlateInvalidationContext& Context)
{
#if 1
    FGeometry AllottedGeometry = GetPaintSpaceGeometry();
    const FPaintGeometry PaintGeometry = AllottedGeometry.ToPaintGeometry();
    const FVector2D RenderSize = PaintGeometry.GetLocalSize() * PaintGeometry.GetAccumulatedRenderTransform().GetMatrix().GetScale().GetVector();
    const uint32 RenderTargetWidth = FMath::RoundToInt(RenderSize.X);
    const uint32 RenderTargetHeight = FMath::RoundToInt(RenderSize.Y);
    const float Scale = AllottedGeometry.Scale;
    const FVector2D DrawSize = FVector2D(RenderTargetWidth, RenderTargetHeight);
    const FGeometry RetainedWindowGeometry = FGeometry::MakeRoot(DrawSize * ( 1 / Scale ), FSlateLayoutTransform(Scale, PaintGeometry.DrawPosition));
    return SCompoundWidget::OnPaint(*Context.PaintArgs, RetainedWindowGeometry, Context.CullingRect, *Context.WindowElementList, Context.IncomingLayerId, Context.WidgetStyle, Context.bParentEnabled);
#else
    return SCompoundWidget::OnPaint(*Context.PaintArgs, GetPaintSpaceGeometry(), Context.CullingRect, *Context.WindowElementList, Context.IncomingLayerId, Context.WidgetStyle, Context.bParentEnabled);
#endif
}

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-88093 in the post.

20
Login to Vote

Fixed
ComponentUE - Editor - UI Systems
Affects Versions4.244.24.2
Target Fix4.27
CreatedFeb 5, 2020
ResolvedFeb 22, 2021
UpdatedFeb 24, 2021
View Jira Issue