UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
LandscapeUtils.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
6#include "CoreMinimal.h"
7#include "UObject/NameTypes.h"
10#include "Materials/Material.h"
12#include "RenderGraphEvent.h"
13#include "RenderGraphBuilder.h"
14
16class AActor;
17class ALandscapeProxy;
18class FRDGBuilder;
19class FRDGEventName;
20class ULandscapeComponent;
23class ULevel;
24class UTexture;
25class UTexture2D;
26class UWorld;
32
33namespace UE::Landscape
34{
35enum class EBuildFlags : uint8;
36
42
45
49
50// ----------------------------------------------------------------------------------
51
106{
107public:
115
118
119 enum class EState
120 {
121 Immediate, // In immediate mode, any command that is enqueued will be pushed to the render thread immediately (effectively acting like a ENQUEUE_RENDER_COMMAND)
122 Recording, // In recording mode, any command that is enqueued will be deferred to the render thread (effectively acting like a ENQUEUE_RENDER_COMMAND)
123 };
124
125 inline EState GetState() const { return State; }
126 inline bool IsRecording() const { return State == EState::Recording; }
127
132
137
143
148 LANDSCAPE_API void Flush(FRDGEventName&& EventName);
149
157
164
168 LANDSCAPE_API bool IsEmpty() const;
169
174 LANDSCAPE_API void Clear();
175
176private:
178
179 // List of callbacks to call on the render thread after the render command was initiated
181
182 // Map of textures and the RHI access they should have when leaving the FRDGBuilder :
183 TMap<FTextureResource*, ERHIAccess> RDGExternalTextureAccessFinal;
184
185#if RDG_EVENTS
186public:
191 class FScopedBreadcrumbEvent final
192 {
193 public:
194 FScopedBreadcrumbEvent(FRDGBuilderRecorder& InRecorder, TCHAR const* StaticName, FRDGEventName&& EventName)
195 : Recorder(&InRecorder)
197 {
198 // We use a shared ptr to create a TOptional<TRDGEventScopeGuard> immediately, then capture this shared ptr in these additional operations' lambdas (so that the object
199 // continues to live until the closing tag operation)
200 Recorder->EnqueueRDGCommand(
201 [
203 StaticName = StaticName,
204 EventName = MoveTemp(EventName)
205 ](FRDGBuilder& GraphBuilder) mutable
206 {
207 // Allocate the TOptional<TRDGEventScopeGuard> now in order to insert the tag :
208 RDG_EVENT_SCOPE_CONSTRUCT(*RDGEvent, GraphBuilder, true, ERDGScopeFlags::None, RHI_GPU_STAT_ARGS_NONE, StaticName, MoveTemp(EventName));
209 });
210 }
211
213 {
214 Recorder->EnqueueRDGCommand([RDGEvent = RDGEvent](FRDGBuilder& GraphBuilder)
215 {
216 // Reset the TOptional in order to delete the TRDGEventScopeGuard, which will remove the tag :
217 RDGEvent->Reset();
218 });
219 }
220
221 private:
222 FRDGBuilderRecorder* Recorder = nullptr;
224 };
225#endif // RDG_EVENTS
226};
227
228#if RDG_EVENTS
229#define RDG_RENDER_COMMAND_RECORDER_BREADCRUMB_EVENT(Recorder, Format, ...) FRDGBuilderRecorder::FScopedBreadcrumbEvent ANONYMOUS_VARIABLE(BreadcrumbEvent)(Recorder, TEXT(Format), RDG_EVENT_NAME(Format, ##__VA_ARGS__))
230#else // RDG_EVENTS
231#define RDG_RENDER_COMMAND_RECORDER_BREADCRUMB_EVENT(Recorder, Format, ...) do { } while(0)
232#endif // !RDG_EVENTS
233
234
235#if WITH_EDITOR
236
237// ----------------------------------------------------------------------------------
238
240{
241 UTexture2D* Source = nullptr;
242 UTexture* Destination = nullptr;
246};
247
250
255{
258 {}
259
260 int8& operator[](int32 Index) { return Mappings[Index]; }
261 const int8 operator[](int32 Index) const { return Mappings[Index]; }
262
263 int8 Mappings[4];
264};
265
267{
268public:
279
282
283private:
285
287};
288
294LANDSCAPE_API FString GetSharedAssetsPath(const FString& InPath);
295
302
310
318UE_DEPRECATED(5.6, "This Get function is deprecated. Please use new GetLayerInfo and pass in a full asset package path.")
320
328
337
339LANDSCAPE_API bool IsVisibilityLayer(const ULandscapeLayerInfoObject* InLayerInfoObject);
340
341struct UE_DEPRECATED(5.6, "This helper struct is deprecated. Please use utility methods in LandscapeEditorUtils.") FLayerInfoFinder
342{
345 LANDSCAPE_API ULandscapeLayerInfoObject* Find(const FName& LayerName) const;
347};
348
355
356
359
362
372
373#endif // WITH_EDITOR
374
377
378} // end namespace UE::Landscape
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
@ INDEX_NONE
Definition CoreMiscDefines.h:150
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
FPlatformTypes::int8 int8
An 8-bit signed integer.
Definition Platform.h:1121
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
TSharedRef< InObjectType, InMode > MakeShared(InArgTypes &&... Args)
Definition SharedPointer.h:2009
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
ELandscapeToolTargetTypeFlags
Definition LandscapeEditTypes.h:22
ELandscapeToolTargetType
Definition LandscapeEditTypes.h:12
ELandscapeTextureType
Definition LandscapeTextureHash.h:13
ELandscapeTextureUsage
Definition LandscapeTextureHash.h:21
ERHIAccess
Definition RHIAccess.h:11
EShaderPlatform
Definition RHIShaderPlatform.h:11
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
uint8_t uint8
Definition binka_ue_file_header.h:8
uint16_t uint16
Definition binka_ue_file_header.h:7
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Actor.h:257
Definition MaterialShared.h:3326
Definition NameTypes.h:617
Definition RenderGraphBuilder.h:49
Definition RenderGraphEvent.h:38
Definition RHICommandList.h:4626
Definition TextureResource.h:103
Definition ArrayView.h:139
Definition Array.h:670
Definition AndroidPlatformMisc.h:14
Definition UnrealString.h.inl:34
Definition RenderGraphEvent.h:329
Definition SharedPointer.h:692
Definition LandscapeUtils.h:106
LANDSCAPE_API bool IsEmpty() const
Definition LandscapeUtils.cpp:205
LANDSCAPE_API void StopRecording()
Definition LandscapeUtils.cpp:108
LANDSCAPE_API void EnqueueRenderCommand(FRDGRecorderRenderCommand InRenderCommand)
Definition LandscapeUtils.cpp:189
LANDSCAPE_API void EnqueueRDGCommand(FRDGRecorderRDGCommand InRDGCommand, TConstArrayView< FRDGExternalTextureAccessFinal > InRDGExternalTextureAccessFinalList={})
Definition LandscapeUtils.cpp:158
TFunction< void(FRDGBuilder &)> FRDGRecorderRDGCommand
Definition LandscapeUtils.h:108
LANDSCAPE_API ~FRDGBuilderRecorder()
Definition LandscapeUtils.cpp:94
LANDSCAPE_API void StopRecordingAndFlush(FRDGEventName &&EventName)
Definition LandscapeUtils.cpp:116
bool IsRecording() const
Definition LandscapeUtils.h:126
TFunction< void(FRHICommandListImmediate &)> FRDGRecorderRenderCommand
Definition LandscapeUtils.h:109
LANDSCAPE_API void Clear()
Definition LandscapeUtils.cpp:210
EState GetState() const
Definition LandscapeUtils.h:125
EState
Definition LandscapeUtils.h:120
LANDSCAPE_API void StartRecording()
Definition LandscapeUtils.cpp:100
Definition LandscapeLayerInfoObject.h:60
Definition LandscapeMaterialInstanceConstant.h:28
Definition Level.h:423
Definition MaterialInstance.h:627
Definition MaterialInterface.h:296
Definition Texture2D.h:26
Definition Texture.h:1219
Definition World.h:918
Definition Landscape.h:55
bool LandscapeProxySortPredicate(const TWeakObjectPtr< ALandscapeProxy > APtr, const TWeakObjectPtr< ALandscapeProxy > BPtr)
Definition LandscapeUtils.cpp:594
EBuildFlags
Definition LandscapeEditTypes.h:70
ELandscapeToolTargetTypeFlags GetLandscapeToolTargetTypeAsFlags(ELandscapeToolTargetType InTargetType)
Definition LandscapeUtils.cpp:66
ELandscapeToolTargetType GetLandscapeToolTargetTypeSingleFlagAsType(ELandscapeToolTargetTypeFlags InSingleFlag)
Definition LandscapeUtils.cpp:73
FString GetLandscapeToolTargetTypeFlagsAsString(ELandscapeToolTargetTypeFlags InTargetTypeFlags)
Definition LandscapeUtils.cpp:81
void ModifyShaderCompilerEnvironmentForDebug(FShaderCompilerEnvironment &OutEnvironment)
Definition LandscapeUtils.cpp:56
bool DoesPlatformSupportEditLayers(EShaderPlatform InShaderPlatform)
Definition LandscapeUtils.cpp:48
uint32 GetTypeHash(const FPropertyPathName &Path)
Definition PropertyPathName.cpp:133
bool operator==(const FPropertyTypeName &Lhs, const FPropertyTypeName &Rhs)
Definition PropertyTypeName.cpp:329
U16 Index
Definition radfft.cpp:71
Definition ShaderCore.h:544
Definition Optional.h:131
Definition WeakObjectPtrTemplates.h:25
FTextureResource * TextureResource
Definition LandscapeUtils.h:112