landscape.OutputLayersWeightmapsRTContent

landscape.OutputLayersWeightmapsRTContent

#Overview

name: landscape.OutputLayersWeightmapsRTContent

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.OutputLayersWeightmapsRTContent is to enable debugging output for the content of render targets used for weightmaps in the Unreal Engine 5 landscape system.

This setting variable is primarily used by the Landscape module within Unreal Engine 5. Based on the callsites, it’s specifically utilized in the LandscapeEditLayers.cpp file, which suggests it’s related to the landscape editing and layer system.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 0, which means the debug output is disabled by default. Users can change this value at runtime through the console or configuration files.

The variable interacts closely with another console variable, CVarOutputLayersRTContent. In the provided code snippets, these two variables are often checked together to determine if debug output should be displayed.

Developers must be aware that this variable is intended for debugging purposes only. Enabling it may have performance implications, so it should not be left enabled in production builds.

Best practices when using this variable include:

  1. Only enable it when actively debugging landscape weightmap issues.
  2. Remember to disable it after debugging to avoid unnecessary performance overhead.
  3. Use it in conjunction with other landscape debugging tools for a comprehensive view of the landscape system’s state.

Regarding the associated variable CVarOutputLayersWeightmapsRTContent:

The purpose of CVarOutputLayersWeightmapsRTContent is identical to landscape.OutputLayersWeightmapsRTContent. It’s an internal representation of the console variable within the C++ code.

This variable is used directly in the Landscape module’s code to control the debug output. It’s checked in several methods related to debug printing, such as PrintLayersDebugWeightData, PrintLayersDebugRT, and PrintLayersDebugTextureResource.

The value of CVarOutputLayersWeightmapsRTContent is set through the console variable system and can be accessed in code using the GetValueOnAnyThread() method.

Like landscape.OutputLayersWeightmapsRTContent, developers should be aware that this variable is for debugging only and should be used cautiously due to potential performance impacts.

Best practices for CVarOutputLayersWeightmapsRTContent are the same as for landscape.OutputLayersWeightmapsRTContent, as they represent the same setting from different perspectives (console input vs. C++ code).

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeEditLayers.cpp:111

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarOutputLayersWeightmapsRTContent(
	TEXT("landscape.OutputLayersWeightmapsRTContent"),
	0,
	TEXT("This will output the content of render target used for weightmap. This is used for debugging only."));

static TAutoConsoleVariable<int32> CVarLandscapeSimulatePhysics(
	TEXT("landscape.SimulatePhysics"),
	0,

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeEditLayers.cpp:110

Scope: file

Source code excerpt:

	TEXT("This will output the content of render target. This is used for debugging only."));

static TAutoConsoleVariable<int32> CVarOutputLayersWeightmapsRTContent(
	TEXT("landscape.OutputLayersWeightmapsRTContent"),
	0,
	TEXT("This will output the content of render target used for weightmap. This is used for debugging only."));

static TAutoConsoleVariable<int32> CVarLandscapeSimulatePhysics(
	TEXT("landscape.SimulatePhysics"),

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeEditLayers.cpp:3315

Scope (from outer to inner):

file
function     void ALandscape::PrintLayersDebugWeightData

Source code excerpt:

void ALandscape::PrintLayersDebugWeightData(const FString& InContext, const TArray<FColor>& InWeightmapData, const FIntPoint& InDataSize, uint8 InMipRender) const
{
	bool DisplayDebugPrint = (CVarOutputLayersRTContent.GetValueOnAnyThread() == 1 || CVarOutputLayersWeightmapsRTContent.GetValueOnAnyThread() == 1) ? true : false;

	if (!DisplayDebugPrint)
	{
		return;
	}

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeEditLayers.cpp:3353

Scope (from outer to inner):

file
function     void ALandscape::PrintLayersDebugRT

Source code excerpt:

void ALandscape::PrintLayersDebugRT(const FString& InContext, UTextureRenderTarget2D* InDebugRT, uint8 InMipRender, bool InOutputHeight, bool InOutputNormals) const
{
	bool DisplayDebugPrint = (CVarOutputLayersRTContent.GetValueOnAnyThread() == 1 || CVarOutputLayersWeightmapsRTContent.GetValueOnAnyThread() == 1) ? true : false;

	if (!DisplayDebugPrint)
	{
		return;
	}

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeEditLayers.cpp:3397

Scope (from outer to inner):

file
function     void ALandscape::PrintLayersDebugTextureResource

Source code excerpt:

void ALandscape::PrintLayersDebugTextureResource(const FString& InContext, FTextureResource* InTextureResource, uint8 InMipRender, bool InOutputHeight, bool InOutputNormals) const
{
	bool DisplayDebugPrint = (CVarOutputLayersRTContent.GetValueOnAnyThread() == 1 || CVarOutputLayersWeightmapsRTContent.GetValueOnAnyThread() == 1) ? true : false;

	if (!DisplayDebugPrint)
	{
		return;
	}