landscape.SplineFalloffModulation

landscape.SplineFalloffModulation

#Overview

name: landscape.SplineFalloffModulation

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

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of landscape.SplineFalloffModulation is to enable texture modulation for spline layer falloff in Unreal Engine’s landscape system. This setting variable is primarily used in the landscape rendering and editing subsystems.

The Unreal Engine subsystems that rely on this setting variable are the Landscape module and the LandscapeEditor module. This can be seen from the file locations where the variable is referenced, such as LandscapeSplineRaster.cpp and LandscapeEdMode.cpp.

The value of this variable is set as a console variable using TAutoConsoleVariable. It is initialized with a default value of 1, indicating that spline falloff modulation is enabled by default.

The associated variable CVarLandscapeSplineFalloffModulation interacts directly with landscape.SplineFalloffModulation. They share the same value and are used interchangeably in the code.

Developers must be aware that changing this variable’s value will trigger a spline layer update for the current landscape. This is evident from the code in LandscapeEdMode.cpp, where a change in the variable’s value calls the RequestSplineLayerUpdate() function on the current landscape.

Best practices when using this variable include:

  1. Be cautious when modifying its value, as it can impact performance due to landscape updates.
  2. Consider the visual impact on landscape splines when enabling or disabling this feature.
  3. Use it in conjunction with ULandscapeLayerInfoObject and its SplineFalloffModulationTexture for more advanced control over spline falloff appearance.

Regarding the associated variable CVarLandscapeSplineFalloffModulation:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeSplineRaster.cpp:31

Scope: file

Source code excerpt:

#if WITH_EDITOR
TAutoConsoleVariable<int32> CVarLandscapeSplineFalloffModulation(
	TEXT("landscape.SplineFalloffModulation"),
	1,
	TEXT("Enable Texture Modulation fo Spline Layer Falloff."));

using FModulateAlphaFunc = TFunction<float(float InValue, int32 X, int32 Y)>;

class FLandscapeSplineHeightsRasterPolicy

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdMode.cpp:846

Scope (from outer to inner):

file
function     void FEdModeLandscape::Tick

Source code excerpt:

	}

	static int32 LastLandscapeSplineFalloffModulationValue = CVarLandscapeSplineFalloffModulation.GetValueOnAnyThread();
	if (LastLandscapeSplineFalloffModulationValue != CVarLandscapeSplineFalloffModulation.GetValueOnAnyThread())
	{
		if (ALandscape* Landscape = GetLandscape())
		{
			Landscape->RequestSplineLayerUpdate();
		}
		LastLandscapeSplineFalloffModulationValue = CVarLandscapeSplineFalloffModulation.GetValueOnAnyThread();
	}
}


/** FEdMode: Called when the mouse is moved over the viewport */
bool FEdModeLandscape::MouseMove(FEditorViewportClient* InViewportClient, FViewport* InViewport, int32 MouseX, int32 MouseY)

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Classes/Landscape.h:37

Scope: file

Source code excerpt:


#if WITH_EDITOR
extern LANDSCAPE_API TAutoConsoleVariable<int32> CVarLandscapeSplineFalloffModulation;
#endif

UENUM()
enum UE_DEPRECATED(5.3, "ELandscapeSetupErrors is now unused and deprecated") ELandscapeSetupErrors : int
{
	LSE_None,

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeSplineRaster.cpp:30

Scope: file

Source code excerpt:


#if WITH_EDITOR
TAutoConsoleVariable<int32> CVarLandscapeSplineFalloffModulation(
	TEXT("landscape.SplineFalloffModulation"),
	1,
	TEXT("Enable Texture Modulation fo Spline Layer Falloff."));

using FModulateAlphaFunc = TFunction<float(float InValue, int32 X, int32 Y)>;

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeSplineRaster.cpp:127

Scope (from outer to inner):

file
class        class FModulateAlpha
function     static TSharedPtr<FModulateAlpha> CreateFromLayerInfo

Source code excerpt:

	static TSharedPtr<FModulateAlpha> CreateFromLayerInfo(ULandscapeLayerInfoObject* InLayerInfo, int32 InLandscapeMinX, int32 InLandscapeMinY)
	{
		if (CVarLandscapeSplineFalloffModulation.GetValueOnAnyThread() == 0 
			|| (InLayerInfo == nullptr) 
			|| (InLayerInfo->SplineFalloffModulationTexture == nullptr))
		{
			return nullptr;
		}