LensPresets

LensPresets

#Overview

name: LensPresets

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

It is referenced in 8 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of LensPresets is to store a collection of predefined lens settings for cinematic cameras in Unreal Engine 5. It is used within the CinematicCamera module to provide a set of commonly used lens configurations that can be easily applied to camera components in a project.

This setting variable is primarily used by the CinematicCamera module, which is part of Unreal Engine’s runtime system for handling advanced camera functionality in cinematic scenes.

The value of this variable is set through the UCineCameraSettings::SetLensPresets function, which takes an array of FNamedLensPreset structures as input. This function also saves the configuration, indicating that the presets can be persistent across sessions.

LensPresets interacts with other variables and functions within the CinematicCamera module, such as:

Developers should be aware of the following when using this variable:

  1. It’s a configurable property, meaning it can be modified through project settings or configuration files.
  2. As of UE 5.1, this property has been moved from UCineCameraComponent to UCineCameraSettings, so older code references may need to be updated.
  3. The presets are stored as an array of FNamedLensPreset structures, each containing a name and associated lens settings.

Best practices for using this variable include:

  1. Utilize the provided functions (SetLensPresets, GetLensPresets, GetLensPresetByName) to interact with the presets rather than modifying the array directly.
  2. When adding new presets, ensure that each has a unique name to avoid conflicts.
  3. Consider the performance impact of having a large number of presets, especially if they are frequently accessed or modified during runtime.
  4. Use the BlueprintReadWrite and BlueprintSetter attributes to allow for easy modification of presets in Blueprints if needed.
  5. When migrating projects from earlier versions of Unreal Engine, update any references to the deprecated LensPresets property in UCineCameraComponent to use the new UCineCameraSettings object instead.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:3342, section: [/Script/CinematicCamera.CineCameraSettings]

Location: <Workspace>/Engine/Config/BaseEngine.ini:3343, section: [/Script/CinematicCamera.CineCameraSettings]

Location: <Workspace>/Engine/Config/BaseEngine.ini:3344, section: [/Script/CinematicCamera.CineCameraSettings]

Location: <Workspace>/Engine/Config/BaseEngine.ini:3345, section: [/Script/CinematicCamera.CineCameraSettings]

Location: <Workspace>/Engine/Config/BaseEngine.ini:3346, section: [/Script/CinematicCamera.CineCameraSettings]

Location: <Workspace>/Engine/Config/BaseEngine.ini:3347, section: [/Script/CinematicCamera.CineCameraSettings]

Location: <Workspace>/Engine/Config/BaseEngine.ini:3348, section: [/Script/CinematicCamera.CineCameraSettings]

Location: <Workspace>/Engine/Config/BaseEngine.ini:3349, section: [/Script/CinematicCamera.CineCameraSettings]

