AlphaBrushScale
AlphaBrushScale
#Overview
name: AlphaBrushScale
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 11
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of AlphaBrushScale is to control the scale of the brush texture in the Landscape Editor of Unreal Engine 5. It is used to adjust the size of the alpha brush pattern applied to the landscape during editing operations.
This setting variable is primarily used by the Landscape Editor module, specifically within the brush system for landscape editing. It’s part of the LandscapeEditorObject class, which manages various settings for landscape editing.
The value of this variable is set in several ways:
- It’s initialized in the ULandscapeEditorObject constructor with a default value of 0.5f.
- It can be loaded from and saved to the project’s configuration file (GEditorPerProjectIni) using the Load() and Save() functions.
- It can be modified through the Editor UI, as evidenced by the UPROPERTY macro in the header file.
AlphaBrushScale interacts with other variables such as AlphaBrushRotation, AlphaBrushPanU, and AlphaBrushPanV to define the overall behavior of the alpha brush. It’s also used in calculations with SizeX and SizeY to determine the final brush scale.
Developers should be aware that:
- The scale directly affects how the brush texture is mapped to the landscape.
- A scale of 1.0 maps the brush texture to the landscape at a 1 pixel = 1 vertex size.
- The value is clamped between 0.005 and 5, with a slider exponent of 3 in the UI.
Best practices when using this variable include:
- Adjusting it in conjunction with other brush settings for desired effects.
- Being mindful of performance implications when using very large scales.
- Using the UI slider for intuitive adjustments, as it uses a non-linear scale due to the SliderExponent.
- Considering how it interacts with the landscape’s resolution and size to achieve the desired level of detail in edits.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:730, section: [LandscapeEdit]
- INI Section:
LandscapeEdit
- Raw value:
0.500000
- 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/LandscapeEdModeBrushes.cpp:1211
Scope (from outer to inner):
file
class class FLandscapeBrushAlphaPattern : public FLandscapeBrushAlphaBase
function virtual FLandscapeBrushData ApplyBrush
Source code excerpt:
else
{
Scale.X = 1.0f / EdMode->UISettings->AlphaBrushScale;
Scale.Y = 1.0f / EdMode->UISettings->AlphaBrushScale;
Bias.X = SizeX * EdMode->UISettings->AlphaBrushPanU;
Bias.Y = SizeY * EdMode->UISettings->AlphaBrushPanV;
Angle = EdMode->UISettings->AlphaBrushRotation;
}
// Find alphamap sample location
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModeBrushes.cpp:1302
Scope (from outer to inner):
file
class class FLandscapeBrushAlphaPattern : public FLandscapeBrushAlphaBase
function virtual void Tick
Source code excerpt:
else
{
const FVector2D Scale(EdMode->UISettings->AlphaBrushScale * SizeX, EdMode->UISettings->AlphaBrushScale * SizeY);
AlphaScaleBias = FLinearColor(
static_cast<float>(FMath::IsNearlyZero(Scale.X) ? 1.0 : 1.0 / (Scale.X)),
static_cast<float>(FMath::IsNearlyZero(Scale.Y) ? 1.0 : 1.0 / (Scale.Y)),
EdMode->UISettings->AlphaBrushPanU,
EdMode->UISettings->AlphaBrushPanV);
Angle = EdMode->UISettings->AlphaBrushRotation;
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModeBrushes.cpp:1408
Scope (from outer to inner):
file
class class FLandscapeBrushAlpha : public FLandscapeBrushAlphaBase
function virtual bool CanPaint
Source code excerpt:
}
float AlphaBrushScale;
float Radius;
int32 SizeX;
int32 SizeY;
if (!ComputeAlphaBrushScaleAndRadius(AlphaBrushScale, Radius, SizeX, SizeY))
{
return false;
}
return true;
}
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModeBrushes.cpp:1437
Scope (from outer to inner):
file
class class FLandscapeBrushAlpha : public FLandscapeBrushAlphaBase
function virtual FLandscapeBrushData ApplyBrush
Source code excerpt:
else
{
float AlphaBrushScale;
float Radius;
int32 SizeX;
int32 SizeY;
bool bIsValid = ComputeAlphaBrushScaleAndRadius(AlphaBrushScale, Radius, SizeX, SizeY);
check(bIsValid && !FMath::IsNearlyZero(AlphaBrushScale) && !FMath::IsNearlyZero(Radius) && (SizeX > 0) && (SizeY > 0)); // See CanPaint() function above : if bCanPaint, AlphaBrushScale should be non-zero
const float BrushAngle = EdMode->UISettings->bAlphaBrushAutoRotate ? LastMouseAngle : FMath::DegreesToRadians(EdMode->UISettings->AlphaBrushRotation);
FIntRect Bounds;
Bounds.Min.X = FMath::FloorToInt(LastMousePosition.X - Radius);
Bounds.Min.Y = FMath::FloorToInt(LastMousePosition.Y - Radius);
Bounds.Max.X = FMath::CeilToInt( LastMousePosition.X + Radius);
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModeBrushes.cpp:1469
Scope (from outer to inner):
file
class class FLandscapeBrushAlpha : public FLandscapeBrushAlphaBase
function virtual FLandscapeBrushData ApplyBrush
Source code excerpt:
{
// Find alphamap sample location
float ScaleSampleX = ((float)X - LastMousePosition.X) / AlphaBrushScale;
float ScaleSampleY = ((float)Y - LastMousePosition.Y) / AlphaBrushScale;
// Rotate around center to match angle
float SampleX = ScaleSampleX * FMath::Cos(BrushAngle) - ScaleSampleY * FMath::Sin(BrushAngle);
float SampleY = ScaleSampleY * FMath::Cos(BrushAngle) + ScaleSampleX * FMath::Sin(BrushAngle);
SampleX += (float)SizeX * 0.5f;
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModeBrushes.cpp:1541
Scope (from outer to inner):
file
class class FLandscapeBrushAlpha : public FLandscapeBrushAlphaBase
function virtual void Tick
Source code excerpt:
{
FVector2f Scale(1.0f, 1.0f);
float AlphaBrushScale;
float Radius;
int32 SizeX;
int32 SizeY;
bool bIsValid = ComputeAlphaBrushScaleAndRadius(AlphaBrushScale, Radius, SizeX, SizeY);
if (bIsValid)
{
check(!FMath::IsNearlyZero(AlphaBrushScale) && !FMath::IsNearlyZero(Radius) && (SizeX > 0) && (SizeY > 0)); // See CanPaint() function above : if bCanPaint, AlphaBrushScale should be non-zero
Scale = FVector2f(1.0f / (AlphaBrushScale * SizeX), 1.0f / (AlphaBrushScale * SizeY));
}
FLinearColor BrushScaleRot(
Scale.X,
Scale.Y,
0.0f,
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorDetailCustomization_AlphaBrush.cpp:252
Scope (from outer to inner):
file
function BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION void FLandscapeEditorDetailCustomization_AlphaBrush::CustomizeDetails
Source code excerpt:
{
TSharedRef<IPropertyHandle> PropertyHandle_bUseWorldSpacePatternBrush = DetailBuilder.GetProperty(GET_MEMBER_NAME_CHECKED(ULandscapeEditorObject, bUseWorldSpacePatternBrush));
TSharedRef<IPropertyHandle> PropertyHandle_AlphaBrushScale = DetailBuilder.GetProperty(GET_MEMBER_NAME_CHECKED(ULandscapeEditorObject, AlphaBrushScale));
TSharedRef<IPropertyHandle> PropertyHandle_AlphaBrushRotation = DetailBuilder.GetProperty(GET_MEMBER_NAME_CHECKED(ULandscapeEditorObject, AlphaBrushRotation));
TSharedRef<IPropertyHandle> PropertyHandle_AlphaBrushPanU = DetailBuilder.GetProperty(GET_MEMBER_NAME_CHECKED(ULandscapeEditorObject, AlphaBrushPanU));
TSharedRef<IPropertyHandle> PropertyHandle_AlphaBrushPanV = DetailBuilder.GetProperty(GET_MEMBER_NAME_CHECKED(ULandscapeEditorObject, AlphaBrushPanV));
auto NonWorld_Visibility = TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateLambda([=]() { return GetPropertyValue<bool>(PropertyHandle_bUseWorldSpacePatternBrush) ? EVisibility::Collapsed : EVisibility::Visible; } ));
auto World_Visibility = TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateLambda([=]() { return GetPropertyValue<bool>(PropertyHandle_bUseWorldSpacePatternBrush) ? EVisibility::Visible : EVisibility::Collapsed; } ));
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:107
Scope (from outer to inner):
file
function ULandscapeEditorObject::ULandscapeEditorObject
Source code excerpt:
, bUseClayBrush(false)
, AlphaBrushScale(0.5f)
, bAlphaBrushAutoRotate(true)
, AlphaBrushRotation(0.0f)
, AlphaBrushPanU(0.5f)
, AlphaBrushPanV(0.5f)
, bUseWorldSpacePatternBrush(false)
, WorldSpacePatternBrushSettings(FVector2D::ZeroVector, 0.0f, false, 3200)
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:223
Scope (from outer to inner):
file
function void ULandscapeEditorObject::Load
Source code excerpt:
GConfig->GetBool(TEXT("LandscapeEdit"), TEXT("bUseClayBrush"), InbUseClayBrush, GEditorPerProjectIni);
bUseClayBrush = InbUseClayBrush;
GConfig->GetFloat(TEXT("LandscapeEdit"), TEXT("AlphaBrushScale"), AlphaBrushScale, GEditorPerProjectIni);
GConfig->GetBool(TEXT("LandscapeEdit"), TEXT("AlphaBrushAutoRotate"), bAlphaBrushAutoRotate, GEditorPerProjectIni);
GConfig->GetFloat(TEXT("LandscapeEdit"), TEXT("AlphaBrushRotation"), AlphaBrushRotation, GEditorPerProjectIni);
GConfig->GetFloat(TEXT("LandscapeEdit"), TEXT("AlphaBrushPanU"), AlphaBrushPanU, GEditorPerProjectIni);
GConfig->GetFloat(TEXT("LandscapeEdit"), TEXT("AlphaBrushPanV"), AlphaBrushPanV, GEditorPerProjectIni);
GConfig->GetBool(TEXT("LandscapeEdit"), TEXT("bUseWorldSpacePatternBrush"), bUseWorldSpacePatternBrush, GEditorPerProjectIni);
GConfig->GetVector2D(TEXT("LandscapeEdit"), TEXT("WorldSpacePatternBrushSettings.Origin"), WorldSpacePatternBrushSettings.Origin, GEditorPerProjectIni);
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:396
Scope (from outer to inner):
file
function void ULandscapeEditorObject::Save
Source code excerpt:
GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("PaintBrushFalloff"), PaintBrushFalloff, GEditorPerProjectIni);
GConfig->SetBool(TEXT("LandscapeEdit"), TEXT("bUseClayBrush"), bUseClayBrush, GEditorPerProjectIni);
GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("AlphaBrushScale"), AlphaBrushScale, GEditorPerProjectIni);
GConfig->SetBool(TEXT("LandscapeEdit"), TEXT("AlphaBrushAutoRotate"), bAlphaBrushAutoRotate, GEditorPerProjectIni);
GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("AlphaBrushRotation"), AlphaBrushRotation, GEditorPerProjectIni);
GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("AlphaBrushPanU"), AlphaBrushPanU, GEditorPerProjectIni);
GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("AlphaBrushPanV"), AlphaBrushPanV, GEditorPerProjectIni);
GConfig->SetVector2D(TEXT("LandscapeEdit"), TEXT("WorldSpacePatternBrushSettings.Origin"), WorldSpacePatternBrushSettings.Origin, GEditorPerProjectIni);
GConfig->SetBool(TEXT("LandscapeEdit"), TEXT("WorldSpacePatternBrushSettings.bCenterTextureOnOrigin"), WorldSpacePatternBrushSettings.bCenterTextureOnOrigin, GEditorPerProjectIni);
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Public/LandscapeEditorObject.h:642
Scope (from outer to inner):
file
class class ULandscapeEditorObject : public UObject
Source code excerpt:
// Scale of the brush texture. A scale of 1.000 maps the brush texture to the landscape at a 1 pixel = 1 vertex size
UPROPERTY(Category="Brush Settings", EditAnywhere, NonTransactional, meta=(DisplayName="Texture Scale", ShowForBrushes="BrushSet_Pattern", ClampMin="0.005", ClampMax="5", SliderExponent="3"))
float AlphaBrushScale;
// Rotate brush to follow mouse
UPROPERTY(Category = "Brush Settings", EditAnywhere, NonTransactional, meta = (DisplayName = "Auto-Rotate", ShowForBrushes = "BrushSet_Alpha"))
bool bAlphaBrushAutoRotate;
// Rotates the brush mask texture