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:
- DefaultFilmbackPreset, which is used to specify the default filmback settings
- GetLensPresetByName function, which retrieves a specific lens preset by its name
- GetLensPresetNames function, which returns an array of all preset names
Developers should be aware of the following when using this variable:
- It’s a configurable property, meaning it can be modified through project settings or configuration files.
- As of UE 5.1, this property has been moved from UCineCameraComponent to UCineCameraSettings, so older code references may need to be updated.
- 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:
- Utilize the provided functions (SetLensPresets, GetLensPresets, GetLensPresetByName) to interact with the presets rather than modifying the array directly.
- When adding new presets, ensure that each has a unique name to avoid conflicts.
- Consider the performance impact of having a large number of presets, especially if they are frequently accessed or modified during runtime.
- Use the BlueprintReadWrite and BlueprintSetter attributes to allow for easy modification of presets in Blueprints if needed.
- 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]
- INI Section:
/Script/CinematicCamera.CineCameraSettings
- Raw value:
(Name="12mm Prime f/2.8",LensSettings=(MinFocalLength=12,MaxFocalLength=12,MinFStop=2.8,MaxFStop=22,DiaphragmBladeCount=7))
- Is Array:
True
Location: <Workspace>/Engine/Config/BaseEngine.ini:3343, section: [/Script/CinematicCamera.CineCameraSettings]
- INI Section:
/Script/CinematicCamera.CineCameraSettings
- Raw value:
(Name="30mm Prime f/1.4",LensSettings=(MinFocalLength=30,MaxFocalLength=30,MinFStop=1.4,MaxFStop=22,DiaphragmBladeCount=7))
- Is Array:
True
Location: <Workspace>/Engine/Config/BaseEngine.ini:3344, section: [/Script/CinematicCamera.CineCameraSettings]
- INI Section:
/Script/CinematicCamera.CineCameraSettings
- Raw value:
(Name="50mm Prime f/1.8",LensSettings=(MinFocalLength=50,MaxFocalLength=50,MinFStop=1.8,MaxFStop=22,DiaphragmBladeCount=7))
- Is Array:
True
Location: <Workspace>/Engine/Config/BaseEngine.ini:3345, section: [/Script/CinematicCamera.CineCameraSettings]
- INI Section:
/Script/CinematicCamera.CineCameraSettings
- Raw value:
(Name="85mm Prime f/1.8",LensSettings=(MinFocalLength=85,MaxFocalLength=85,MinFStop=1.8,MaxFStop=22,DiaphragmBladeCount=7))
- Is Array:
True
Location: <Workspace>/Engine/Config/BaseEngine.ini:3346, section: [/Script/CinematicCamera.CineCameraSettings]
- INI Section:
/Script/CinematicCamera.CineCameraSettings
- Raw value:
(Name="105mm Prime f/2",LensSettings=(MinFocalLength=105,MaxFocalLength=105,MinFStop=2,MaxFStop=22,DiaphragmBladeCount=7))
- Is Array:
True
Location: <Workspace>/Engine/Config/BaseEngine.ini:3347, section: [/Script/CinematicCamera.CineCameraSettings]
- INI Section:
/Script/CinematicCamera.CineCameraSettings
- Raw value:
(Name="200mm Prime f/2",LensSettings=(MinFocalLength=200,MaxFocalLength=200,MinFStop=2,MaxFStop=22,DiaphragmBladeCount=7))
- Is Array:
True
Location: <Workspace>/Engine/Config/BaseEngine.ini:3348, section: [/Script/CinematicCamera.CineCameraSettings]
- INI Section:
/Script/CinematicCamera.CineCameraSettings
- Raw value:
(Name="24-70mm Zoom f/2.8",LensSettings=(MinFocalLength=24,MaxFocalLength=70,MinFStop=2.8,MaxFStop=22,DiaphragmBladeCount=7))
- Is Array:
True
Location: <Workspace>/Engine/Config/BaseEngine.ini:3349, section: [/Script/CinematicCamera.CineCameraSettings]
- INI Section:
/Script/CinematicCamera.CineCameraSettings
- Raw value:
(Name="70-200mm Zoom f/2.8",LensSettings=(MinFocalLength=70,MaxFocalLength=200,MinFStop=2.8,MaxFStop=22,DiaphragmBladeCount=7))
- Is Array:
True
Location: <Workspace>/Engine/Config/BaseEngine.ini:3350, section: [/Script/CinematicCamera.CineCameraSettings]
- INI Section:
/Script/CinematicCamera.CineCameraSettings
- Raw value:
(Name="Universal Zoom",LensSettings=(MinFocalLength=4,MaxFocalLength=1000,MinFStop=1.2,MaxFStop=22,DiaphragmBladeCount=7))
- Is Array:
True
#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 */