r.Editor.Viewport.OverridePIEScreenPercentage

r.Editor.Viewport.OverridePIEScreenPercentage

#Overview

name: r.Editor.Viewport.OverridePIEScreenPercentage

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

It is referenced in 9 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Editor.Viewport.OverridePIEScreenPercentage is to control whether the editor viewports’ default screen percentage settings should be applied to game viewport clients in Play-in-Editor (PIE) mode.

This setting variable is primarily used by the Unreal Editor’s viewport and rendering systems. It’s specifically relevant to the Play-in-Editor (PIE) functionality, which is a core feature of the Unreal Editor.

The value of this variable is set in multiple places:

  1. It’s initialized with a default value of 1 when the console variable is created.
  2. It can be modified through the Editor Performance Settings in the project settings.
  3. It’s also exposed as a console variable, so it can be changed at runtime through the console.

This variable interacts closely with the bOverridePIEScreenPercentage property in the UEditorPerformanceSettings class. They are essentially two representations of the same setting - one as a console variable and one as a UObject property.

Developers should be aware that:

  1. This setting affects the visual quality and performance of PIE sessions.
  2. Changing this setting might result in differences between how the game looks in the editor versus in a standalone build.

Best practices when using this variable include:

  1. Be consistent in its usage across the project to avoid unexpected visual discrepancies.
  2. Consider the performance implications, especially for lower-end target platforms.
  3. Use it in conjunction with other screen percentage and resolution settings for a comprehensive approach to visual quality and performance.

Regarding the associated variable CVarEditorViewportOverrideGameScreenPercentage:

This is the actual console variable implementation of the r.Editor.Viewport.OverridePIEScreenPercentage setting. It’s used internally by the engine to store and retrieve the current value of this setting.

The purpose and usage are the same as r.Editor.Viewport.OverridePIEScreenPercentage. It’s used in the FStaticResolutionFractionHeuristic::FUserSettings::EditorOverridePIESettings function to determine whether to override PIE settings.

This variable is set in the UEditorPerformanceSettings::PostInitProperties function based on the value of bOverridePIEScreenPercentage.

Developers should be aware that modifying this console variable directly will have the same effect as changing the setting through the editor UI. However, it’s generally recommended to use the provided UI or project settings to modify this value for better consistency and ease of configuration management.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


TAutoConsoleVariable<int32> CVarEditorViewportOverrideGameScreenPercentage(
	TEXT("r.Editor.Viewport.OverridePIEScreenPercentage"), 1,
	TEXT("Apply editor viewports' default screen percentage settings to game viewport clients in PIE."),
	ECVF_Default);

UEditorPerformanceSettings::UEditorPerformanceSettings(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
	, bShowFrameRateAndMemory(false)

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Editor/EditorPerformanceSettings.h:72

Scope (from outer to inner):

file
class        class UEditorPerformanceSettings : public UDeveloperSettings

Source code excerpt:

	UPROPERTY(EditAnywhere, config, Category=ViewportResolution, meta=(
		DisplayName="Override project's default screen percentage settings with editor viewports' settings in PIE",
		ConsoleVariable="r.Editor.Viewport.OverridePIEScreenPercentage"))
	uint32 bOverridePIEScreenPercentage : 1;

	UPROPERTY(EditAnywhere, config, Category=ViewportResolution, meta=(
		DisplayName="Override project's default screen percentage mode for realtime editor viewports using desktop renderer."))
	EEditorUserScreenPercentageModeOverride RealtimeScreenPercentageMode;
	

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LegacyScreenPercentageDriver.cpp:200

Scope (from outer to inner):

file
function     bool FStaticResolutionFractionHeuristic::FUserSettings::EditorOverridePIESettings

Source code excerpt:

	}

	static auto CVarEditorViewportOverrideGameScreenPercentage = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Editor.Viewport.OverridePIEScreenPercentage"));
	if (!CVarEditorViewportOverrideGameScreenPercentage)
	{
		return false;
	}

	return CVarEditorViewportOverrideGameScreenPercentage->GetInt() != 0;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorPerformanceSettings.cpp:8

Scope: file

Source code excerpt:

	ECVF_Default);

