UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SRetainerWidget.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "Stats/Stats.h"
7#include "Layout/Visibility.h"
8#include "Layout/SlateRect.h"
9#include "Layout/Geometry.h"
10#include "Input/Events.h"
12#include "Widgets/SWidget.h"
13#include "Styling/SlateBrush.h"
15#include "Layout/Children.h"
16#include "UObject/GCObject.h"
18#include "Input/HittestGrid.h"
20#include "Misc/FrameValue.h"
21
27
29
30
31
40{
41public:
43
44public:
53 SLATE_DEFAULT_SLOT(FArguments, Content)
54 SLATE_ARGUMENT(bool, RenderOnPhase)
55 SLATE_ARGUMENT(bool, RenderOnInvalidation)
56 SLATE_ARGUMENT_DEPRECATED(bool, RenderWithLocalTransform, 5.4, "This argument has no effect anymore, because bugs from each render path (with RenderWithLocalTransform set to true or false) have been fixed, making it no longer necessary.")
57 SLATE_ARGUMENT(int32, Phase)
58 SLATE_ARGUMENT(int32, PhaseCount)
59 SLATE_ARGUMENT(FName, StatId)
60#if WITH_EDITOR
62#endif
64
67
69 UMG_API void Construct(const FArguments& Args);
70
71 UMG_API void SetRenderingPhase(int32 Phase, int32 PhaseCount);
72
75
76#if WITH_EDITOR
79#endif
80
82
84
86
87 UMG_API void SetEffectMaterial(UMaterialInterface* EffectMaterial);
88
89 UMG_API void SetTextureParameter(FName TextureParameter);
90
91 //~ SWidget interface
92 UMG_API virtual FChildren* GetChildren() override;
93#if WITH_SLATE_DEBUGGING
95#endif
96
98
99protected:
101 UMG_API virtual int32 OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const override;
102 UMG_API virtual FVector2D ComputeDesiredSize(float Scale) const override;
103 virtual bool Advanced_IsInvalidationRoot() const { return bEnableRetainedRendering; }
104 virtual const FSlateInvalidationRoot* Advanced_AsInvalidationRoot() const override { return bEnableRetainedRendering ? this : nullptr; }
105 UMG_API virtual bool CustomPrepass(float LayoutScaleMultiplier) override;
106
107 //~ Begin FSlateInvalidationRoot interface
108 UMG_API virtual TSharedRef<SWidget> GetRootWidget() override;
110
120 //~ End FSlateInvalidationRoot interface
121
127
128private:
129 UMG_API void OnGlobalInvalidationToggled(bool bGlobalInvalidationEnabled);
130#if !UE_BUILD_SHIPPING
131 static UMG_API void OnRetainerModeCVarChanged( IConsoleVariable* CVar );
132 static UMG_API FOnRetainedModeChanged OnRetainerModeChangedDelegate;
133#endif
134
135 mutable FSlateBrush SurfaceBrush;
136
137 FIntPoint PreviousRenderSize;
138 FGeometry PreviousAllottedGeometry;
139 FIntPoint PreviousClipRectSize;
140 TOptional<FSlateClippingState> PreviousClippingState;
141 FColor PreviousColorAndOpacity;
142 int32 LastIncomingLayerId;
143
144 UMG_API void UpdateWidgetRenderer();
145
146 TSharedPtr<SWidget> MyWidget;
147 TSharedRef<SVirtualWindow> VirtualWindow;
148
149 TSharedRef<FHittestGrid> HittestGrid;
150
151 int32 Phase;
152 int32 PhaseCount;
153
154 bool bEnableRetainedRenderingDesire;
155 bool bEnableRetainedRendering;
156
157#if WITH_EDITOR
159 bool bIsDesignTime;
160
163
166#endif
167
168 bool RenderOnPhase;
169 bool RenderOnInvalidation;
170
171 bool bRenderRequested;
172 bool bInvalidSizeLogged;
173
174 double LastDrawTime;
175 int64 LastTickedFrame;
176
177 TWeakObjectPtr<UWorld> OuterWorld;
178
179 FRetainerWidgetRenderingResources* RenderingResources;
180
182
183 FSlateBrush DynamicBrush;
184
185 FName DynamicEffectTextureParameter;
186
187 static UMG_API TArray<SRetainerWidget*, TInlineAllocator<3>> Shared_WaitingToRender;
188 static UMG_API TFrameValue<int32> Shared_RetainerWorkThisFrame;
189};
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
#define STAT(x)
Definition Stats.h:44
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define SLATE_ARGUMENT_DEPRECATED(ArgType, ArgName, DeprecationVersion, DeprecationMessage)
Definition DeclarativeSyntaxSupport.h:215
#define SLATE_END_ARGS()
Definition DeclarativeSyntaxSupport.h:116
#define SLATE_DEFAULT_SLOT(DeclarationType, SlotName)
Definition DeclarativeSyntaxSupport.h:444
#define SLATE_ARGUMENT(ArgType, ArgName)
Definition DeclarativeSyntaxSupport.h:208
#define DECLARE_MULTICAST_DELEGATE(DelegateName)
Definition DelegateCombinations.h:23
Definition ArrangedChildren.h:15
Definition ChildrenBase.h:27
Definition NameTypes.h:617
Definition PaintArgs.h:23
Definition SRetainerWidget.cpp:72
Definition SlateInvalidationRoot.h:77
Definition SlateRect.h:26
Definition DrawElements.h:220
Definition WidgetStyle.h:15
Definition IConsoleManager.h:558
Definition SCompoundWidget.h:22
Definition SRetainerWidget.h:40
UMG_API EPaintRetainedContentResult PaintRetainedContentImpl(const FSlateInvalidationContext &Context, const FGeometry &AllottedGeometry, int32 LayerId)
Definition SRetainerWidget.cpp:403
UMG_API void SetContent(const TSharedRef< SWidget > &InContent)
Definition SRetainerWidget.cpp:314
virtual UMG_API int32 PaintSlowPath(const FSlateInvalidationContext &Context) override
Definition SRetainerWidget.cpp:746
UMG_API void Construct(const FArguments &Args)
Definition SRetainerWidget.cpp:185
UMG_API void SetWorld(UWorld *World)
Definition SRetainerWidget.cpp:355
virtual const FSlateInvalidationRoot * Advanced_AsInvalidationRoot() const override
Definition SRetainerWidget.h:104
UMG_API void SetTextureParameter(FName TextureParameter)
Definition SRetainerWidget.cpp:350
UMG_API void OnRetainerModeChanged()
Definition SRetainerWidget.cpp:257
UMG_API void SetEffectMaterial(UMaterialInterface *EffectMaterial)
Definition SRetainerWidget.cpp:328
UMG_API void RequestRender()
Definition SRetainerWidget.cpp:385
EPaintRetainedContentResult
Definition SRetainerWidget.h:112
UMG_API bool ShouldBeRenderingOffscreen() const
Definition SRetainerWidget.cpp:247
virtual UMG_API bool CustomPrepass(float LayoutScaleMultiplier) override
Definition SRetainerWidget.cpp:719
SLATE_BEGIN_ARGS(SRetainerWidget)
Definition SRetainerWidget.h:45
virtual UMG_API int32 OnPaint(const FPaintArgs &Args, const FGeometry &AllottedGeometry, const FSlateRect &MyCullingRect, FSlateWindowElementList &OutDrawElements, int32 LayerId, const FWidgetStyle &InWidgetStyle, bool bParentEnabled) const override
Definition SRetainerWidget.cpp:592
UMG_API void SetRetainedRendering(bool bRetainRendering)
Definition SRetainerWidget.cpp:293
virtual UMG_API TSharedRef< SWidget > GetRootWidget() override
Definition SRetainerWidget.cpp:741
UMG_API bool IsAnythingVisibleToRender() const
Definition SRetainerWidget.cpp:252
UMG_API void RefreshRenderingMode()
Definition SRetainerWidget.cpp:302
static UMG_API int32 Shared_MaxRetainerWorkPerFrame
Definition SRetainerWidget.h:42
virtual UMG_API FVector2D ComputeDesiredSize(float Scale) const override
Definition SRetainerWidget.cpp:700
UMG_API void SetRenderingPhase(int32 Phase, int32 PhaseCount)
Definition SRetainerWidget.cpp:379
UMG_API UMaterialInstanceDynamic * GetEffectMaterial() const
Definition SRetainerWidget.cpp:323
UMG_API void OnRootInvalidated()
Definition SRetainerWidget.cpp:279
virtual bool Advanced_IsInvalidationRoot() const
Definition SRetainerWidget.h:103
virtual UMG_API FChildren * GetChildren() override
Definition SRetainerWidget.cpp:360
Definition Array.h:670
Definition SharedPointer.h:692
Definition MaterialInstanceDynamic.h:15
Definition MaterialInterface.h:296
Definition TextureRenderTarget2D.h:104
Definition World.h:918
static SLATECORE_API const EVisibility SelfHitTestInvisible
Definition Visibility.h:26
Definition Color.h:486
Definition Geometry.h:40
Definition SlateBrush.h:239
Definition SlateInvalidationRoot.h:29
Definition FrameValue.h:15
Definition Optional.h:131
Definition LightweightStats.h:416
Definition WeakObjectPtrTemplates.h:25
Definition IntPoint.h:25