ResolutionPresets

ResolutionPresets

#Overview

name: ResolutionPresets

The value of this variable can be defined or overridden in .ini config files. 6 .ini config files referencing this setting variable.

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of ResolutionPresets is to provide a set of predefined resolution quality settings for the game’s graphics scalability system. It allows developers to define and manage various resolution quality presets that players can choose from to adjust the game’s visual fidelity and performance.

This setting variable is primarily used by the Unreal Engine’s scalability system, which is part of the rendering module. It’s specifically utilized in the Editor’s scalability settings interface and the runtime scalability management.

The values for ResolutionPresets are set in the GScalabilityIni configuration file, under the [ResolutionQuality] section with the key “ResolutionPresets”.

ResolutionPresets interacts with other scalability-related variables, particularly CachedQualityLevels.ResolutionQuality, which stores the currently selected resolution quality setting.

Developers should be aware that:

  1. The presets are defined as an array of strings in the configuration file.
  2. Each preset consists of a name and a resolution quality value.
  3. The presets are used to populate UI elements in the editor’s scalability settings.
  4. Changes to these presets affect the options available to players for adjusting resolution quality.

Best practices when using this variable include:

  1. Providing a range of presets that cover various performance levels and visual qualities.
  2. Ensuring that preset names are clear and intuitive for users.
  3. Regularly testing and updating presets to match the capabilities of current hardware.
  4. Considering the impact of resolution quality on performance when defining presets.
  5. Documenting the effects of each preset for both developers and end-users.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseScalability.ini:40, section: [ResolutionQuality]

Location: <Workspace>/Engine/Config/BaseScalability.ini:42, section: [ResolutionQuality]

Location: <Workspace>/Engine/Config/BaseScalability.ini:44, section: [ResolutionQuality]

Location: <Workspace>/Engine/Config/BaseScalability.ini:46, section: [ResolutionQuality]

Location: <Workspace>/Engine/Config/BaseScalability.ini:48, section: [ResolutionQuality]

Location: <Workspace>/Engine/Config/BaseScalability.ini:50, section: [ResolutionQuality]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/SScalabilitySettings.cpp:105

Scope (from outer to inner):

file
function     FReply SScalabilitySettings::OnResolutionPresetClicked

Source code excerpt:

	}

	TArray<Scalability::FResolutionPreset> ResolutionPresets = Scalability::GetResolutionPresets();
	CachedQualityLevels.ResolutionQuality = ResolutionPresets[PresetId].ResolutionQuality;

	Scalability::SetQualityLevels(CachedQualityLevels);
	Scalability::SaveState(GEditorSettingsIni);
	GEditor->RedrawAllViewports();

	return FReply::Handled();

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/SScalabilitySettings.cpp:466

Scope (from outer to inner):

file
function     void SScalabilitySettings::Construct

Source code excerpt:

		};

		const TArray<Scalability::FResolutionPreset> ResolutionPresets = Scalability::GetResolutionPresets();

		TSharedRef<SGridPanel> ButtonMatrix =
			SNew(SGridPanel)
			.FillColumn(0, QualityColumnCoeff)

			+MakeGridSlot(0,0)

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/SScalabilitySettings.cpp:481

Scope (from outer to inner):

file
function     void SScalabilitySettings::Construct

Source code excerpt:

				})
			]
			+MakeGridSlot(1,0,ResolutionPresets.Num() - 1,1)
			[
				SNew(SSlider)
				.OnValueChanged(this, &SScalabilitySettings::OnResolutionScaleChanged)
				.Value(this, &SScalabilitySettings::GetResolutionScale)
				.IsEnabled_Lambda([]() {
					return true; // TODO: SScalabilitySettings::IsPlayInEditor(); but looks hugly
				})
			]
			+MakeGridSlot(ResolutionPresets.Num(),0)
			[
				SNew(STextBlock)
				.Text(this, &SScalabilitySettings::GetResolutionScaleString)
				.IsEnabled_Lambda([this]() {
					return SScalabilitySettings::IsResolutionScaleEditable() && CachedQualityLevels.ResolutionQuality >= Scalability::MinResolutionScale;
				})

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/SScalabilitySettings.cpp:500

Scope (from outer to inner):

file
function     void SScalabilitySettings::Construct

Source code excerpt:

			;

		for (int32 PresetId = 0; PresetId < ResolutionPresets.Num(); PresetId++)
		{
			const Scalability::FResolutionPreset& Preset = ResolutionPresets[PresetId];
			FText PresetText = FText::FromString(Preset.Name);

			ButtonMatrix->AddSlot(1 + PresetId, 1)
				.Padding(2.f)
			[
				MakePresetButton(PresetText, PresetId)

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scalability.cpp:638

Scope (from outer to inner):

file
namespace    Scalability
function     TArray<FResolutionPreset> GetResolutionPresets

Source code excerpt:

	TArray<FResolutionPreset> Presets;
	TArray<FString> AllPresetStrings;
	GConfig->GetArray(TEXT("ResolutionQuality"), TEXT("ResolutionPresets"), /* out */ AllPresetStrings, GScalabilityIni);
	for (FString PresetString : AllPresetStrings)
	{
		// Remove parentheses
		PresetString.TrimStartAndEndInline();
		PresetString.ReplaceInline(TEXT("("), TEXT(""));
		PresetString.ReplaceInline(TEXT(")"), TEXT(""));