landscape.BrushFramePadding

landscape.BrushFramePadding

#Overview

name: landscape.BrushFramePadding

This variable is created as a Console Variable (cvar).

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of landscape.BrushFramePadding is to control the delay between when a Landscape brush requests an update and when a full Landscape update is pushed. It defines the number of frames to wait before applying the update.

This setting variable is primarily used in the Landscape system of Unreal Engine 5. Based on the callsites, it’s specifically utilized in the LandscapeBlueprintBrushBase class, which is part of the Landscape module.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 5 frames, but can be changed at runtime through console commands or configuration files.

The associated variable CVarLandscapeBrushPadding directly interacts with landscape.BrushFramePadding. It’s an instance of TAutoConsoleVariable<int32> that wraps the console variable, providing a programmatic interface to access and modify its value.

Developers should be aware that this variable affects the responsiveness and performance of Landscape updates. A lower value will result in more frequent updates, potentially impacting performance, while a higher value may introduce noticeable delay in brush effects.

Best practices when using this variable include:

  1. Adjusting it based on the specific needs of the project, balancing between responsiveness and performance.
  2. Testing different values to find the optimal setting for the target hardware.
  3. Considering exposing it as a user-configurable setting for different quality presets.

Regarding the associated variable CVarLandscapeBrushPadding:

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeBlueprintBrushBase.cpp:21

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarLandscapeBrushPadding(
	TEXT("landscape.BrushFramePadding"),
	5,
	TEXT("The number of frames to wait before pushing a full Landscape update when a brush is calling RequestLandscapeUpdate"));
#endif

ALandscapeBlueprintBrushBase::ALandscapeBlueprintBrushBase(const FObjectInitializer& ObjectInitializer)
#if WITH_EDITORONLY_DATA

#Associated Variable and Callsites

This variable is associated with another variable named CVarLandscapeBrushPadding. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeBlueprintBrushBase.cpp:20

Scope: file

Source code excerpt:

static const uint32 InvalidLastRequestLayersContentUpdateFrameNumber = 0;

static TAutoConsoleVariable<int32> CVarLandscapeBrushPadding(
	TEXT("landscape.BrushFramePadding"),
	5,
	TEXT("The number of frames to wait before pushing a full Landscape update when a brush is calling RequestLandscapeUpdate"));
#endif

ALandscapeBlueprintBrushBase::ALandscapeBlueprintBrushBase(const FObjectInitializer& ObjectInitializer)

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeBlueprintBrushBase.cpp:113

Scope (from outer to inner):

file
function     void ALandscapeBlueprintBrushBase::PushDeferredLayersContentUpdate

Source code excerpt:

	if (OwningLandscape != nullptr &&
		LastRequestLayersContentUpdateFrameNumber != InvalidLastRequestLayersContentUpdateFrameNumber &&
		LastRequestLayersContentUpdateFrameNumber + CVarLandscapeBrushPadding.GetValueOnAnyThread() <= GFrameNumber)
	{
		uint32 ModeMask = 0;
		if (AffectsHeightmap())
		{
			ModeMask |= ELandscapeLayerUpdateMode::Update_Heightmap_All;
		}

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeBlueprintBrushBase.cpp:152

Scope (from outer to inner):

file
function     bool ALandscapeBlueprintBrushBase::IsLayerUpdatePending

Source code excerpt:

bool ALandscapeBlueprintBrushBase::IsLayerUpdatePending() const
{
	return GFrameNumber < LastRequestLayersContentUpdateFrameNumber + CVarLandscapeBrushPadding.GetValueOnAnyThread();
}

void ALandscapeBlueprintBrushBase::SetIsVisible(bool bInIsVisible)
{
#if WITH_EDITORONLY_DATA
	Modify();