ToolStrength
ToolStrength
#Overview
name: ToolStrength
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 10
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ToolStrength is to control the intensity of various landscape editing tools in Unreal Engine 5’s landscape system. It is used primarily for heightmap and visibility operations in the Landscape Editor.
This setting variable is primarily used in the Landscape Editor module, specifically within the LandscapeEditor subsystem. It’s utilized by various landscape editing tools such as Sculpt, Smooth, Flatten, Erosion, and HydroErosion.
The value of this variable is set in the Landscape Editor UI, and it’s also saved to and loaded from the project’s configuration file (GEditorPerProjectIni) to persist between editor sessions.
ToolStrength interacts with another variable called PaintToolStrength, which serves a similar purpose but is specifically for weightmap operations. The GetCurrentToolStrength() function determines which of these two variables to use based on the current target type.
Developers should be aware that:
- ToolStrength affects the intensity of most landscape editing operations.
- Its value is clamped between 0 and 10, with a UI range of 0 to 1.
- It can be influenced by pressure sensitivity when using a pen/tablet input device.
Best practices when using this variable include:
- Use lower values for more precise, gradual edits.
- Use higher values for more dramatic, quick changes.
- Adjust the value based on the specific tool and desired effect.
- Consider the scale of your landscape when setting this value, as the same strength might have different effects on differently sized landscapes.
- Remember that this setting affects heightmap and visibility operations, while PaintToolStrength affects weightmap operations.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:723, section: [LandscapeEdit]
- INI Section:
LandscapeEdit
- Raw value:
0.300000
- 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/LandscapeEdModeErosionTools.cpp:467
Scope (from outer to inner):
file
class class FLandscapeToolStrokeHydraErosion : public FLandscapeToolStrokeErosionBase
function void Apply
Source code excerpt:
{
AverageAltitude *= static_cast<float>(1.0f - 0.1 * UISettings->GetCurrentToolStrength() * Pressure);
//AverageAltitude -= 4000.0f * UISettings->ToolStrength;
}
uint32 WaterTransfer = static_cast<uint32>(FMath::Min<uint32>(WaterData[Center], Altitude - (uint32)AverageAltitude) * BrushValue);
for (int32 Idx = 0; Idx < NeighborNum; Idx++)
{
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModeErosionTools.cpp:514
Scope (from outer to inner):
file
class class FLandscapeToolStrokeHydraErosion : public FLandscapeToolStrokeErosionBase
function void Apply
Source code excerpt:
if (UISettings->bHErosionDetailSmooth)
{
//LowPassFilter<uint16>(X1, Y1, X2, Y2, BrushInfo, HeightData, UISettings->HErosionDetailScale, UISettings->ToolStrength * Pressure);
LowPassFilter<uint16>(X1, Y1, X2, Y2, BrushInfo, HeightData, UISettings->HErosionDetailScale, 1.0f);
}
LayerHeightDataCache.Write(X1, Y1, X2, Y2, HeightData);
}
};
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModePaintTools.cpp:758
Scope (from outer to inner):
file
class class FLandscapeToolStrokeSmooth : public FLandscapeToolStrokePaintBase<ToolTarget>
function void Apply
Source code excerpt:
const TArray<ValueType> ReadData { Data };
const float ToolStrength = FMath::Clamp<float>(this->GetStrength(UISettings, bTargetIsHeightmap) * Pressure, 0.0f, 1.0f);
// Apply the brush
if (UISettings->bDetailSmooth)
{
LowPassFilter<ValueType>(X1, Y1, X2, Y2, BrushInfo, Data, UISettings->DetailScale, ToolStrength);
}
else
{
const int32 FilterRadius = UISettings->SmoothFilterKernelSize;
for (int32 Y = BrushInfo.GetBounds().Min.Y; Y < BrushInfo.GetBounds().Max.Y; Y++)
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModePaintTools.cpp:776
Scope (from outer to inner):
file
class class FLandscapeToolStrokeSmooth : public FLandscapeToolStrokePaintBase<ToolTarget>
function void Apply
Source code excerpt:
for (int32 X = BrushInfo.GetBounds().Min.X; X < BrushInfo.GetBounds().Max.X; X++)
{
const float BrushValue = BrushScanline[X] * ToolStrength;
if (BrushValue > 0.0f)
{
// needs to be ~12 bits larger than ToolTarget::CacheClass::DataType (for max FilterRadius (31))
// the editor is 64-bit native so just go the whole hog :)
int64 FilterValue = 0;
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:31
Scope (from outer to inner):
file
function ULandscapeEditorObject::ULandscapeEditorObject
Source code excerpt:
// Tool Settings:
, ToolStrength(0.3f)
, PaintToolStrength(0.3f)
, bUseWeightTargetValue(false)
, WeightTargetValue(1.0f)
, MaximumValueRadius(10000.0f)
, bCombinedLayersOperation(true)
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:208
Scope (from outer to inner):
file
function void ULandscapeEditorObject::Load
Source code excerpt:
void ULandscapeEditorObject::Load()
{
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;
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:385
Scope (from outer to inner):
file
function void ULandscapeEditorObject::Save
Source code excerpt:
void ULandscapeEditorObject::Save()
{
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);
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:998
Scope (from outer to inner):
file
function float ULandscapeEditorObject::GetCurrentToolStrength
Source code excerpt:
return PaintToolStrength;
}
return ToolStrength;
}
void ULandscapeEditorObject::SetCurrentToolStrength(float NewToolStrength)
{
if (IsWeightmapTarget())
{
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:1009
Scope (from outer to inner):
file
function void ULandscapeEditorObject::SetCurrentToolStrength
Source code excerpt:
else
{
ToolStrength = NewToolStrength;
}
}
float ULandscapeEditorObject::GetCurrentToolBrushRadius() const
{
if (IsWeightmapTarget())
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Public/LandscapeEditorObject.h:283
Scope (from outer to inner):
file
class class ULandscapeEditorObject : public UObject
Source code excerpt:
// Strength of the Sculpt tool. If you're using a pen/tablet with pressure-sensing, the pressure used affects the strength of the tool.
UPROPERTY(Category="Tool Settings", EditAnywhere, NonTransactional, meta=(DisplayName="Tool Strength", ShowForTools="Paint,Sculpt,Erase,Smooth,Flatten,Erosion,HydraErosion,Noise,Mask,CopyPaste", ShowForTargetTypes = "Heightmap,Visibility", ClampMin="0", ClampMax="10", UIMin="0", UIMax="1"))
float ToolStrength;
// Strength of the Paint tool. If you're using a pen/tablet with pressure-sensing, the pressure used affects the strength of the tool.
UPROPERTY(Category="Tool Settings", EditAnywhere, NonTransactional, meta=(DisplayName="Tool Strength", ShowForTools="Paint,Sculpt,Erase,Smooth,Flatten,Erosion,HydraErosion,Noise,Mask,CopyPaste", ShowForTargetTypes = "Weightmap", ClampMin="0", ClampMax="10", UIMin="0", UIMax="1"))
float PaintToolStrength;
// Enable to make tools blend towards a target value