TAutoConsoleVariable<int32> CVarEditorViewportOverrideGameScreenPercentage(
	TEXT("r.Editor.Viewport.OverridePIEScreenPercentage"), 1,
	TEXT("Apply editor viewports' default screen percentage settings to game viewport clients in PIE."),
	ECVF_Default);

UEditorPerformanceSettings::UEditorPerformanceSettings(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorPerformanceSettings.cpp:42

Scope (from outer to inner):

file
function     void UEditorPerformanceSettings::PostInitProperties

Source code excerpt:


	CVarEditorViewportHighDPI->Set(bDisplayHighDPIViewports != 0, ECVF_SetByProjectSetting);
	CVarEditorViewportOverrideGameScreenPercentage->Set(bOverridePIEScreenPercentage != 0, ECVF_SetByProjectSetting);

	if (FProperty* EnableVSyncProperty = GetClass()->FindPropertyByName(GET_MEMBER_NAME_CHECKED(UEditorPerformanceSettings, bEnableVSync)))
	{
		ExportValuesToConsoleVariables(EnableVSyncProperty);
	}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LegacyScreenPercentageDriver.cpp:200

Scope (from outer to inner):

file
function     bool FStaticResolutionFractionHeuristic::FUserSettings::EditorOverridePIESettings

Source code excerpt:

	}

	static auto CVarEditorViewportOverrideGameScreenPercentage = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Editor.Viewport.OverridePIEScreenPercentage"));
	if (!CVarEditorViewportOverrideGameScreenPercentage)
	{
		return false;
	}

	return CVarEditorViewportOverrideGameScreenPercentage->GetInt() != 0;
}
#endif

void FStaticResolutionFractionHeuristic::FUserSettings::PullRunTimeRenderingSettings(EViewStatusForScreenPercentage ViewStatus)
{
	float GlobalResolutionFractionOverride = GetResolutionFraction(CVarScreenPercentage.GetValueOnGameThread());

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Editor/EditorPerformanceSettings.h:73

Scope (from outer to inner):

file
class        class UEditorPerformanceSettings : public UDeveloperSettings

Source code excerpt:

		DisplayName="Override project's default screen percentage settings with editor viewports' settings in PIE",
		ConsoleVariable="r.Editor.Viewport.OverridePIEScreenPercentage"))
	uint32 bOverridePIEScreenPercentage : 1;

	UPROPERTY(EditAnywhere, config, Category=ViewportResolution, meta=(
		DisplayName="Override project's default screen percentage mode for realtime editor viewports using desktop renderer."))
	EEditorUserScreenPercentageModeOverride RealtimeScreenPercentageMode;
	
	UPROPERTY(EditAnywhere, config, Category=ViewportResolution, meta=(

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorPerformanceSettings.cpp:21

Scope (from outer to inner):

file
function     UEditorPerformanceSettings::UEditorPerformanceSettings

Source code excerpt:

	, bEnableScalabilityWarningIndicator(true)
	, bDisplayHighDPIViewports(true)
	, bOverridePIEScreenPercentage(true)
	, RealtimeScreenPercentageMode(EEditorUserScreenPercentageModeOverride::ProjectDefault)
	, MobileScreenPercentageMode(EEditorUserScreenPercentageModeOverride::ProjectDefault)
	, VRScreenPercentageMode(EEditorUserScreenPercentageModeOverride::ProjectDefault)
	, PathTracerScreenPercentageMode(EEditorUserScreenPercentageModeOverride::ProjectDefault)
	, NonRealtimeScreenPercentageMode(EEditorUserScreenPercentageModeOverride::ProjectDefault)
	, bOverrideManualScreenPercentage(false)

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorPerformanceSettings.cpp:42

Scope (from outer to inner):

file
function     void UEditorPerformanceSettings::PostInitProperties

Source code excerpt:


	CVarEditorViewportHighDPI->Set(bDisplayHighDPIViewports != 0, ECVF_SetByProjectSetting);
	CVarEditorViewportOverrideGameScreenPercentage->Set(bOverridePIEScreenPercentage != 0, ECVF_SetByProjectSetting);

	if (FProperty* EnableVSyncProperty = GetClass()->FindPropertyByName(GET_MEMBER_NAME_CHECKED(UEditorPerformanceSettings, bEnableVSync)))
	{
		ExportValuesToConsoleVariables(EnableVSyncProperty);
	}