UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
LandscapeEditLayer.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Landscape.h"
8#include "Math/Interval.h"
9
10#include "LandscapeEditLayer.generated.h"
11
13
36
41UCLASS(MinimalAPI, Abstract)
43#if CPP && WITH_EDITOR
44 , public UE::Landscape::EditLayers::IEditLayerRendererProvider
45#endif // CPP && WITH_EDITOR
46{
48
49public:
50 class UE_DEPRECATED(5.7, "Expose custom actions to the editor with IEditLayerCustomization and RegisterCustomEditLayerClassLayout") FEditLayerAction
51 {
52 FEditLayerAction() = delete;
53
54 public:
55 class UE_DEPRECATED(5.7, "Expose custom actions to the editor with IEditLayerCustomization and RegisterCustomEditLayerClassLayout") FExecuteParams
56 {
57 FExecuteParams() = delete;
58
59 public:
61 : EditLayer(InEditLayer)
63 {
64 check((InEditLayer != nullptr) && (InLandscape != nullptr));
65 }
66
67 UE_DEPRECATED(5.6, "This FLandscapeLayer constructor is deprecated. Use ULandscapeEditLayerBase constructor.")
69 : Layer(InLayer)
71 {
72 check((InLayer != nullptr) && (InLandscape != nullptr));
73 }
74
75 UE_DEPRECATED(5.6, "Deprecated in preference of ULandscapeEditLayerBase*, use GetEditLayer instead. ")
76 inline const FLandscapeLayer* GetLayer() const { return Layer; }
77 inline const ULandscapeEditLayerBase* GetEditLayer() const { return EditLayer; }
78 inline ALandscape* GetLandscape() const { return Landscape; }
79
80 private:
81 const ULandscapeEditLayerBase* EditLayer = nullptr;
82 const FLandscapeLayer* Layer = nullptr;
83 ALandscape* Landscape = nullptr;
84 };
85
86 struct UE_DEPRECATED(5.7, "Expose custom actions to the editor with IEditLayerCustomization and RegisterCustomEditLayerClassLayout") FExecuteResult
87 {
88 FExecuteResult() = default;
91 , Reason(InReason)
92 {}
93
94 bool bSuccess = true;
95 FText Reason;
96 };
97
99 DECLARE_DELEGATE_RetVal_TwoParams(bool, FCanExecuteDelegate, const FExecuteParams& /*InParams*/, FText& /*OutReason*/);
100
102 : Label(InLabel)
103 , ExecuteDelegate(InExecuteDelegate)
105 {}
106
107 inline const FText& GetLabel() const { return Label; }
108 inline const FExecuteDelegate& GetExecuteDelegate() const { return ExecuteDelegate; }
109 inline const FCanExecuteDelegate& GetCanExecuteDelegate() const { return CanExecuteDelegate; }
110
111 private:
112 FText Label;
113 FExecuteDelegate ExecuteDelegate;
115 };
116
117public:
124
128 virtual bool NeedsPersistentTextures() const
129 PURE_VIRTUAL(ULandscapeEditLayerBase::NeedsPersistentTextures, return false; );
130
134 virtual bool SupportsEditingTools() const
135 PURE_VIRTUAL(ULandscapeEditLayerBase::SupportsEditingTools, return true; );
136
140 virtual bool SupportsMultiple() const
141 PURE_VIRTUAL(ULandscapeEditLayerBase::SupportsMultiple, return true; );
142
146 virtual bool SupportsBeingCollapsedAway() const
147 PURE_VIRTUAL(ULandscapeEditLayerBase::SupportsBeingCollapsedAway, return true; );
148
152 virtual bool SupportsCollapsingTo() const
153 PURE_VIRTUAL(ULandscapeEditLayerBase::SupportsCollapsingTo, return true; );
154
158 virtual bool SupportsBlueprintBrushes() const
159 PURE_VIRTUAL(ULandscapeEditLayerBase::SupportsBlueprintBrushes(), return false; );
160
164 virtual FString GetDefaultName() const
165 PURE_VIRTUAL(ULandscapeEditLayerBase::GetDefaultName, return FString(); );
166
167#if WITH_EDITOR
173
182
189
194
200 LANDSCAPE_API virtual void SetGuid(const FGuid& InGuid, bool bInModify);
201
202 LANDSCAPE_API virtual const FGuid& GetGuid() const;
203
209 LANDSCAPE_API virtual void SetName(FName InName, bool bInModify);
210
211 LANDSCAPE_API virtual FName GetName() const;
212
218 LANDSCAPE_API virtual void SetVisible(bool bInVisible, bool bInModify);
219
220 LANDSCAPE_API virtual bool IsVisible() const;
221
227 LANDSCAPE_API virtual void SetLocked(bool bInLocked, bool bInModify);
228
229 LANDSCAPE_API virtual bool IsLocked() const;
230
235 UE_INTERNAL LANDSCAPE_API virtual ELandscapeBlendMode GetBlendMode() const;
236
245
254
260
268
269#endif // WITH_EDITOR
270
271 UE_DEPRECATED(5.7, "Register custom context menu actions using RegisterCustomEditLayerClassLayout from ILandscapeEditorModule")
273 virtual TArray<FEditLayerAction> GetActions() const
275 {
276 return {};
277 }
278
284 virtual void GetRenderDependencies(TSet<UObject*>& OutDependencies) const
285 {}
286
287 // Called by landscape after removing this layer from its list so that the layer can do
288 // any cleanup that it might need to do.
289 // TODO: Should this be protected and then we friend ALandscape?
290 virtual void OnLayerRemoved()
291 {}
292
293#if WITH_EDITOR
294 //~ Begin IEditLayerRendererProvider implementation
295 // By default this does nothing in a landscape edit layer, but subclasses can override it if
296 // they would like to provide additional renderers.
297 virtual TArray<UE::Landscape::EditLayers::FEditLayerRendererState> GetEditLayerRendererStates(const UE::Landscape::EditLayers::FMergeContext* InMergeContext) { return {}; };
298 //~ End IEditLayerRendererProvider implementation
299
300
303 FOnLayerDataChanged::RegistrationType& OnLayerDataChanged() const
304 {
306 }
307
312#endif // WITH_EDITOR
313
314protected:
315#if WITH_EDITOR
316 // Begin UObject implementation
317 LANDSCAPE_API virtual void PostLoad() override;
318 LANDSCAPE_API virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
319 LANDSCAPE_API virtual void PostEditUndo() override;
320 LANDSCAPE_API virtual bool CanEditChange(const FProperty* InProperty) const override;
321 // End UObject implementation
322#endif // WITH_EDITOR
323
324#if WITH_EDITORONLY_DATA
325 // Setters for UPROPERTY (should be used for blueprint setters eventually) :
326 void SetGuidInternal(const FGuid& InGuid);
327 void SetNameInternal(FName InName);
329 void SetLockedInternal(bool bInLocked);
332 // Marked as UE_INTERNAL to prevent external usage before blend refactor with the introduction of blend groups and premultiplied alpha blending
334#endif // WITH_EDITORONLY_DATA
335
336#if WITH_EDITOR
343#endif // WITH_EDITOR
344protected:
345#if WITH_EDITORONLY_DATA
346 UPROPERTY(Setter = "SetGuidInternal", meta = (EditCondition = "!bLocked"))
347 FGuid Guid = FGuid::NewGuid();
348
349 UPROPERTY(Setter = "SetNameInternal", meta = (EditCondition = "!bLocked"))
350 FName LayerName = NAME_None;
351
352 UPROPERTY(Category = "Edit Layer", EditAnywhere, Setter = "SetVisibleInternal", meta = (EditCondition = "!bLocked"))
353 bool bVisible = true;
354
355 UPROPERTY(Category = "Edit Layer", EditAnywhere, Setter = "SetLockedInternal")
356 bool bLocked = false;
357
358 UPROPERTY(Category = "Edit Layer", EditAnywhere, Setter = "SetHeightmapAlphaInternal", meta = (UIMin = "-1.0", UIMax = "1.0", ClampMin = "-1.0", ClampMax = "1.0", EditCondition = "!bLocked"))
359 float HeightmapAlpha = 1.0f;
360
361 UPROPERTY(Category = "Edit Layer", EditAnywhere, Setter = "SetWeightmapAlphaInternal", meta = (UIMin = "0.0", UIMax = "1.0", ClampMin = "0.0", ClampMax = "1.0", EditCondition = "!bLocked"))
362 float WeightmapAlpha = 1.0f;
363
364 // TODO: This might be removed once more things are moved from FLandscapeLayer to ULandscapeLayer
365 UPROPERTY()
367
368private:
369 // TODO: This might be removed once the guid is stored here and subclasses have a way to request landscape updates.
370 friend class ALandscape;
372
374
375 UPROPERTY(Setter = "SetWeightmapLayerAllocationBlendInternal", meta = (EditCondition = "!bLocked"))
376 TMap<TObjectPtr<ULandscapeLayerInfoObject>, bool> WeightmapLayerAllocationBlend; // True -> Substractive, False -> Add
377#endif //WITH_EDITORONLY_DATA
378};
379
383UCLASS(MinimalAPI, Abstract)
386{
388
389public:
390 // Begin ULandscapeEditLayerBase implementation
391 virtual bool NeedsPersistentTextures() const override { return true; };
392 virtual bool SupportsCollapsingTo() const override { return true; } // If the layer has persistent textures, it can be collapsed to another layer (one that supports being collapsed away, that is)
393 virtual bool SupportsBlueprintBrushes() const override { return false; }
394 // End ULandscapeEditLayerBase implementation
395
396#if WITH_EDITOR
397 //~ Begin ILandscapeEditLayerRenderer implementation
398 LANDSCAPE_API virtual void GetRendererStateInfo(const UE::Landscape::EditLayers::FMergeContext* InMergeContext,
399 UE::Landscape::EditLayers::FEditLayerTargetTypeState& OutSupportedTargetTypeState, UE::Landscape::EditLayers::FEditLayerTargetTypeState& OutEnabledTargetTypeState, TArray<UE::Landscape::EditLayers::FTargetLayerGroup>& OutTargetLayerGroups) const override;
400 virtual UE::Landscape::EditLayers::ERenderFlags GetRenderFlags(const UE::Landscape::EditLayers::FMergeContext* InMergeContext) const override;
401 LANDSCAPE_API virtual TArray<UE::Landscape::EditLayers::FEditLayerRenderItem> GetRenderItems(const UE::Landscape::EditLayers::FMergeContext* InMergeContext) const override;
402 LANDSCAPE_API virtual bool RenderLayer(UE::Landscape::EditLayers::FRenderParams& RenderParams, UE::Landscape::FRDGBuilderRecorder& RDGBuilderRecorder) override;
403 LANDSCAPE_API virtual void BlendLayer(UE::Landscape::EditLayers::FRenderParams& RenderParams, UE::Landscape::FRDGBuilderRecorder& RDGBuilderRecorder) override;
404 LANDSCAPE_API virtual FString GetEditLayerRendererDebugName() const override;
405 //~ End ILandscapeEditLayerRenderer implementation
406#endif // WITH_EDITOR
407};
408
412UCLASS(MinimalAPI, meta = (ShortToolTip = "Standard edit layer"))
414{
416
417public:
418 // Begin ULandscapeEditLayerBase implementation
419 virtual bool SupportsTargetType(ELandscapeToolTargetType InType) const override;
420 virtual bool SupportsEditingTools() const override { return true; }
421 virtual bool SupportsMultiple() const override { return true; }
422 virtual bool SupportsBeingCollapsedAway() const override { return true; }
423 virtual bool SupportsBlueprintBrushes() const override { return true; }
424 virtual FString GetDefaultName() const { return TEXT("Layer"); }
425 // End ULandscapeEditLayerBase implementation
426
427protected:
428
429};
430
434UCLASS(MinimalAPI, Abstract)
436{
438
439public:
440 // Begin ULandscapeEditLayerBase implementation
441 virtual bool SupportsEditingTools() const override { return false; } // procedural layers cannot be edited through standard editing tools
442 virtual bool SupportsCollapsingTo() const override { return false; } // for now, don't support collapsing to a layer underneath for a procedural layer (this may become unneeded if we make the collapse happen on the GPU)
443 virtual bool SupportsBeingCollapsedAway() const override { return false; } // this is a procedural and therefore cannot be collapsed
444 virtual bool SupportsBlueprintBrushes() const override { return false; }
445 // End ULandscapeEditLayerBase implementation
446};
447
451UCLASS(MinimalAPI, meta = (ShortToolTip = "Special edit layer for landscape splines"))
453{
455
456public:
457 // Begin ULandscapeEditLayerBase implementation
458 virtual bool SupportsEditingTools() const override { return false; } // procedural layers cannot be edited through standard editing tools
459 virtual bool SupportsTargetType(ELandscapeToolTargetType InType) const override;
460 virtual bool NeedsPersistentTextures() const override { return true; }; // it's a layer computed on the CPU and outputting to persistent textures
461 virtual bool SupportsMultiple() const override { return false; } // only one layer of this type is allowed
462 virtual bool SupportsBeingCollapsedAway() const override { return false; } // this is a procedural and therefore cannot be collapsed
463 virtual FString GetDefaultName() const override { return TEXT("Splines"); }
464#if WITH_EDITOR
465 virtual ELandscapeBlendMode GetBlendMode() const override { return ELandscapeBlendMode::LSBM_AlphaBlend; };
466 bool SupportsAlphaForTargetType(ELandscapeToolTargetType InType) const override { return false; };
467 virtual float GetAlphaForTargetType(ELandscapeToolTargetType InType) const override { return 1.0f; };
469 // End ULandscapeEditLayerBase implementation
470#endif // WITH_EDITOR
471protected:
472
473};
#define check(expr)
Definition AssertionMacros.h:314
bool bSuccess
Definition ConvexDecomposition3.cpp:819
#define PURE_VIRTUAL(func,...)
Definition CoreMiscDefines.h:103
#define UE_INTERNAL
Definition CoreMiscDefines.h:345
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
#define TEXT(x)
Definition Platform.h:1272
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_DELEGATE_RetVal_OneParam(ReturnValueType, DelegateName, Param1Type)
Definition DelegateCombinations.h:54
#define DECLARE_DELEGATE_RetVal_TwoParams(ReturnValueType, DelegateName, Param1Type, Param2Type)
Definition DelegateCombinations.h:63
#define DECLARE_MULTICAST_DELEGATE_OneParam(DelegateName, Param1Type)
Definition DelegateCombinations.h:49
return true
Definition ExternalRpcRegistry.cpp:601
#define PRAGMA_ENABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:12
#define PRAGMA_DISABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:8
ELandscapeToolTargetTypeFlags
Definition LandscapeEditTypes.h:22
ELandscapeToolTargetType
Definition LandscapeEditTypes.h:12
ELandscapeBlendMode
Definition Landscape.h:158
@ LSBM_AlphaBlend
Definition Landscape.h:160
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UCLASS(...)
Definition ObjectMacros.h:776
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition NameTypes.h:617
Definition UnrealType.h:174
Definition Text.h:385
Definition LandscapeEditLayerRenderer.h:260
Definition Landscape.Build.cs:7
Definition Array.h:670
Definition UnrealString.h.inl:34
Definition LandscapeUtils.h:106
Definition LandscapeEditLayer.h:46
virtual bool SupportsTargetType(ELandscapeToolTargetType InType) const PURE_VIRTUAL(ULandscapeEditLayerBase
Definition LandscapeEditLayer.h:122
virtual void OnLayerRemoved()
Definition LandscapeEditLayer.h:290
virtual void GetRenderDependencies(TSet< UObject * > &OutDependencies) const
Definition LandscapeEditLayer.h:284
virtual bool NeedsPersistentTextures() const PURE_VIRTUAL(ULandscapeEditLayerBase
Definition LandscapeEditLayer.h:128
Definition LandscapeEditLayer.h:386
virtual bool NeedsPersistentTextures() const override
Definition LandscapeEditLayer.h:391
virtual bool SupportsBlueprintBrushes() const override
Definition LandscapeEditLayer.h:393
virtual bool SupportsCollapsingTo() const override
Definition LandscapeEditLayer.h:392
Definition LandscapeEditLayer.h:436
virtual bool SupportsEditingTools() const override
Definition LandscapeEditLayer.h:441
virtual bool SupportsBeingCollapsedAway() const override
Definition LandscapeEditLayer.h:443
virtual bool SupportsCollapsingTo() const override
Definition LandscapeEditLayer.h:442
virtual bool SupportsBlueprintBrushes() const override
Definition LandscapeEditLayer.h:444
Definition LandscapeEditLayer.h:453
virtual bool SupportsEditingTools() const override
Definition LandscapeEditLayer.h:458
virtual FString GetDefaultName() const override
Definition LandscapeEditLayer.h:463
virtual bool NeedsPersistentTextures() const override
Definition LandscapeEditLayer.h:460
virtual bool SupportsBeingCollapsedAway() const override
Definition LandscapeEditLayer.h:462
virtual bool SupportsMultiple() const override
Definition LandscapeEditLayer.h:461
Definition LandscapeEditLayer.h:414
virtual bool SupportsBlueprintBrushes() const override
Definition LandscapeEditLayer.h:423
virtual bool SupportsMultiple() const override
Definition LandscapeEditLayer.h:421
virtual bool SupportsBeingCollapsedAway() const override
Definition LandscapeEditLayer.h:422
virtual bool SupportsEditingTools() const override
Definition LandscapeEditLayer.h:420
virtual FString GetDefaultName() const
Definition LandscapeEditLayer.h:424
Definition LandscapeLayerInfoObject.h:60
Definition Object.h:95
uint32 Type
Definition UnrealType.h:6835
@ false
Definition radaudio_common.h:23
Definition Guid.h:109
Definition Landscape.h:169
Definition LandscapeEditLayer.h:15
FPropertyChangedEvent PropertyChangedEvent
Definition LandscapeEditLayer.h:21
bool bUserTriggered
Definition LandscapeEditLayer.h:24
FOnLandscapeEditLayerDataChangedParams(const FPropertyChangedEvent &InPropertyChangedEvent=FPropertyChangedEvent(nullptr))
Definition LandscapeEditLayer.h:16
bool bRequiresLandscapeUpdate
Definition LandscapeEditLayer.h:27
bool bHasValueChanged
Definition LandscapeEditLayer.h:34
Definition UnrealType.h:6865
Definition ObjectPtr.h:488
Definition WeakObjectPtrTemplates.h:25