LandscapeEditorControlType

LandscapeEditorControlType

#Overview

name: LandscapeEditorControlType

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 LandscapeEditorControlType is to define the control scheme for landscape editing tools in Unreal Engine 5. It determines how users interact with the landscape tools, specifically regarding the use of the Ctrl key.

This setting variable is primarily used in the Landscape Editor module of Unreal Engine. It’s referenced in the LandscapeEdMode class, which is part of the landscape editing system.

The value of this variable is set in the ULevelEditorViewportSettings class, which is part of the UnrealEd module. It’s defined as a configurable property, meaning it can be adjusted in the project settings.

LandscapeEditorControlType interacts with other variables and inputs, such as mouse button states, viewport status, and the Ctrl key state. It’s used in conjunction with these to determine when landscape editing tools should be activated or deactivated.

Developers should be aware that this variable can have three possible values:

  1. RequireCtrl: The Ctrl key must be pressed to use landscape tools.
  2. RequireNoCtrl: The Ctrl key must not be pressed to use landscape tools.
  3. IgnoreCtrl: The state of the Ctrl key is ignored for landscape tools.

Best practices when using this variable include:

  1. Consistently using the chosen control scheme throughout the project to maintain a coherent user experience.
  2. Communicating the chosen control scheme to all team members and documenting it for future reference.
  3. Considering the implications of the chosen control scheme on user workflow and efficiency.
  4. Testing the landscape editing experience with different control schemes to find the most suitable one for the project.
  5. Being aware that changing this setting might affect user muscle memory and require retraining for team members accustomed to a different control scheme.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:321, section: [/Script/UnrealEd.LevelEditorViewportSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdMode.cpp:792

Scope (from outer to inner):

file
function     void FEdModeLandscape::Tick

Source code excerpt:

	{
		// Require Ctrl or not as per user preference
		const ELandscapeFoliageEditorControlType LandscapeEditorControlType = GetDefault<ULevelEditorViewportSettings>()->LandscapeEditorControlType;

		if (!Viewport->KeyState(EKeys::LeftMouseButton) ||
			(LandscapeEditorControlType == ELandscapeFoliageEditorControlType::RequireCtrl && !IsCtrlDown(Viewport)))
		{
			// Don't end the current tool if we are just modifying it
			if (!IsAdjustingBrush(ViewportClient) && CurrentTool->IsToolActive())
			{
				CurrentTool->EndTool(ViewportClient);
				Viewport->CaptureMouse(false);

#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdMode.cpp:911

Scope (from outer to inner):

file
function     bool FEdModeLandscape::MouseMove

Source code excerpt:


		// Require Ctrl or not as per user preference
		const ELandscapeFoliageEditorControlType LandscapeEditorControlType = GetDefault<ULevelEditorViewportSettings>()->LandscapeEditorControlType;

		if (ToolActiveViewport != InViewport ||
			!InViewport->KeyState(EKeys::LeftMouseButton) ||
			(LandscapeEditorControlType == ELandscapeFoliageEditorControlType::RequireCtrl && !IsCtrlDown(InViewport)))
		{
			if (CurrentTool->IsToolActive())
			{
				CurrentTool->EndTool(InViewportClient);
			}
			InViewport->CaptureMouse(false);

#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdMode.cpp:1870

Scope (from outer to inner):

file
function     bool FEdModeLandscape::InputKey

Source code excerpt:


		// Require Ctrl or not as per user preference
		ELandscapeFoliageEditorControlType LandscapeEditorControlType = GetDefault<ULevelEditorViewportSettings>()->LandscapeEditorControlType;

		// HACK - Splines tool has not yet been updated to support not using ctrl
		if (CurrentBrush->GetBrushType() == ELandscapeBrushType::Splines)
		{
			LandscapeEditorControlType = ELandscapeFoliageEditorControlType::RequireCtrl;
		}

		// Special case to handle where user paint with Left Click then pressing a moving camera input, we do not want to process them so as long as the tool is active ignore other input
		if (CurrentTool != nullptr && CurrentTool->IsToolActive())
		{
			return true;

#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdMode.cpp:1900

Scope (from outer to inner):

file
function     bool FEdModeLandscape::InputKey

Source code excerpt:

			if ((Viewport->IsPenActive() && Viewport->GetTabletPressure() > 0.0f) ||
				(!bMovingCamera && ViewportClient->GetCurrentWidgetAxis() == EAxisList::None &&
					((LandscapeEditorControlType == ELandscapeFoliageEditorControlType::IgnoreCtrl) ||
					 (LandscapeEditorControlType == ELandscapeFoliageEditorControlType::RequireCtrl   && IsCtrlDown(Viewport)) ||
					 (LandscapeEditorControlType == ELandscapeFoliageEditorControlType::RequireNoCtrl && !IsCtrlDown(Viewport)))))
			{
				if (CurrentTool && (CurrentTool->GetSupportedTargetTypes() == ELandscapeToolTargetTypeMask::NA || CurrentToolTarget.TargetType != ELandscapeToolTargetType::Invalid))
				{
					FVector HitLocation;
					if (LandscapeMouseTrace(ViewportClient, HitLocation))
					{

#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdMode.cpp:1945

Scope (from outer to inner):

file
function     bool FEdModeLandscape::InputKey

Source code excerpt:


		if (Key == EKeys::LeftMouseButton ||
			(LandscapeEditorControlType == ELandscapeFoliageEditorControlType::RequireCtrl && (Key == EKeys::LeftControl || Key == EKeys::RightControl)))
		{
			if (Event == IE_Released && CurrentTool && CurrentTool->IsToolActive() && ToolActiveViewport)
			{
				//Set the cursor position to that of the slate cursor so it wont snap back
				Viewport->SetPreCaptureMousePosFromSlateCursor();
				CurrentTool->EndTool(ViewportClient);

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Settings/LevelEditorViewportSettings.h:283

Scope (from outer to inner):

file
class        class ULevelEditorViewportSettings : public UObject

Source code excerpt:

	/** Choose the control scheme for landscape tools (ignored for pen input) */
	UPROPERTY(EditAnywhere, config, Category=Controls)
	ELandscapeFoliageEditorControlType LandscapeEditorControlType;

	/** Choose the control scheme for foliage tools */
	UPROPERTY(EditAnywhere, config, Category=Controls)
	ELandscapeFoliageEditorControlType FoliageEditorControlType;

	/** If true, moves the canvas and shows the mouse.  If false, uses original camera movement. */