bApplyToAllTargets

bApplyToAllTargets

#Overview

name: bApplyToAllTargets

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 bApplyToAllTargets is to control whether copy and paste operations in the Landscape Editor apply to all layers or only to the currently selected layer. This setting variable is specifically used in the Landscape editing system of Unreal Engine 5.

The Unreal Engine subsystem that relies on this setting variable is the Landscape Editor, which is part of the editor toolset for manipulating terrain in Unreal Engine games.

The value of this variable is set in the ULandscapeEditorObject constructor (LandscapeEditorObject.cpp:77) with a default value of true. It can be modified by the user through the Landscape Editor interface, as indicated by the UPROPERTY macro in LandscapeEditorObject.h:456.

This variable interacts with the layer selection system in the Landscape Editor. When true, it overrides the current layer selection and applies operations to all layers.

Developers must be aware that this variable can significantly impact the behavior of copy and paste operations in the Landscape Editor. When enabled, it will affect all layers, which may not always be the desired outcome.

Best practices when using this variable include:

  1. Ensuring it’s set appropriately before performing copy or paste operations.
  2. Checking its value when debugging unexpected behavior in landscape editing operations.
  3. Considering performance implications when working with large landscapes, as operating on all layers simultaneously may be more resource-intensive.
  4. Providing clear documentation or user interface cues to indicate when this setting is active, as it can lead to unintended modifications if users are unaware of its state.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:761, section: [LandscapeEdit]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModeComponentTools.cpp:1201

Scope (from outer to inner):

file
class        class FLandscapeToolStrokeCopy : public FLandscapeToolStrokeBase
function     void Apply

Source code excerpt:

			//float Pressure = ViewportClient->Viewport->IsPenActive() ? ViewportClient->Viewport->GetTabletPressure() : 1.0f;

			bool bApplyToAll = EdMode->UISettings->bApplyToAllTargets;
			const int32 LayerNum = LandscapeInfo->Layers.Num();

			TArray<uint16> HeightData;
			TArray<uint8> WeightDatas; // Weight*Layers...
			TArray<typename ToolTarget::CacheClass::DataType> Data;

#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModeComponentTools.cpp:1590

Scope (from outer to inner):

file
class        class FLandscapeToolStrokePaste : public FLandscapeToolStrokeBase
function     void Apply

Source code excerpt:

			Y2 += 1;

			const bool bApplyToAll = EdMode->UISettings->bApplyToAllTargets;
			const int32 LayerNum = Gizmo->LayerInfos.Num() > 0 ? LandscapeInfo->Layers.Num() : 0;

			TArray<uint16> HeightData;
			TArray<uint8> WeightDatas; // Weight*Layers...
			TArray<typename ToolTarget::CacheClass::DataType> Data;

#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorDetailCustomization_CopyPaste.cpp:553

Scope (from outer to inner):

file
function     FReply FLandscapeEditorDetailCustomization_CopyPaste::OnGizmoExportButtonClicked

Source code excerpt:

			for (int32 i = -1; i < Gizmo->LayerInfos.Num(); i++)
			{
				if (!LandscapeEdMode->UISettings->bApplyToAllTargets && i != TargetIndex)
				{
					continue;
				}
				FString SaveDialogTitle;
				FString DefaultFilename;
				FString FileTypes;

#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:77

Scope (from outer to inner):

file
function     ULandscapeEditorObject::ULandscapeEditorObject

Source code excerpt:


	, PasteMode(ELandscapeToolPasteMode::Both)
	, bApplyToAllTargets(true)
	, SnapMode(ELandscapeGizmoSnapType::None)
	, bSmoothGizmoBrush(true)

	, MirrorPoint(FVector::ZeroVector)
	, MirrorOp(ELandscapeMirrorOperation::MinusXToPlusX)

#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:323

Scope (from outer to inner):

file
function     void ULandscapeEditorObject::Load

Source code excerpt:

	//GConfig->GetBool(TEXT("LandscapeEdit"), TEXT("bUseSelectedRegion"), bUseSelectedRegion, GEditorPerProjectIni);
	//GConfig->GetBool(TEXT("LandscapeEdit"), TEXT("bUseNegativeMask"), bUseNegativeMask, GEditorPerProjectIni);
	bool InbApplyToAllTargets = bApplyToAllTargets;
	GConfig->GetBool(TEXT("LandscapeEdit"), TEXT("bApplyToAllTargets"), InbApplyToAllTargets, GEditorPerProjectIni);
	bApplyToAllTargets = InbApplyToAllTargets;

	GConfig->GetBool(TEXT("LandscapeEdit"), TEXT("ShowUnusedLayers"), ShowUnusedLayers, GEditorPerProjectIni);

	// Set EditRenderMode
	SetbUseSelectedRegion(bUseSelectedRegion);
	SetbUseNegativeMask(bUseNegativeMask);

#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:453

Scope (from outer to inner):

file
function     void ULandscapeEditorObject::Save

Source code excerpt:

	//GConfig->SetBool(TEXT("LandscapeEdit"), TEXT("bUseSelectedRegion"), bUseSelectedRegion, GEditorPerProjectIni);
	//GConfig->SetBool(TEXT("LandscapeEdit"), TEXT("bUseNegativeMask"), bUseNegativeMask, GEditorPerProjectIni);
	GConfig->SetBool(TEXT("LandscapeEdit"), TEXT("bApplyToAllTargets"), bApplyToAllTargets, GEditorPerProjectIni);

	const FString NewLandscapeMaterialName = (NewLandscape_Material != nullptr) ? NewLandscape_Material->GetPathName() : FString();
	GConfig->SetString(TEXT("LandscapeEdit"), TEXT("NewLandscapeMaterialName"), *NewLandscapeMaterialName, GEditorPerProjectIni);

	GConfig->SetInt(TEXT("LandscapeEdit"), TEXT("ImportLandscape_AlphamapType"), (uint8)ImportLandscape_AlphamapType, GEditorPerProjectIni);

#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Public/LandscapeEditorObject.h:456

Scope (from outer to inner):

file
class        class ULandscapeEditorObject : public UObject

Source code excerpt:

	// If set, copies/pastes all layers, otherwise only copy/pastes the layer selected in the targets panel
	UPROPERTY(Category="Tool Settings", EditAnywhere, NonTransactional, meta=(DisplayName="Gizmo copy/paste all layers", ShowForTools="CopyPaste"))
	bool bApplyToAllTargets;

	UPROPERTY(Category="Tool Settings", EditAnywhere, NonTransactional, meta=(DisplayName="Snap Gizmo to Landscape grid", ShowForTools="CopyPaste,ImportExport"))
	ELandscapeGizmoSnapType SnapMode;

	// Smooths the edges of the gizmo data into the landscape. Without this, the edges of the pasted data will be sharp
	UPROPERTY(Category="Tool Settings", EditAnywhere, NonTransactional, meta=(DisplayName="Use Smooth Gizmo Brush", ShowForTools="CopyPaste"))