FoliageEditorControlType

FoliageEditorControlType

#Overview

name: FoliageEditorControlType

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

#Summary

#Usage in the C++ source code

The purpose of FoliageEditorControlType is to control the behavior of the foliage editing tools in the Unreal Engine editor, specifically how they respond to user input.

This setting variable is primarily used in the Foliage Edit module of Unreal Engine, as evidenced by its references in the FoliageEdMode.cpp file. It’s part of the editor’s viewport settings, which suggests it’s crucial for the editor’s user interface and interaction system.

The value of this variable is set in the LevelEditorViewportSettings class, which is likely configurable through the editor’s settings menu. It’s defined as an UPROPERTY, making it accessible and modifiable through the Unreal Engine property system.

FoliageEditorControlType interacts with other input-related variables and functions, such as IsCtrlDown() and IsAltDown(), to determine how the foliage editing tools should respond to user input.

Developers must be aware that this variable affects how the foliage editing tools interpret mouse and keyboard input. It can be set to one of three modes: IgnoreCtrl, RequireCtrl, or RequireNoCtrl, which changes how the Ctrl key is used in foliage editing.

Best practices when using this variable include:

  1. Ensuring consistency across team members by agreeing on a standard setting.
  2. Documenting the chosen setting in the project guidelines to avoid confusion.
  3. Consider user preferences and ergonomics when choosing the setting.
  4. Be aware of how this setting might interact with other editor controls or shortcuts to avoid conflicts.
  5. Test foliage editing workflows thoroughly after changing this setting to ensure it doesn’t disrupt established workflows.

#Setting Variables

#References In INI files

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

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/FoliageEdit/Private/FoliageEdMode.cpp:3706

Scope (from outer to inner):

file
function     bool FEdModeFoliage::InputKey

Source code excerpt:

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

		if (Key == EKeys::LeftMouseButton && Event == IE_Pressed)
		{
			// Only activate tool if we're not already moving the camera and we're not trying to drag a transform widget
			// Not using "if (!ViewportClient->IsMovingCamera())" because it's wrong in ortho viewports :D
			bool bMovingCamera = Viewport->KeyState(EKeys::MiddleMouseButton) || Viewport->KeyState(EKeys::RightMouseButton) || IsAltDown(Viewport);

#Loc: <Workspace>/Engine/Source/Editor/FoliageEdit/Private/FoliageEdMode.cpp:3716

Scope (from outer to inner):

file
function     bool FEdModeFoliage::InputKey

Source code excerpt:

			if ((Viewport->IsPenActive() && Viewport->GetTabletPressure() > 0.f) ||
				(!bMovingCamera && ViewportClient->GetCurrentWidgetAxis() == EAxisList::None &&
					(FoliageEditorControlType == ELandscapeFoliageEditorControlType::IgnoreCtrl ||
						(FoliageEditorControlType == ELandscapeFoliageEditorControlType::RequireCtrl   && IsCtrlDown(Viewport)) ||
						(FoliageEditorControlType == ELandscapeFoliageEditorControlType::RequireNoCtrl && !IsCtrlDown(Viewport)))))
			{
				if (!bToolActive)
				{
					StartFoliageBrushTrace(ViewportClient);

					bHandled = true;

#Loc: <Workspace>/Engine/Source/Editor/FoliageEdit/Private/FoliageEdMode.cpp:3729

Scope (from outer to inner):

file
function     bool FEdModeFoliage::InputKey

Source code excerpt:

		}
		else if (bToolActive && Event == IE_Released &&
			(Key == EKeys::LeftMouseButton || (FoliageEditorControlType == ELandscapeFoliageEditorControlType::RequireCtrl && (Key == EKeys::LeftControl || Key == EKeys::RightControl))))
		{
			//Set the cursor position to that of the slate cursor so it wont snap back
			Viewport->SetPreCaptureMousePosFromSlateCursor();
			EndFoliageBrushTrace();

			bHandled = true;

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

Scope (from outer to inner):

file
class        class ULevelEditorViewportSettings : public UObject

Source code excerpt:

	/** 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. */
	UPROPERTY(EditAnywhere, config, Category=Controls, meta=(DisplayName = "Grab and Drag to Move Orthographic Cameras"), AdvancedDisplay)
	uint32 bPanMovesCanvas:1;

	/** If checked, in orthographic view ports zooming will center on the mouse position.  If unchecked, the zoom is around the center of the viewport. */