Location: <Workspace>/Engine/Config/BaseEngine.ini:3350, section: [/Script/CinematicCamera.CineCameraSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/CinematicCamera/Private/CineCameraSettings.cpp:71

Scope (from outer to inner):

file
function     void UCineCameraSettings::SetLensPresets

Source code excerpt:

void UCineCameraSettings::SetLensPresets(const TArray<FNamedLensPreset>& InLensPresets)
{
	LensPresets = InLensPresets;
	SaveConfig();
}

void UCineCameraSettings::SetDefaultFilmbackPreset(const FString InDefaultFilmbackPreset)
{
	DefaultFilmbackPreset = InDefaultFilmbackPreset;

#Loc: <Workspace>/Engine/Source/Runtime/CinematicCamera/Private/CineCameraSettings.cpp:102

Scope (from outer to inner):

file
function     TArray<FNamedLensPreset> const& UCineCameraSettings::GetLensPresets

Source code excerpt:

TArray<FNamedLensPreset> const& UCineCameraSettings::GetLensPresets()
{
	return GetDefault<UCineCameraSettings>()->LensPresets;
}

TArray<FNamedFilmbackPreset> const& UCineCameraSettings::GetFilmbackPresets()
{
	return GetDefault<UCineCameraSettings>()->FilmbackPresets;
}

#Loc: <Workspace>/Engine/Source/Runtime/CinematicCamera/Private/CineCameraSettings.cpp:117

Scope (from outer to inner):

file
function     bool UCineCameraSettings::GetLensPresetByName

Source code excerpt:

bool UCineCameraSettings::GetLensPresetByName(const FString PresetName, FCameraLensSettings& LensSettings)
{
	FNamedLensPreset* NamedLensPreset = LensPresets.FindByPredicate([PresetName](const FNamedLensPreset& Preset)
	{
		return Preset.Name == PresetName;
	});

	LensSettings = NamedLensPreset ? NamedLensPreset->LensSettings : FCameraLensSettings();
	return NamedLensPreset != nullptr;

#Loc: <Workspace>/Engine/Source/Runtime/CinematicCamera/Private/CineCameraSettings.cpp:156

Scope (from outer to inner):

file
function     TArray<FString> UCineCameraSettings::GetLensPresetNames

Source code excerpt:

{
	TArray<FString> LensPresetNames;
	for (const FNamedLensPreset& LensPreset : LensPresets)
	{
		LensPresetNames.Emplace(LensPreset.Name);
	}

	return LensPresetNames;
}

#Loc: <Workspace>/Engine/Source/Runtime/CinematicCamera/Private/CineCameraSettings.cpp:232

Scope (from outer to inner):

file
function     void UCineCameraSettings::CopyOldConfigSettings

Source code excerpt:


	TArray<FString> OldLensPresets;
	if (GConfig->GetArray(*CineCameraConfigSection, TEXT("LensPresets"), OldLensPresets, GEngineIni))
	{
		TArray<FString> CurrentLensPresets;
		GConfig->GetArray(*SettingsConfigSection, TEXT("LensPresets"), CurrentLensPresets, GEngineIni);
		for (const FString& OldLensPreset : OldLensPresets)
		{
			// If a preset already exists with that name then update it with the old value
			// otherwise add the preset to the list
			FString PresetName, PresetValue;
			OldLensPreset.Split(",", &PresetName, &PresetValue);

#Loc: <Workspace>/Engine/Source/Runtime/CinematicCamera/Private/CineCameraSettings.cpp:251

Scope (from outer to inner):

file
function     void UCineCameraSettings::CopyOldConfigSettings

Source code excerpt:

			}
		}
		GConfig->SetArray(*SettingsConfigSection, TEXT("LensPresets"), CurrentLensPresets, GEngineIni);
	}

	FString OldDefaultFilmbackPreset;
	if (GConfig->GetString(*CineCameraConfigSection, TEXT("DefaultFilmbackPreset"), OldDefaultFilmbackPreset, GEngineIni))
	{
		GConfig->SetString(*SettingsConfigSection, TEXT("DefaultFilmbackPreset"), *OldDefaultFilmbackPreset, GEngineIni);

#Loc: <Workspace>/Engine/Source/Runtime/CinematicCamera/Public/CineCameraComponent.h:214

Scope (from outer to inner):

file
class        class UCineCameraComponent : public UCameraComponent

Source code excerpt:

	UE_DEPRECATED(5.1, "This property is now located on the UCineCameraSettings object")
	UPROPERTY(config)
	TArray<FNamedLensPreset> LensPresets;

	/** Deprecated. See DefaultFilmbackPreset */
	UE_DEPRECATED(5.1, "This property has been removed and fully replaced by DefaultFilmbackPreset on the UCineCameraSettings object")
	UPROPERTY(config)
	FString DefaultFilmbackPresetName_DEPRECATED;

#Loc: <Workspace>/Engine/Source/Runtime/CinematicCamera/Public/CineCameraSettings.h:293

Scope (from outer to inner):

file
class        class UCineCameraSettings : public UDeveloperSettings

Source code excerpt:

	/** List of available lens presets */
	UPROPERTY(config, EditAnywhere, BlueprintReadWrite, BlueprintSetter=SetLensPresets, Category=Lens, meta=(TitleProperty=Name))
	TArray<FNamedLensPreset> LensPresets;

	/** Name of the default filmback preset */
	UPROPERTY(config, EditAnywhere, BlueprintReadWrite, BlueprintSetter=SetDefaultfilmbackPreset, Category=Filmback, meta=(GetOptions=GetFilmbackPresetNames))
	FString DefaultFilmbackPreset;

	/** List of available filmback presets */