SourceControl.LoginDialog.ForceModal

SourceControl.LoginDialog.ForceModal

#Overview

name: SourceControl.LoginDialog.ForceModal

This variable is created as a Console Variable (cvar).

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of SourceControl.LoginDialog.ForceModal is to control the behavior of the Source Control login dialog in Unreal Engine 5. Specifically, it determines whether the login dialog should always be displayed as a modal dialog.

This setting variable is primarily used by the Source Control subsystem within Unreal Engine 5. Based on the callsites, it is referenced in the SourceControl module, which is part of the Developer system.

The value of this variable is set through a console variable (CVar) system. It is initialized with a default value of false in the SourceControlCVars.cpp file.

The associated variable CVarSourceControlEnableLoginDialogModal interacts directly with SourceControl.LoginDialog.ForceModal. They share the same value and purpose.

Developers must be aware that when this variable is set to true, it will override any other settings or preferences for the login window mode, always forcing it to be modal. This can affect the user experience and workflow when interacting with source control operations.

Best practices when using this variable include:

  1. Use it judiciously, as forcing modal dialogs can interrupt user workflow.
  2. Consider the impact on team productivity when enabling this setting.
  3. Communicate changes to this setting to all team members, as it affects the source control interaction experience.

Regarding the associated variable CVarSourceControlEnableLoginDialogModal:

The purpose of CVarSourceControlEnableLoginDialogModal is the same as SourceControl.LoginDialog.ForceModal. It is the internal representation of the console variable in the C++ code.

This variable is used within the SourceControl module to determine the behavior of the login dialog. It’s defined in the SourceControlCVars namespace and is accessible throughout the SourceControl module.

The value of this variable is set through the console variable system and can be accessed at runtime using the GetValueOnAnyThread() method.

CVarSourceControlEnableLoginDialogModal interacts directly with the login dialog creation logic in the SourceControlModule.cpp file. When its value is true, it forces the LoginWindowMode to be Modal.

Developers should be aware that this variable’s value can be changed at runtime through the console, which can affect the behavior of the source control login process dynamically.

Best practices for using this variable include:

  1. Use it for debugging or specific workflow requirements.
  2. Be cautious when changing its value at runtime, as it may affect ongoing source control operations.
  3. Consider exposing this setting in a user-friendly manner if it’s something that needs to be configurable by end-users or team members.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Developer/SourceControl/Private/SourceControlCVars.cpp:23

Scope (from outer to inner):

file
namespace    SourceControlCVars

Source code excerpt:


	TAutoConsoleVariable<bool> CVarSourceControlEnableLoginDialogModal(
		TEXT("SourceControl.LoginDialog.ForceModal"),
		false,
		TEXT("Forces the SourceControl 'Login Dialog' to always be a modal dialog."),
		ECVF_Default);
}

#Associated Variable and Callsites

This variable is associated with another variable named CVarSourceControlEnableLoginDialogModal. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Developer/SourceControl/Private/SourceControlCVars.cpp:22

Scope (from outer to inner):

file
namespace    SourceControlCVars

Source code excerpt:

		ECVF_Default);

	TAutoConsoleVariable<bool> CVarSourceControlEnableLoginDialogModal(
		TEXT("SourceControl.LoginDialog.ForceModal"),
		false,
		TEXT("Forces the SourceControl 'Login Dialog' to always be a modal dialog."),
		ECVF_Default);
}

#Loc: <Workspace>/Engine/Source/Developer/SourceControl/Private/SourceControlCVars.h:10

Scope (from outer to inner):

file
namespace    SourceControlCVars

Source code excerpt:

	extern TAutoConsoleVariable<bool> CVarSourceControlEnableRevertFromSubmitWidget;
	extern TAutoConsoleVariable<bool> CVarSourceControlEnableRevertUnsaved;
	extern TAutoConsoleVariable<bool> CVarSourceControlEnableLoginDialogModal;
}

#Loc: <Workspace>/Engine/Source/Developer/SourceControl/Private/SourceControlModule.cpp:112

Scope (from outer to inner):

file
function     void FSourceControlModule::ShowLoginDialog

Source code excerpt:

	// if we are forcing a modal dialog, change the preference now
	ELoginWindowMode::Type LoginWindowMode = InLoginWindowMode;
	if(SourceControlCVars::CVarSourceControlEnableLoginDialogModal.GetValueOnAnyThread())
	{
		LoginWindowMode = ELoginWindowMode::Modal;
	}

	// if we are showing a modal version of the dialog & a modeless version already exists, we must destroy the modeless dialog first
	if(LoginWindowMode == ELoginWindowMode::Modal && SourceControlLoginPtr.IsValid())