PasteMode

PasteMode

#Overview

name: PasteMode

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 12 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of PasteMode is to control the behavior of the paste operation in the Landscape Editor tool within Unreal Engine 5. Specifically, it determines how height data is applied when pasting landscape information.

This setting variable is primarily used in the Landscape Editor subsystem of Unreal Engine 5. It’s part of the LandscapeEditor module, which is responsible for editing and manipulating landscape terrains in the engine.

The value of this variable is set in several places:

  1. It’s initialized in the ULandscapeEditorObject constructor.
  2. It can be loaded from the project’s configuration file in the ULandscapeEditorObject::Load function.
  3. It can be set through the SetPasteMode function, which is likely called by the editor UI.

PasteMode interacts with other variables in the landscape editing process, particularly the height values of the landscape. It determines whether the pasted data will raise the terrain, lower it, or both.

Developers should be aware that:

  1. PasteMode is an enum (ELandscapeToolPasteMode) with at least three values: Raise, Lower, and Both.
  2. The setting affects how copied landscape data is applied to the target area.
  3. It’s part of the LandscapeEditorObject, which stores various settings for the Landscape Editor tool.

Best practices when using this variable include:

  1. Consider the intended result of the paste operation when choosing the PasteMode.
  2. Be aware that this setting can significantly affect the outcome of landscape editing operations.
  3. Ensure that the chosen PasteMode aligns with the overall landscape design goals.
  4. Remember that this setting is saved in the project configuration, so it persists between editor sessions.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:759, 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:1692

Scope (from outer to inner):

file
class        class FLandscapeToolStrokePaste : public FLandscapeToolStrokeBase
function     void Apply

