CropPresets

CropPresets

#Overview

name: CropPresets

The value of this variable can be defined or overridden in .ini config files. 4 .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 CropPresets is to provide a configurable list of preset crop settings for cinematic cameras in Unreal Engine 5. This variable is part of the CinematicCamera module and is used to manage different crop configurations for camera plates.

The CinematicCamera module relies on this setting variable. It’s primarily used within the UCineCameraSettings class, which is a part of the cinematic camera system in Unreal Engine.

The value of this variable is set through the SetCropPresets function, which takes an array of FNamedPlateCropPreset structures. This function also saves the configuration, indicating that the presets are persistent across sessions.

CropPresets interacts with other variables and functions within the UCineCameraSettings class, such as LensPresets and FilmbackPresets. These presets work together to provide a comprehensive set of camera configuration options.

Developers must be aware that:

  1. CropPresets is a config property, meaning it can be modified in project settings.
  2. It’s exposed to Blueprints, allowing for runtime modifications.
  3. The presets are stored as an array of FNamedPlateCropPreset structures, each containing a name and associated crop settings.

Best practices when using this variable include:

  1. Providing meaningful names for each preset to make them easily identifiable.
  2. Ensuring that the preset list covers the most commonly used crop settings for your project.
  3. Using the GetCropPresetByName function to retrieve specific presets by name, rather than accessing the array directly.
  4. Considering performance implications when frequently accessing or modifying these presets, as they involve config operations.
  5. Utilizing the Blueprint-exposed functions for runtime modifications if needed, but being cautious about saving changes that might affect other parts of the project.

#Setting Variables

#References In INI files

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

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

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

Location: <Workspace>/Engine/Config/BaseEngine.ini:3355, 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:96

Scope (from outer to inner):

file
function     void UCineCameraSettings::SetCropPresets

Source code excerpt:

void UCineCameraSettings::SetCropPresets(const TArray<FNamedPlateCropPreset>& InCropPresets)
{
	CropPresets = InCropPresets;
	SaveConfig();
}

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

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

Scope (from outer to inner):

file
function     TArray<FNamedPlateCropPreset> const& UCineCameraSettings::GetCropPresets

Source code excerpt:

TArray<FNamedPlateCropPreset> const& UCineCameraSettings::GetCropPresets()
{
	return GetDefault<UCineCameraSettings>()->CropPresets;
}

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

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

Scope (from outer to inner):

file
function     bool UCineCameraSettings::GetCropPresetByName

Source code excerpt:

bool UCineCameraSettings::GetCropPresetByName(const FString PresetName, FPlateCropSettings& CropSettings)
{
	FNamedPlateCropPreset* NamedCropPreset = CropPresets.FindByPredicate([PresetName](const FNamedPlateCropPreset& Preset)
	{
		return Preset.Name == PresetName;
	});

	CropSettings = NamedCropPreset ? NamedCropPreset->CropSettings : FPlateCropSettings();
	return NamedCropPreset != nullptr;

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

Scope (from outer to inner):

file
function     TArray<FString> UCineCameraSettings::GetCropPresetNames

Source code excerpt:

{
	TArray<FString> CropPresetNames;
	for (const FNamedPlateCropPreset& CropPreset : CropPresets)
	{
		CropPresetNames.Emplace(CropPreset.Name);
	}

	return CropPresetNames;
}

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

Scope (from outer to inner):

file
class        class UCineCameraSettings : public UDeveloperSettings

Source code excerpt:

	/** List of available crop presets */
	UPROPERTY(config, EditAnywhere, BlueprintReadWrite, BlueprintSetter=SetCropPresets, Category=Crop, meta=(TitleProperty=Name))
	TArray<FNamedPlateCropPreset> CropPresets;

	static CINEMATICCAMERA_API TArray<FNamedLensPreset> const& GetLensPresets();
	static CINEMATICCAMERA_API TArray<FNamedFilmbackPreset> const& GetFilmbackPresets();
	static CINEMATICCAMERA_API TArray<FNamedPlateCropPreset> const& GetCropPresets();

	// Gets the Lens settings associated with a given preset name