FlattenMode
FlattenMode
#Overview
name: FlattenMode
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 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of FlattenMode is to control the behavior of the landscape flattening tool in Unreal Engine’s landscape editor. This setting variable is used to determine how the terrain should be modified when using the flatten tool.
FlattenMode is primarily used in the Landscape Editor module of Unreal Engine. It’s specifically utilized in the landscape editing tools, particularly the flatten tool.
The value of this variable is set in the ULandscapeEditorObject constructor and can be modified through the Unreal Engine editor interface. It’s also saved to and loaded from the project’s configuration file (GEditorPerProjectIni) to persist user preferences.
FlattenMode interacts with other landscape editing variables such as bUseSlopeFlatten, bPickValuePerApply, and FlattenTarget. These variables work together to define the behavior of the flatten tool.
Developers should be aware that FlattenMode is an enumeration (ELandscapeToolFlattenMode) with different options (such as Raise, Lower, Both, and Terrace). The chosen mode significantly affects how the flatten tool modifies the landscape.
Best practices when using this variable include:
- Understand the different flatten modes and their effects on the landscape.
- Consider using bUseSlopeFlatten in conjunction with FlattenMode for more natural-looking terrain modifications.
- Be mindful of how FlattenMode interacts with other flatten tool settings to achieve desired results.
- Remember that the flatten tool’s behavior can significantly impact landscape design, so use it thoughtfully and in combination with other landscape editing tools for best results.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:736, section: [LandscapeEdit]
- INI Section:
LandscapeEdit
- Raw value:
0
- 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:1005
Scope (from outer to inner):
file
class class FLandscapeToolStrokeFlatten : public FLandscapeToolStrokePaintBase<ToolTarget>
function void Apply
Source code excerpt:
{
int32 Delta = DataScanline[X] - FlattenValue;
switch (UISettings->FlattenMode)
{
case ELandscapeToolFlattenMode::Terrace:
if (bTargetIsHeightmap)
{
const FTransform& LocalToWorld = this->Target.LandscapeInfo->GetLandscapeProxy()->ActorToWorld();
float ScaleZ = static_cast<float>(LocalToWorld.GetScale3D().Z);
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModePaintTools.cpp:1092
Scope (from outer to inner):
file
class class FLandscapeToolStrokeFlatten : public FLandscapeToolStrokePaintBase<ToolTarget>
function void Apply
Source code excerpt:
float PlaneDist = static_cast<float>(DataScanline[X] - DestValue);
DestValue = static_cast<ValueType>(DataScanline[X] - PlaneDist * Strength);
switch (UISettings->FlattenMode)
{
case ELandscapeToolFlattenMode::Raise:
if (PlaneDist < 0)
{
DataScanline[X] = static_cast<ValueType>(FMath::CeilToInt(FMath::Lerp((float)DataScanline[X], (float)DestValue, Strength)));
}
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:38
Scope (from outer to inner):
file
function ULandscapeEditorObject::ULandscapeEditorObject
Source code excerpt:
, bCombinedLayersOperation(true)
, FlattenMode(ELandscapeToolFlattenMode::Both)
, bUseSlopeFlatten(false)
, bPickValuePerApply(false)
, bUseFlattenTarget(false)
, FlattenTarget(0)
, bShowFlattenTargetPreview(true)
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:245
Scope (from outer to inner):
file
function void ULandscapeEditorObject::Load
Source code excerpt:
int32 InFlattenMode = (int32)ELandscapeToolFlattenMode::Both;
GConfig->GetInt(TEXT("LandscapeEdit"), TEXT("FlattenMode"), InFlattenMode, GEditorPerProjectIni);
FlattenMode = (ELandscapeToolFlattenMode)InFlattenMode;
bool InbUseSlopeFlatten = bUseSlopeFlatten;
GConfig->GetBool(TEXT("LandscapeEdit"), TEXT("bUseSlopeFlatten"), InbUseSlopeFlatten, GEditorPerProjectIni);
bUseSlopeFlatten = InbUseSlopeFlatten;
bool InbPickValuePerApply = bPickValuePerApply;
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:408
Scope (from outer to inner):
file
function void ULandscapeEditorObject::Save
Source code excerpt:
GConfig->SetInt(TEXT("LandscapeEdit"), TEXT("AlphaTextureChannel"), (int32)AlphaTextureChannel, GEditorPerProjectIni);
GConfig->SetInt(TEXT("LandscapeEdit"), TEXT("FlattenMode"), (int32)FlattenMode, GEditorPerProjectIni);
GConfig->SetBool(TEXT("LandscapeEdit"), TEXT("bUseSlopeFlatten"), bUseSlopeFlatten, GEditorPerProjectIni);
GConfig->SetBool(TEXT("LandscapeEdit"), TEXT("bPickValuePerApply"), bPickValuePerApply, GEditorPerProjectIni);
GConfig->SetBool(TEXT("LandscapeEdit"), TEXT("bUseFlattenTarget"), bUseFlattenTarget, GEditorPerProjectIni);
GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("FlattenTarget"), FlattenTarget, GEditorPerProjectIni);
GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("TerraceSmooth"), TerraceSmooth, GEditorPerProjectIni);
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Public/LandscapeEditorObject.h:309
Scope (from outer to inner):
file
class class ULandscapeEditorObject : public UObject
Source code excerpt:
// Whether to flatten by lowering, raising, both or terracing
UPROPERTY(Category="Tool Settings", EditAnywhere, NonTransactional, meta=(ShowForTools="Flatten"))
ELandscapeToolFlattenMode FlattenMode;
// Flattens to the angle of the clicked point, instead of horizontal
UPROPERTY(Category="Tool Settings", EditAnywhere, NonTransactional, meta=(ShowForTools="Flatten", ShowForTargetTypes="Heightmap"))
bool bUseSlopeFlatten;
// Constantly picks new values to flatten towards when dragging around, instead of only using the first clicked point