DefaultLensFocalLength

DefaultLensFocalLength

#Overview

name: DefaultLensFocalLength

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

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of DefaultLensFocalLength is to set the default focal length for cinematic cameras in Unreal Engine 5. This setting is primarily used within the Cinematic Camera system, which is part of the CinematicCamera module.

The CinematicCamera module relies on this setting variable, as evident from its usage in the UCineCameraComponent and UCineCameraSettings classes.

The value of this variable is set in the UCineCameraSettings class, which inherits from UDeveloperSettings. It can be modified through the engine’s configuration files or via Blueprint using the SetDefaultLensFocalLength function.

This variable interacts with other camera-related variables, such as DefaultLensFStop, which together define the default lens characteristics for cinematic cameras.

Developers must be aware that this variable has been moved from UCineCameraComponent to UCineCameraSettings in version 5.1, as indicated by the UE_DEPRECATED macro. They should use the new location in UCineCameraSettings for future development.

Best practices when using this variable include:

  1. Accessing it through the UCineCameraSettings object rather than directly.
  2. Using the provided BlueprintSetter (SetDefaultLensFocalLength) when modifying its value in Blueprints.
  3. Being mindful of the constraints imposed by the default lens when setting this value.
  4. Considering the impact on the camera’s field of view and depth of field when adjusting this value.
  5. Using it in conjunction with other camera settings for a cohesive cinematic look.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:3357, 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/CineCameraComponent.cpp:54

Scope (from outer to inner):

file
function     UCineCameraComponent::UCineCameraComponent

Source code excerpt:

	// other lens defaults
	CurrentAperture = CineCameraSettings->DefaultLensFStop;
	CurrentFocalLength = CineCameraSettings->DefaultLensFocalLength;


	RecalcDerivedData();

#if WITH_EDITORONLY_DATA
	if (!IsRunningCommandlet())

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

Scope (from outer to inner):

file
function     void UCineCameraSettings::SetDefaultLensFocalLength

Source code excerpt:

void UCineCameraSettings::SetDefaultLensFocalLength(const float InDefaultLensFocalLength)
{
	DefaultLensFocalLength = InDefaultLensFocalLength;
	SaveConfig();
}

void UCineCameraSettings::SetDefaultLensFStop(const float InDefaultLensFStop)
{
	DefaultLensFStop = InDefaultLensFStop;

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

Scope (from outer to inner):

file
function     void UCineCameraSettings::CopyOldConfigSettings

Source code excerpt:


	float OldDefaultLensFocalLength;
	if (GConfig->GetFloat(*CineCameraConfigSection, TEXT("DefaultLensFocalLength"), OldDefaultLensFocalLength, GEngineIni))
	{
		GConfig->SetFloat(*SettingsConfigSection, TEXT("DefaultLensFocalLength"), OldDefaultLensFocalLength, GEngineIni);
	}

	float OldDefaultLensFStop;
	if (GConfig->GetFloat(*CineCameraConfigSection, TEXT("DefaultLensFStop"), OldDefaultLensFStop, GEngineIni))
	{
		GConfig->SetFloat(*SettingsConfigSection, TEXT("DefaultLensFStop"), OldDefaultLensFStop, GEngineIni);

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

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)
	float DefaultLensFocalLength;
	
	/** Default aperture (will be constrained by default lens) */
	UE_DEPRECATED(5.1, "This property is now located on the UCineCameraSettings object")
	UPROPERTY(config)
	float DefaultLensFStop;

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

Scope (from outer to inner):

file
class        class UCineCameraSettings : public UDeveloperSettings

Source code excerpt:

	/** Default focal length (will be constrained by default lens) */
	UPROPERTY(config, EditAnywhere, BlueprintReadWrite, BlueprintSetter=SetDefaultLensFocalLength, Category=Lens)
	float DefaultLensFocalLength;
	
	/** Default aperture (will be constrained by default lens) */
	UPROPERTY(config, EditAnywhere, BlueprintReadWrite, BlueprintSetter=SetDefaultLensFStop, Category=Lens)
	float DefaultLensFStop;
	
	/** List of available lens presets */