WeightTargetValue
WeightTargetValue
#Overview
name: WeightTargetValue
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of WeightTargetValue is to control the target weight for painting operations in the Unreal Engine 5 Landscape system. It is used specifically in the landscape painting tools to determine the desired weight value when painting on weight-based landscape layers.
This setting variable is primarily used by the Landscape Editor module, which is part of the Unreal Engine’s terrain editing system. It is referenced in the LandscapeEdModePaintTools and LandscapeEditorObject classes, which are responsible for handling landscape painting operations.
The value of this variable is set in the ULandscapeEditorObject constructor with a default value of 1.0f. It can be modified through the Unreal Engine editor interface, as it is exposed as an editable property with the UPROPERTY macro.
WeightTargetValue interacts with other variables such as bUseWeightTargetValue, which determines whether the target value should be used, and PaintToolStrength, which affects the strength of the painting operation.
Developers should be aware that:
- The value is clamped between 0 and 1 in the UI, but can be set up to 10 in code.
- It is only applicable when painting weight-based landscape layers.
- The effect of this variable depends on the bUseWeightTargetValue flag being set to true.
Best practices when using this variable include:
- Use it in conjunction with bUseWeightTargetValue to enable target-based painting.
- Adjust the value carefully to achieve the desired blending effect on landscape layers.
- Consider the interaction with PaintToolStrength to fine-tune the painting behavior.
- Be mindful of performance implications when frequently changing this value during runtime.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:724, section: [LandscapeEdit]
- INI Section:
LandscapeEdit
- Raw value:
1.000000
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModePaintTools.cpp:272
Scope (from outer to inner):
file
class class FLandscapeToolStrokePaint : public FLandscapeToolStrokePaintBase<FWeightmapToolTarget>
function void Apply
Source code excerpt:
float PaintStrength = this->GetStrength(UISettings, /* bInIsHeightMap = */ false) * Pressure * AdjustedStrength;
ValueType DestValue = FWeightmapToolTarget::CacheClass::ClampValue(static_cast<int32>(255.0f * UISettings->WeightTargetValue));
// TODO: make paint tool framerate independent like the sculpt tool
// const float DeltaTime = FMath::Min<float>(FApp::GetDeltaTime(), 0.1f); // Under 10 fps slow down paint speed
// SculptStrength *= DeltaTime * 3.0f; // * 3.0f to partially compensate for impact of DeltaTime on slowing the tools down compared to the old framerate-dependent version
if (PaintStrength <= 0.0f)
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModePaintTools.cpp:1346
Scope (from outer to inner):
file
class class FLandscapeToolStrokeNoise : public FLandscapeToolStrokePaintBase<ToolTarget>
function void Apply
Source code excerpt:
{
FNoiseParameter NoiseParam(0, UISettings->NoiseScale, 255.0f / 2.0f);
float DestValue = NoiseModeConversion(ELandscapeToolNoiseMode::Add, NoiseParam.NoiseAmount, NoiseParam.Sample(X, Y)) * UISettings->WeightTargetValue;
switch (UISettings->NoiseMode)
{
case ELandscapeToolNoiseMode::Add:
if (OriginalValue >= DestValue)
{
continue;
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModePaintTools.cpp:1356
Scope (from outer to inner):
file
function void Apply
Source code excerpt:
break;
case ELandscapeToolNoiseMode::Sub:
DestValue += (1.0f - UISettings->WeightTargetValue) * NoiseParam.NoiseAmount;
if (OriginalValue <= DestValue)
{
continue;
}
break;
}
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:34
Scope (from outer to inner):
file
function ULandscapeEditorObject::ULandscapeEditorObject
Source code excerpt:
, PaintToolStrength(0.3f)
, bUseWeightTargetValue(false)
, WeightTargetValue(1.0f)
, MaximumValueRadius(10000.0f)
, bCombinedLayersOperation(true)
, FlattenMode(ELandscapeToolFlattenMode::Both)
, bUseSlopeFlatten(false)
, bPickValuePerApply(false)
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:210
Scope (from outer to inner):
file
function void ULandscapeEditorObject::Load
Source code excerpt:
GConfig->GetFloat(TEXT("LandscapeEdit"), TEXT("ToolStrength"), ToolStrength, GEditorPerProjectIni);
GConfig->GetFloat(TEXT("LandscapeEdit"), TEXT("PaintToolStrength"), PaintToolStrength, GEditorPerProjectIni);
GConfig->GetFloat(TEXT("LandscapeEdit"), TEXT("WeightTargetValue"), WeightTargetValue, GEditorPerProjectIni);
bool InbUseWeightTargetValue = bUseWeightTargetValue;
GConfig->GetBool(TEXT("LandscapeEdit"), TEXT("bUseWeightTargetValue"), InbUseWeightTargetValue, GEditorPerProjectIni);
bUseWeightTargetValue = InbUseWeightTargetValue;
GConfig->GetFloat(TEXT("LandscapeEdit"), TEXT("BrushRadius"), BrushRadius, GEditorPerProjectIni);
GConfig->GetFloat(TEXT("LandscapeEdit"), TEXT("PaintBrushRadius"), PaintBrushRadius, GEditorPerProjectIni);
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:387
Scope (from outer to inner):
file
function void ULandscapeEditorObject::Save
Source code excerpt:
GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("ToolStrength"), ToolStrength, GEditorPerProjectIni);
GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("PaintToolStrength"), PaintToolStrength, GEditorPerProjectIni);
GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("WeightTargetValue"), WeightTargetValue, GEditorPerProjectIni);
GConfig->SetBool(TEXT("LandscapeEdit"), TEXT("bUseWeightTargetValue"), bUseWeightTargetValue, GEditorPerProjectIni);
GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("BrushRadius"), BrushRadius, GEditorPerProjectIni);
GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("PaintBrushRadius"), PaintBrushRadius, GEditorPerProjectIni);
GConfig->SetInt(TEXT("LandscapeEdit"), TEXT("BrushComponentSize"), BrushComponentSize, GEditorPerProjectIni);
GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("BrushFalloff"), BrushFalloff, GEditorPerProjectIni);
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Public/LandscapeEditorObject.h:295
Scope (from outer to inner):
file
class class ULandscapeEditorObject : public UObject
Source code excerpt:
// Enable to make tools blend towards a target value
UPROPERTY(Category="Tool Settings", EditAnywhere, NonTransactional, meta=(DisplayName="Use Target Value", EditCondition="bUseWeightTargetValue", ShowForTools="Paint,Sculpt,Noise", ShowForTargetTypes = "Weightmap", ClampMin="0", ClampMax="10", UIMin="0", UIMax="1"))
float WeightTargetValue;
// I have no idea what this is for but it's used by the noise and erosion tools, and isn't exposed to the UI
UPROPERTY(NonTransactional)
float MaximumValueRadius;
// Use the combined result of the underlying layers as input to the operation. When not checked, it will use only the data in the currently selected layer as input.