UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
DrawElementPayloads.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
6#include "Fonts/FontCache.h"
8#include "SlateRenderBatch.h"
10#include "Types/SlateVector2.h"
11
14
16// Deprecated payloads
18
20
21struct UE_DEPRECATED(5.3, "Draw Element Payloads are no longer used, instead use the equivalent FSlateDrawElement subclass") FSlateDataPayload
22{
23 virtual ~FSlateDataPayload() {}
24 virtual void AddReferencedObjects(FReferenceCollector& Collector) {}
25};
26
27struct UE_DEPRECATED(5.3, "Draw Element Payloads are no longer used, instead use the equivalent FSlateDrawElement subclass") FSlateBoxPayload : public FSlateDataPayload, public FSlateTintableElement
28{
29 FMargin Margin;
30 FBox2f UVRegion;
31 const FSlateShaderResourceProxy* ResourceProxy;
35
36 const FMargin& GetBrushMargin() const { return Margin; }
37 const FBox2f& GetBrushUVRegion() const { return UVRegion; }
38 ESlateBrushTileType::Type GetBrushTiling() const { return Tiling; }
39 ESlateBrushMirrorType::Type GetBrushMirroring() const { return Mirroring; }
40 ESlateBrushDrawType::Type GetBrushDrawType() const { return DrawType; }
41 const FSlateShaderResourceProxy* GetResourceProxy() const { return ResourceProxy; }
42
43 void SetBrush(const FSlateBrush* InBrush, UE::Slate::FDeprecateVector2DParameter LocalSize, float DrawScale)
44 {
46 ensureMsgf(InBrush->GetDrawType() != ESlateBrushDrawType::NoDrawType, TEXT("This should have been filtered out earlier in the Make... call."));
47
48 // Note: Do not store the brush. It is possible brushes are destroyed after an element is enqueued for rendering
49 Margin = InBrush->GetMargin();
50 UVRegion = InBrush->GetUVRegion();
51 Tiling = InBrush->GetTiling();
52 Mirroring = InBrush->GetMirroring();
53 DrawType = InBrush->GetDrawType();
54 const FSlateResourceHandle& Handle = InBrush->GetRenderingResource(LocalSize, DrawScale);
55 if (Handle.IsValid())
56 {
57 ResourceProxy = Handle.GetResourceProxy();
58 }
59 else
60 {
61 ResourceProxy = nullptr;
62 }
63 }
64
66 {
67 }
68};
69
70struct UE_DEPRECATED(5.3, "Draw Element Payloads are no longer used, instead use the equivalent FSlateDrawElement subclass") FSlateRoundedBoxPayload : public FSlateBoxPayload
71{
72 FLinearColor OutlineColor;
73 FVector4f Radius;
74 float OutlineWeight;
75
76 FORCEINLINE void SetRadius(FVector4f InRadius) { Radius = InRadius; }
77 FORCEINLINE FVector4f GetRadius() const { return Radius; }
78
79 FORCEINLINE void SetOutline(const FLinearColor& InOutlineColor, float InOutlineWeight) { OutlineColor = InOutlineColor; OutlineWeight = InOutlineWeight; }
80 FORCEINLINE FLinearColor GetOutlineColor() const { return OutlineColor; }
81 FORCEINLINE float GetOutlineWeight() const { return OutlineWeight; }
82};
83
84struct UE_DEPRECATED(5.3, "Draw Element Payloads are no longer used, instead use the equivalent FSlateDrawElement subclass") FSlateTextPayload : public FSlateDataPayload, public FSlateTintableElement
85{
86 // The font to use when rendering
87 FSlateFontInfo FontInfo;
88 // Basic text data
89 FString ImmutableText;
90
91 const FSlateFontInfo& GetFontInfo() const { return FontInfo; }
92 const TCHAR* GetText() const { return *ImmutableText; }
93 int32 GetTextLength() const { return ImmutableText.Len(); }
94
95 void SetText(const FString& InText, const FSlateFontInfo& InFontInfo, int32 InStartIndex, int32 InEndIndex)
96 {
97 FontInfo = InFontInfo;
98 const int32 StartIndex = FMath::Min<int32>(InStartIndex, InText.Len());
99 const int32 EndIndex = FMath::Min<int32>(InEndIndex, InText.Len());
100 const int32 TextLength = (EndIndex > StartIndex) ? EndIndex - StartIndex : 0;
101 if (TextLength > 0)
102 {
103 ImmutableText = InText.Mid(StartIndex, TextLength);
104 }
105 }
106
107 void SetText(const FString& InText, const FSlateFontInfo& InFontInfo)
108 {
109 FontInfo = InFontInfo;
110 ImmutableText = InText;
111 }
112
113
114 virtual void AddReferencedObjects(FReferenceCollector& Collector)
115 {
116 FontInfo.AddReferencedObjects(Collector);
117 }
118};
119
120struct UE_DEPRECATED(5.3, "Draw Element Payloads are no longer used, instead use the equivalent FSlateDrawElement subclass") FSlateShapedTextPayload : public FSlateDataPayload, public FSlateTintableElement
121{
122 // Shaped text data
123 FShapedGlyphSequencePtr ShapedGlyphSequence;
124
125 FLinearColor OutlineTint;
126
127 FTextOverflowArgs OverflowArgs;
128
129 const FShapedGlyphSequencePtr& GetShapedGlyphSequence() const { return ShapedGlyphSequence; }
130 FLinearColor GetOutlineTint() const { return OutlineTint; }
131
133 {
134 ShapedGlyphSequence = InShapedGlyphSequence;
135 OutlineTint = InOutlineTint;
136 }
137
138 void SetOverflowArgs(const FTextOverflowArgs& InArgs)
139 {
140 OverflowArgs = InArgs;
142 }
143
144 virtual void AddReferencedObjects(FReferenceCollector& Collector)
145 {
146 if (ShapedGlyphSequence.IsValid())
147 {
148 const_cast<FShapedGlyphSequence*>(ShapedGlyphSequence.Get())->AddReferencedObjects(Collector);
149 }
150
151 if (OverflowArgs.OverflowTextPtr.IsValid())
152 {
153 const_cast<FShapedGlyphSequence*>(OverflowArgs.OverflowTextPtr.Get())->AddReferencedObjects(Collector);
154 }
155 }
156};
157
158struct UE_DEPRECATED(5.3, "Draw Element Payloads are no longer used, instead use the equivalent FSlateDrawElement subclass") FSlateGradientPayload : public FSlateDataPayload
159{
160 TArray<FSlateGradientStop> GradientStops;
161 EOrientation GradientType;
162 FVector4f CornerRadius;
163
165 {
166 GradientStops = MoveTemp(InGradientStops);
167 GradientType = InGradientType;
168 CornerRadius = InCornerRadius;
169 }
170};
171
172struct UE_DEPRECATED(5.3, "Draw Element Payloads are no longer used, instead use the equivalent FSlateDrawElement subclass") FSlateSplinePayload : public FSlateDataPayload, public FSlateTintableElement
173{
174 TArray<FSlateGradientStop> GradientStops;
175 // Bezier Spline Data points. E.g.
176 //
177 // P1 + - - - - + P2 P1 +
178 // / \ / \
179 // P0 * * P3 P0 * \ * P3
180 // \ /
181 // + P2
182 FVector2f P0;
183 FVector2f P1;
184 FVector2f P2;
185 FVector2f P3;
186
187 float Thickness;
188
189 // Thickness
190 void SetThickness(float InThickness) { Thickness = InThickness; }
191 float GetThickness() const { return Thickness; }
192
194 {
195 Tint = InTint;
196 P0 = InP0;
197 P1 = InP1;
198 P2 = InP2;
199 P3 = InP3;
200 Thickness = InThickness;
201 }
202
204 {
205 Tint = InTint;
206 P0 = InStart;
207 P1 = InStart + InStartDir / 3.0f;
208 P2 = InEnd - InEndDir / 3.0f;
209 P3 = InEnd;
210 Thickness = InThickness;
211 }
212
214 {
215 P0 = InStart;
216 P1 = InStart + InStartDir / 3.0f;
217 P2 = InEnd - InEndDir / 3.0f;
218 P3 = InEnd;
219 Thickness = InThickness;
220 GradientStops = MoveTemp(InGradientStops);
221 }
222};
223
224
225struct UE_DEPRECATED(5.3, "Draw Element Payloads are no longer used, instead use the equivalent FSlateDrawElement subclass") FSlateLinePayload : public FSlateDataPayload, public FSlateTintableElement
226{
227 TArray<FVector2f> Points;
228 TArray<FLinearColor> PointColors;
229 float Thickness;
230
231 bool bAntialias;
232
233 bool IsAntialiased() const { return bAntialias; }
234 const TArray<FVector2f>& GetPoints() const { return Points; }
235 const TArray<FLinearColor>& GetPointColors() const { return PointColors; }
236 float GetThickness() const { return Thickness; }
237
238 void SetThickness(float InThickness)
239 {
240 Thickness = InThickness;
241 }
242
243#if UE_ENABLE_SLATE_VECTOR_DEPRECATION_MECHANISMS
244 void SetLines(const TArray<FVector2D>& InPoints, bool bInAntialias, const TArray<FLinearColor>* InPointColors = nullptr)
245 {
248 for (FVector2D Vect : InPoints)
249 {
251 }
252 if (InPointColors)
253 {
255 }
256 else
257 {
258 SetLines(MoveTemp(NewPoints), bInAntialias);
259 }
260 }
261#endif
262
263 void SetLines(TArray<FVector2f> InPoints, bool bInAntialias)
264 {
265 bAntialias = bInAntialias;
266 Points = MoveTemp(InPoints);
267 PointColors.Reset();
268 }
269
271 {
272 bAntialias = bInAntialias;
273 Points = MoveTemp(InPoints);
274 PointColors = MoveTemp(InPointColors);
275 }
276};
277
278struct UE_DEPRECATED(5.3, "Draw Element Payloads are no longer used, instead use the equivalent FSlateDrawElement subclass") FSlateViewportPayload : public FSlateDataPayload, public FSlateTintableElement
279{
280 FSlateShaderResource* RenderTargetResource;
281 uint8 bAllowViewportScaling : 1;
282 uint8 bViewportTextureAlphaOnly : 1;
283 uint8 bRequiresVSync : 1;
284
285 void SetViewport(const TSharedPtr<const ISlateViewport>& InViewport, const FLinearColor& InTint)
286 {
287 Tint = InTint;
288 RenderTargetResource = InViewport->GetViewportRenderTargetTexture();
289 bAllowViewportScaling = InViewport->AllowScaling();
290 bViewportTextureAlphaOnly = InViewport->IsViewportTextureAlphaOnly();
291 bRequiresVSync = InViewport->RequiresVsync();
292 }
293};
294
295struct UE_DEPRECATED(5.3, "Draw Element Payloads are no longer used, instead use the equivalent FSlateDrawElement subclass") FSlateCustomDrawerPayload : public FSlateDataPayload
296{
297 // Custom drawer data
299
301 {
303 }
304};
305
306struct UE_DEPRECATED(5.3, "Draw Element Payloads are no longer used, instead use the equivalent FSlateDrawElement subclass") FSlateLayerPayload : public FSlateDataPayload
307{
308 class FSlateDrawLayerHandle* LayerHandle;
309
311 {
312 LayerHandle = InLayerHandle;
313 checkSlow(LayerHandle);
314 }
315
316};
317
318struct UE_DEPRECATED(5.3, "Draw Element Payloads are no longer used, instead use the equivalent FSlateDrawElement subclass") FSlateCachedBufferPayload : public FSlateDataPayload
319{
320 // Cached render data
321 class FSlateRenderDataHandle* CachedRenderData;
322 FVector2f CachedRenderDataOffset;
323
324 // Cached Buffers
325 void SetCachedBuffer(FSlateRenderDataHandle* InRenderDataHandle, const UE::Slate::FDeprecateVector2DParameter Offset)
326 {
328
329 CachedRenderData = InRenderDataHandle;
330 CachedRenderDataOffset = Offset;
331 }
332};
333
334struct UE_DEPRECATED(5.3, "Draw Element Payloads are no longer used, instead use the equivalent FSlateDrawElement subclass") FSlateCustomVertsPayload : public FSlateDataPayload
335{
336 const FSlateShaderResourceProxy* ResourceProxy;
337
338 TArray<FSlateVertex> Vertices;
339 TArray<SlateIndex> Indices;
340
341 // Instancing support
343 uint32 InstanceOffset;
344 uint32 NumInstances;
345
347 {
348 ResourceProxy = InRenderProxy;
349
350 Vertices = MoveTemp(InVerts);
351 Indices = MoveTemp(InIndices);
352
354 InstanceOffset = InInstanceOffset;
355 NumInstances = InNumInstances;
356 }
357};
358
359struct UE_DEPRECATED(5.3, "Draw Element Payloads are no longer used, instead use the equivalent FSlateDrawElement subclass") FSlatePostProcessPayload : public FSlateDataPayload
360{
361 // Post Process Data
362 FVector4f PostProcessData;
363 FVector4f CornerRadius;
364 int32 DownsampleAmount;
365};
366
#define FORCENOINLINE
Definition AndroidPlatform.h:142
#define FORCEINLINE
Definition AndroidPlatform.h:140
#define checkSlow(expr)
Definition AssertionMacros.h:332
#define check(expr)
Definition AssertionMacros.h:314
#define ensureMsgf( InExpression, InFormat,...)
Definition AssertionMacros.h:465
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define PRAGMA_ENABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:12
#define PRAGMA_DISABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:8
EOrientation
Definition SlateEnums.h:261
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
uint32 Offset
Definition VulkanMemory.cpp:4033
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition UObjectGlobals.h:2492
Definition FontCache.h:334
Definition SlateResourceHandle.h:16
Definition SlateShaderResource.h:129
Definition SlateShaderResource.h:44
Definition DrawElements.h:220
Definition RenderingCommon.h:957
Definition Array.h:670
void Reset(SizeType NewSize=0)
Definition Array.h:2246
UE_FORCEINLINE_HINT void Reserve(SizeType Number)
Definition Array.h:3016
UE_FORCEINLINE_HINT ObjectType * Get() const
Definition SharedPointer.h:1065
UE_FORCEINLINE_HINT const bool IsValid() const
Definition SharedPointer.h:1085
Definition SharedPointer.h:1295
Chaos::FReal GetRadius(const Chaos::FCapsule &InCapsule)
Definition ChaosInterfaceWrapperCore.cpp:45
Type
Definition SlateBrush.h:21
Type
Definition SlateBrush.h:70
Type
Definition SlateBrush.h:47
const FVector2f & CastToVector2f(const FVector2f &InValue)
Definition SlateVector2.h:591
Definition Color.h:48
Definition Margin.h:17
Definition SlateBrush.h:239
Definition SlateFontInfo.h:147
Definition DrawElementTypes.h:415
Definition DrawElementTextOverflowArgs.h:19
FShapedGlyphSequencePtr OverflowTextPtr
Definition DrawElementTextOverflowArgs.h:44
ETextOverflowDirection OverflowDirection
Definition DrawElementTextOverflowArgs.h:45
Definition SlateVector2.h:485