landscape.DumpWeightmapDiff

landscape.DumpWeightmapDiff

#Overview

name: landscape.DumpWeightmapDiff

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of landscape.DumpWeightmapDiff is to debug and analyze changes in landscape weightmap textures during the edit layer blend phase. This setting variable is primarily used for the landscape system in Unreal Engine 5.

The Unreal Engine subsystem that relies on this setting variable is the Landscape module, specifically the editing and rendering components of the landscape system.

The value of this variable is set through a console command or configuration file. It is defined as a TAutoConsoleVariable, which means it can be changed at runtime through the console or configuration files.

This variable interacts with CVarLandscapeDumpWeightmapDiff, which is the associated C++ variable that shares the same value. It also interacts with other related variables like CVarLandscapeDumpDiffDetails and CVarLandscapeTrackDirty, which are used in conjunction to control the debug output behavior.

Developers must be aware that this variable is primarily used for debugging purposes and can affect performance when enabled. It should be used cautiously in production environments.

Best practices when using this variable include:

  1. Only enable it when necessary for debugging landscape weightmap issues.
  2. Be mindful of the performance impact, especially when setting it to dump all mips (value 2).
  3. Use it in conjunction with other debug variables like landscape.DumpDiffDetails for more comprehensive analysis.

Regarding the associated variable CVarLandscapeDumpWeightmapDiff:

The purpose of CVarLandscapeDumpWeightmapDiff is to provide a programmatic way to access and modify the landscape.DumpWeightmapDiff setting within the C++ code.

This variable is used directly in the Landscape module, specifically in the ALandscape class, to control the behavior of weightmap diff dumping.

The value of this variable is set when the console variable is initialized, and it can be accessed or modified through the GetValueOnGameThread() method.

CVarLandscapeDumpWeightmapDiff interacts closely with the console variable landscape.DumpWeightmapDiff, effectively serving as its C++ representation.

Developers should be aware that changes to this variable will directly affect the behavior of the landscape weightmap diff dumping feature.

Best practices for using CVarLandscapeDumpWeightmapDiff include:

  1. Access its value using GetValueOnGameThread() to ensure thread-safety.
  2. Use it in conjunction with other related variables for comprehensive debugging.
  3. Consider the performance implications when enabling weightmap diff dumping in production 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:136

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarLandscapeDumpWeightmapDiff(
	TEXT("landscape.DumpWeightmapDiff"),
	0,
	TEXT("This will save images for readback weightmap textures that have changed in the last edit layer blend phase. (= 0 No Diff, 1 = Mip 0 Diff, 2 = All Mips Diff"));

static TAutoConsoleVariable<bool> CVarLandscapeDumpDiffDetails(
	TEXT("landscape.DumpDiffDetails"),
	false,

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	TEXT("This will save images for readback heightmap textures that have changed in the last edit layer blend phase. (= 0 No Diff, 1 = Mip 0 Diff, 2 = All Mips Diff"));

static TAutoConsoleVariable<int32> CVarLandscapeDumpWeightmapDiff(
	TEXT("landscape.DumpWeightmapDiff"),
	0,
	TEXT("This will save images for readback weightmap textures that have changed in the last edit layer blend phase. (= 0 No Diff, 1 = Mip 0 Diff, 2 = All Mips Diff"));

static TAutoConsoleVariable<bool> CVarLandscapeDumpDiffDetails(
	TEXT("landscape.DumpDiffDetails"),

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

Scope (from outer to inner):

file
function     void ALandscape::OnDirtyWeightmap

Source code excerpt:

void ALandscape::OnDirtyWeightmap(FTextureToComponentHelper const& MapHelper, UTexture2D const* InWeightmap, FColor const* InOldData, FColor const* InNewData, int32 InMipLevel)
{
	int32 DumpWeightmapDiff = CVarLandscapeDumpWeightmapDiff.GetValueOnGameThread();
	const bool bDumpDiff = (DumpWeightmapDiff > 0);
	const bool bDumpDiffAllMips = (DumpWeightmapDiff > 1);
	const bool bDumpDiffDetails = CVarLandscapeDumpDiffDetails.GetValueOnGameThread();
	const bool bTrackDirty = CVarLandscapeTrackDirty.GetValueOnGameThread() != 0;
	ULandscapeSubsystem* LandscapeSubsystem = GetWorld()->GetSubsystem<ULandscapeSubsystem>();
	check(LandscapeSubsystem != nullptr);