landscape.SimulateAlphaBrushTextureLoadFailure
landscape.SimulateAlphaBrushTextureLoadFailure
#Overview
name: landscape.SimulateAlphaBrushTextureLoadFailure
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Debug utility to simulate a loading failure (e.g. invalid source data, which can happen in cooked editor or with a badly virtualized texture) when loading the alpha brush texture
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of landscape.SimulateAlphaBrushTextureLoadFailure is to serve as a debug utility for simulating a loading failure when loading the alpha brush texture in the landscape system of Unreal Engine 5. This setting is specifically designed for the landscape editing and rendering system.
This setting variable is primarily used in the LandscapeEditor module, which is part of the Unreal Engine’s landscape system. It’s implemented in the LandscapeEditorObject.cpp file, indicating its relevance to landscape editing functionality.
The value of this variable is set through a console variable (CVar) system. It’s initialized as a static TAutoConsoleVariable with a default value of false. This means that by default, the simulation of alpha brush texture load failure is turned off.
The associated variable CVarLandscapeSimulateAlphaBrushTextureLoadFailure interacts directly with this setting. They share the same value and purpose, with CVarLandscapeSimulateAlphaBrushTextureLoadFailure being the actual console variable that can be manipulated at runtime.
Developers must be aware that this variable is intended for debugging purposes only. When enabled, it simulates a loading failure for the alpha brush texture, which can help in testing error handling and robustness of the landscape system under failure conditions.
Best practices when using this variable include:
- Only enable it during debugging sessions, not in production builds.
- Use it to test how the landscape system handles texture loading failures.
- Be aware that enabling this will affect the normal functioning of the landscape alpha brush system.
- After testing, always ensure to disable it to restore normal functionality.
Regarding the associated variable CVarLandscapeSimulateAlphaBrushTextureLoadFailure:
- It’s the actual console variable that controls the behavior.
- It’s used in the LoadAlphaTextureSourceData function of the ULandscapeEditorObject class to determine whether to simulate a texture loading failure.
- Developers can toggle this variable at runtime using console commands, making it useful for on-the-fly debugging.
- When using this variable, developers should be cautious as it directly affects the landscape editing functionality and could lead to unexpected behavior if left enabled unintentionally.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:19
Scope: file
Source code excerpt:
static TAutoConsoleVariable<bool> CVarLandscapeSimulateAlphaBrushTextureLoadFailure(
TEXT("landscape.SimulateAlphaBrushTextureLoadFailure"),
false,
TEXT("Debug utility to simulate a loading failure (e.g. invalid source data, which can happen in cooked editor or with a badly virtualized texture) when loading the alpha brush texture"));
const FVector ULandscapeEditorObject::NewLandscape_DefaultLocation = FVector(0, 0, 100);
const FRotator ULandscapeEditorObject::NewLandscape_DefaultRotation = FRotator::ZeroRotator;
const FVector ULandscapeEditorObject::NewLandscape_DefaultScale = FVector(100, 100, 100);
#Associated Variable and Callsites
This variable is associated with another variable named CVarLandscapeSimulateAlphaBrushTextureLoadFailure
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:18
Scope: file
Source code excerpt:
#include "Misc/MessageDialog.h"
static TAutoConsoleVariable<bool> CVarLandscapeSimulateAlphaBrushTextureLoadFailure(
TEXT("landscape.SimulateAlphaBrushTextureLoadFailure"),
false,
TEXT("Debug utility to simulate a loading failure (e.g. invalid source data, which can happen in cooked editor or with a badly virtualized texture) when loading the alpha brush texture"));
const FVector ULandscapeEditorObject::NewLandscape_DefaultLocation = FVector(0, 0, 100);
const FRotator ULandscapeEditorObject::NewLandscape_DefaultRotation = FRotator::ZeroRotator;
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:526
Scope (from outer to inner):
file
function bool ULandscapeEditorObject::LoadAlphaTextureSourceData
Source code excerpt:
if (InTexture && InTexture->Source.IsValid()
&& !CVarLandscapeSimulateAlphaBrushTextureLoadFailure.GetValueOnGameThread()) // For debug purposes, we can also simulate a loading failure for the alpha brush texture
{
FImage SourceImage;
if (InTexture->Source.GetMipImage(SourceImage, 0) && (SourceImage.Format != ERawImageFormat::Invalid))
{
OutSourceDataSizeX = SourceImage.SizeX;
OutSourceDataSizeY = SourceImage.SizeY;