Source code excerpt:

									);

								switch (EdMode->UISettings->PasteMode)
								{
								case ELandscapeToolPasteMode::Raise:
									PaintAmount = OriginalValue < DestValue ? PaintAmount : 0.0f;
									break;
								case ELandscapeToolPasteMode::Lower:
									PaintAmount = OriginalValue > DestValue ? PaintAmount : 0.0f;

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

Scope (from outer to inner):

file
function     ULandscapeEditorObject::ULandscapeEditorObject

Source code excerpt:

	, bUseNegativeMask(true)

	, 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:145

Scope (from outer to inner):

file
function     void ULandscapeEditorObject::PostEditChangeProperty

Source code excerpt:

	SetbUseSelectedRegion(bUseSelectedRegion);
	SetbUseNegativeMask(bUseNegativeMask);
	SetPasteMode(PasteMode);
	SetGizmoSnapMode(SnapMode);

	if (PropertyChangedEvent.MemberProperty == nullptr ||
		PropertyChangedEvent.MemberProperty->GetFName() == GET_MEMBER_NAME_CHECKED(ULandscapeEditorObject, AlphaTexture) ||
		PropertyChangedEvent.MemberProperty->GetFName() == GET_MEMBER_NAME_CHECKED(ULandscapeEditorObject, AlphaTextureChannel))
	{

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

Scope (from outer to inner):

file
function     void ULandscapeEditorObject::Load

Source code excerpt:


	int32 InPasteMode = (int32)ELandscapeToolPasteMode::Both;
	GConfig->GetInt(TEXT("LandscapeEdit"), TEXT("PasteMode"), InPasteMode, GEditorPerProjectIni);
	//PasteMode = (ELandscapeToolPasteMode)InPasteMode;
	SetPasteMode((ELandscapeToolPasteMode)InPasteMode);

	int32 InMirrorOp = (int32)ELandscapeMirrorOperation::MinusXToPlusX;
	GConfig->GetInt(TEXT("LandscapeEdit"), TEXT("MirrorOp"), InMirrorOp, GEditorPerProjectIni);
	MirrorOp = (ELandscapeMirrorOperation)InMirrorOp;

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

Scope (from outer to inner):

file
function     void ULandscapeEditorObject::Save

Source code excerpt:


	GConfig->SetBool(TEXT("LandscapeEdit"), TEXT("bSmoothGizmoBrush"), bSmoothGizmoBrush, GEditorPerProjectIni);
	GConfig->SetInt(TEXT("LandscapeEdit"), TEXT("PasteMode"), (int32)PasteMode, GEditorPerProjectIni);

	GConfig->SetInt(TEXT("LandscapeEdit"), TEXT("MirrorOp"), (int32)MirrorOp, GEditorPerProjectIni);

	GConfig->SetInt(TEXT("LandscapeEdit"), TEXT("ConvertMode"), (int32)ResizeLandscape_ConvertMode, GEditorPerProjectIni);
	//GConfig->SetBool(TEXT("LandscapeEdit"), TEXT("bUseSelectedRegion"), bUseSelectedRegion, GEditorPerProjectIni);
	//GConfig->SetBool(TEXT("LandscapeEdit"), TEXT("bUseNegativeMask"), bUseNegativeMask, GEditorPerProjectIni);

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

Scope (from outer to inner):

file
function     void ULandscapeEditorObject::SetPasteMode

Source code excerpt:

void ULandscapeEditorObject::SetPasteMode(ELandscapeToolPasteMode InPasteMode)
{
	PasteMode = InPasteMode;
}

void ULandscapeEditorObject::SetGizmoSnapMode(ELandscapeGizmoSnapType InSnapMode)
{
	SnapMode = InSnapMode;

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

Scope (from outer to inner):

file
class        class ULandscapeEditorObject : public UObject

Source code excerpt:

	// Whether to paste will only raise, only lower, or both
	UPROPERTY(Category="Tool Settings", EditAnywhere, NonTransactional, meta=(ShowForTools="CopyPaste"))
	ELandscapeToolPasteMode PasteMode;

	// 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"))

#Loc: <Workspace>/Engine/Source/Editor/Persona/Private/SAnimNotifyPanel.cpp:899

Scope (from outer to inner):

file
class        class SAnimNotifyTrack : public SCompoundWidget

Source code excerpt:


	/** Handler for context menu paste command */
	void OnPasteNotifyClicked(ENotifyPasteMode::Type PasteMode, ENotifyPasteMultipleMode::Type MultiplePasteType = ENotifyPasteMultipleMode::Absolute);

	/** Handler for popup window asking the user for a paste time */
	void OnPasteNotifyTimeSet(const FText& TimeText, ETextCommit::Type CommitInfo);

	/** Function to paste a previously copied notify */
	void OnPasteNotify(float TimeToPasteAt, ENotifyPasteMultipleMode::Type MultiplePasteType = ENotifyPasteMultipleMode::Absolute);

#Loc: <Workspace>/Engine/Source/Editor/Persona/Private/SAnimNotifyPanel.cpp:3258

Scope (from outer to inner):

file
function     void SAnimNotifyTrack::OnPasteNotifyClicked

Source code excerpt:

}

void SAnimNotifyTrack::OnPasteNotifyClicked(ENotifyPasteMode::Type PasteMode, ENotifyPasteMultipleMode::Type MultiplePasteType)
{
	float ClickTime = PasteMode == ENotifyPasteMode::MousePosition ? LastClickedTime : -1.0f;
	OnPasteNodes.ExecuteIfBound(this, ClickTime, PasteMode, MultiplePasteType);
}

void SAnimNotifyTrack::OnManageNotifies()
{
	OnInvokeTab.ExecuteIfBound(FPersonaTabs::SkeletonAnimNotifiesID);
}

#Loc: <Workspace>/Engine/Source/Editor/Persona/Private/SAnimNotifyPanel.cpp:4701

Scope (from outer to inner):

file
function     void SAnimNotifyPanel::OnPasteNodes

Source code excerpt:

}

void SAnimNotifyPanel::OnPasteNodes(SAnimNotifyTrack* RequestTrack, float ClickTime, ENotifyPasteMode::Type PasteMode, ENotifyPasteMultipleMode::Type MultiplePasteType)
{
	if(RequestTrack == nullptr)
	{
		for(TSharedPtr<SAnimNotifyTrack> Track : NotifyAnimTracks)
		{
			if(Track->HasKeyboardFocus())

#Loc: <Workspace>/Engine/Source/Editor/Persona/Private/SAnimNotifyPanel.cpp:4738

Scope (from outer to inner):

file
function     void SAnimNotifyPanel::OnPasteNodes

Source code excerpt:

		if(ClickTime == -1.0f)
		{
			if(PasteMode == ENotifyPasteMode::OriginalTime)
			{
				// We want to place the notifies exactly where they were
				ClickTime = OrigBeginTime;
			}
			else
			{

#Loc: <Workspace>/Engine/Source/Editor/Persona/Private/SAnimNotifyPanel.h:231

Scope (from outer to inner):

file
class        class SAnimNotifyPanel: public SAnimTrackPanel, public FEditorUndoClient

Source code excerpt:


	void CopySelectedNodesToClipboard() const;
	void OnPasteNodes(SAnimNotifyTrack* RequestTrack, float ClickTime, ENotifyPasteMode::Type PasteMode, ENotifyPasteMultipleMode::Type MultiplePasteType);

	/** Handler for properties changing on objects */
	FCoreUObjectDelegates::FOnObjectPropertyChanged::FDelegate OnPropertyChangedHandle;
	void OnPropertyChanged(UObject* ChangedObject, FPropertyChangedEvent& PropertyEvent);

	/** SWidget Interface */