bInvertMiddleMousePan

bInvertMiddleMousePan

#Overview

name: bInvertMiddleMousePan

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

#Summary

#Usage in the C++ source code

The purpose of bInvertMiddleMousePan is to control the direction of middle mouse panning in the Unreal Editor viewports. It allows users to invert the panning direction based on their preference.

This setting variable is primarily used by the Unreal Editor’s viewport system, specifically within the UnrealEd module. It affects the behavior of the viewport camera controls when using the middle mouse button for panning.

The value of this variable is set in the LevelEditorViewportSettings class, which is part of the editor’s configuration system. It is defined as a UPROPERTY with the EditAnywhere and config specifiers, allowing it to be edited in the editor’s settings menu and saved to configuration files.

This variable interacts with other viewport control settings, such as bInvertRightMouseDollyYAxis, which controls a similar inversion for right mouse dolly operations.

Developers should be aware that this setting affects the user experience in the editor, particularly for users who are accustomed to a specific panning direction. Changing this value may require users to adjust their muscle memory when navigating viewports.

Best practices when using this variable include:

  1. Providing clear documentation or UI indicators to users about the current panning direction.
  2. Considering user preferences and potentially offering this as a configurable option in the editor settings.
  3. Ensuring consistency with other navigation controls to maintain a coherent user experience.
  4. Testing viewport navigation thoroughly when making changes to this or related settings to ensure smooth and intuitive camera control.

#Setting Variables

#References In INI files

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

#References in C++ code

#Callsites

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

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

Scope (from outer to inner):

file
class        class ULevelEditorViewportSettings : public UObject

Source code excerpt:

	/** Whether or not to invert the direction of middle mouse panning in viewports */
	UPROPERTY(EditAnywhere, config, Category=Controls)
	bool bInvertMiddleMousePan;

	/** Whether or not to invert the direction of right mouse dolly on the Y axis in orbit mode */
	UPROPERTY(EditAnywhere, config, Category = Controls)
	bool bInvertRightMouseDollyYAxis;

	/** Whether to use mouse position as direct widget position. */

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorViewportClient.cpp:2574

Scope (from outer to inner):

file
function     void FEditorViewportClient::InputAxisForOrbit

Source code excerpt:

		else if ( IsOrbitPanMode( InViewport ) )
		{
			const bool bInvert = GetDefault<ULevelEditorViewportSettings>()->bInvertMiddleMousePan;

			const float CameraSpeed = GetCameraSpeed();
			Drag *= CameraSpeed * CameraSpeedDistanceScale;

			FVector DeltaLocation = bInvert ? FVector(Drag.X, 0, -Drag.Z ) : FVector(-Drag.X, 0, Drag.Z);

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorViewportClient.cpp:4923

Scope (from outer to inner):

file
function     void FEditorViewportClient::ConvertMovementToDragRot

Source code excerpt:

			{
				// Pan left/right/up/down
				const bool bInvert = !bIsUsingTrackpad && MiddleMouseButtonDown && GetDefault<ULevelEditorViewportSettings>()->bInvertMiddleMousePan;


				float Direction = bInvert ? 1 : -1;
				InDragDelta.X = InDelta.X * Direction * FMath::Sin( ViewRotation.Yaw * PI / 180.f );
				InDragDelta.Y = InDelta.X * -Direction * FMath::Cos( ViewRotation.Yaw * PI / 180.f );
				InDragDelta.Z = -Direction * InDelta.Y;