r.Editor.NeverStartInPreviewMode

r.Editor.NeverStartInPreviewMode

#Overview

name: r.Editor.NeverStartInPreviewMode

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 r.Editor.NeverStartInPreviewMode is to control whether the Unreal Editor can start in preview mode or not. It is primarily used in the editor’s startup process and affects how the editor initializes its rendering settings.

This setting variable is primarily used in the UnrealEd module, specifically within the EditorPerProjectUserSettings system. It influences the editor’s behavior regarding preview feature levels and shader platforms.

The value of this variable is set as a console variable (CVar) with a default value of 0. It can be modified through the console or configuration files.

The associated variable CVarNeverStartInPreviewMode interacts directly with r.Editor.NeverStartInPreviewMode. They share the same value and purpose.

Developers must be aware that:

  1. When set to 1, it forces the editor to never start in preview mode, regardless of other settings.
  2. It affects the PreviewFeatureLevel, PreviewShaderPlatformName, and PreviewShaderFormatName settings.
  3. It’s checked during the PostInitProperties phase of UEditorPerProjectUserSettings.

Best practices when using this variable include:

  1. Use it judiciously, as it can affect the editor’s ability to preview certain features or platforms.
  2. Consider the implications on workflow when enabling or disabling this feature, especially in team environments.
  3. Document any changes to this setting in project configuration files to ensure consistency across the development team.

Regarding the associated variable CVarNeverStartInPreviewMode:

The purpose of CVarNeverStartInPreviewMode is to provide a programmatic interface to the r.Editor.NeverStartInPreviewMode setting. It’s an instance of TAutoConsoleVariable, which allows for runtime modification and querying of the setting.

This variable is used in the same UnrealEd module and EditorPerProjectUserSettings system as r.Editor.NeverStartInPreviewMode.

The value of CVarNeverStartInPreviewMode is set when it’s declared, mirroring the value of r.Editor.NeverStartInPreviewMode.

CVarNeverStartInPreviewMode interacts directly with the editor’s initialization process, particularly in determining whether to use preview feature levels and shader platforms.

Developers should be aware that:

  1. Changes to CVarNeverStartInPreviewMode will immediately affect the editor’s behavior.
  2. It’s queried using GetValueOnAnyThread(), which suggests it can be accessed from multiple threads.

Best practices for using CVarNeverStartInPreviewMode include:

  1. Use it for runtime queries of the setting rather than directly accessing r.Editor.NeverStartInPreviewMode.
  2. Consider thread safety when accessing this variable, as it’s designed to be queried from any thread.
  3. If modifying this variable at runtime, ensure that all systems depending on preview modes are properly updated or notified.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Settings/EditorPerProjectUserSettings.cpp:10

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarNeverStartInPreviewMode(
	TEXT("r.Editor.NeverStartInPreviewMode"),
	0,
	TEXT("0: Editor can start in preview mode, 1: Editor never starts in preview mode"),
	ECVF_Default);

/// @cond DOXYGEN_WARNINGS

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Settings/EditorPerProjectUserSettings.cpp:47

Scope (from outer to inner):

file
function     void UEditorPerProjectUserSettings::PostInitProperties

Source code excerpt:

	Super::PostInitProperties();

	// if we last saved as the default or we somehow are loading a preview feature level higher than we can support or we explictly disabled it with r.Editor.NeverStartInPreviewMode,
	// fall back to the current session's maximum feature level
	if (bPreviewFeatureLevelWasDefault || PreviewFeatureLevel > GMaxRHIFeatureLevel || (CVarNeverStartInPreviewMode.GetValueOnAnyThread() != 0))
	{
		PreviewFeatureLevel = GMaxRHIFeatureLevel;
		PreviewShaderPlatformName = NAME_None;
		PreviewShaderFormatName = NAME_None;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Settings/EditorPerProjectUserSettings.cpp:9

Scope: file

Source code excerpt:

#define LOCTEXT_NAMESPACE "EditorPerProjectUserSettings"

static TAutoConsoleVariable<int32> CVarNeverStartInPreviewMode(
	TEXT("r.Editor.NeverStartInPreviewMode"),
	0,
	TEXT("0: Editor can start in preview mode, 1: Editor never starts in preview mode"),
	ECVF_Default);

/// @cond DOXYGEN_WARNINGS

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Settings/EditorPerProjectUserSettings.cpp:49

Scope (from outer to inner):

file
function     void UEditorPerProjectUserSettings::PostInitProperties

Source code excerpt:

	// if we last saved as the default or we somehow are loading a preview feature level higher than we can support or we explictly disabled it with r.Editor.NeverStartInPreviewMode,
	// fall back to the current session's maximum feature level
	if (bPreviewFeatureLevelWasDefault || PreviewFeatureLevel > GMaxRHIFeatureLevel || (CVarNeverStartInPreviewMode.GetValueOnAnyThread() != 0))
	{
		PreviewFeatureLevel = GMaxRHIFeatureLevel;
		PreviewShaderPlatformName = NAME_None;
		PreviewShaderFormatName = NAME_None;
        PreviewPlatformName = NAME_None;
		bPreviewFeatureLevelActive = false;