UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
CineCameraSettings.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
7#include "Engine/Scene.h"
9#include "CineCameraSettings.generated.h"
10
12
14USTRUCT(BlueprintType)
16{
18
19
20 UPROPERTY(Interp, EditAnywhere, BlueprintReadWrite, Category = "Filmback", meta = (ClampMin = "0.001", ForceUnits = mm))
21 float SensorWidth;
22
24 UPROPERTY(Interp, EditAnywhere, BlueprintReadWrite, Category = "Filmback", meta = (ClampMin = "0.001", ForceUnits = mm))
25 float SensorHeight;
26
28 UPROPERTY(Interp, EditAnywhere, BlueprintReadWrite, Category = "Filmback", meta = (ForceUnits = mm))
29 float SensorHorizontalOffset;
30
32 UPROPERTY(Interp, EditAnywhere, BlueprintReadWrite, Category = "Filmback", meta = (ForceUnits = mm))
33 float SensorVerticalOffset;
34
36 UPROPERTY(Interp, VisibleAnywhere, BlueprintReadOnly, Category = "Filmback")
37 float SensorAspectRatio;
38
39 bool operator==(const FCameraFilmbackSettings& Other) const
40 {
41 return (SensorWidth == Other.SensorWidth)
42 && (SensorHeight == Other.SensorHeight)
43 && (SensorHorizontalOffset == Other.SensorHorizontalOffset)
44 && (SensorVerticalOffset == Other.SensorVerticalOffset);
45 }
46
48 {
49 return !operator==(Other);
50 }
51
53 {
54 SensorAspectRatio = (SensorHeight > 0.f) ? (SensorWidth / SensorHeight) : 0.f;
55 }
56
58 : SensorWidth(24.89f)
59 , SensorHeight(18.67f)
60 , SensorHorizontalOffset(0.0f)
61 , SensorVerticalOffset(0.0f)
62 , SensorAspectRatio(1.33f)
63 {
64 }
65};
66
68USTRUCT(BlueprintType)
70{
72
73
74 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Filmback")
75 FString Name;
76
78 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Filmback")
79 FText DisplayName;
80
81 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Filmback")
82 FCameraFilmbackSettings FilmbackSettings;
83};
84
88USTRUCT(BlueprintType)
90{
92
93
95 : MinFocalLength(50.f)
96 , MaxFocalLength(50.f)
97 , MinFStop(2.f)
98 , MaxFStop(2.f)
99 , MinimumFocusDistance(15.f)
100 , DiaphragmBladeCount(FPostProcessSettings::kDefaultDepthOfFieldBladeCount)
101 {
102 }
103
105 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Lens", meta = (ForceUnits = mm, ClampMin = "0.001"))
106 float MinFocalLength = 0.f;
107
109 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Lens", meta = (ForceUnits = mm, ClampMin = "0.001"))
110 float MaxFocalLength = 0.f;
111
113 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Lens")
114 float MinFStop = 0.f;
115
117 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Lens")
118 float MaxFStop = 0.f;
119
121 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Lens", meta = (ForceUnits = mm))
122 float MinimumFocusDistance = 0.f;
123
125 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Lens", meta = (ClampMin = "1", ClampMax = "2"))
126 float SqueezeFactor = 1.f;
127
129 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Lens", meta = (ClampMin = "4", ClampMax = "16"))
130 int32 DiaphragmBladeCount = 0;
131
132 bool operator==(const FCameraLensSettings& Other) const
133 {
134 return (MinFocalLength == Other.MinFocalLength)
135 && (MaxFocalLength == Other.MaxFocalLength)
136 && (MinFStop == Other.MinFStop)
137 && (MaxFStop == Other.MaxFStop)
138 && (MinimumFocusDistance == Other.MinimumFocusDistance)
139 && (SqueezeFactor == Other.SqueezeFactor)
140 && (DiaphragmBladeCount == Other.DiaphragmBladeCount);
141 }
142};
143
145USTRUCT(BlueprintType)
147{
149
150
151 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Lens")
152 FString Name;
153
154 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Lens")
156};
157
161USTRUCT(BlueprintType)
163{
165
166 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Crop", meta=(DisplayName = "Cropped Aspect Ratio"))
167 float AspectRatio = 0.f;
168
169 bool operator==(const FPlateCropSettings& Other) const
170 {
171 return (AspectRatio == Other.AspectRatio);
172 }
173};
174
176USTRUCT(BlueprintType)
178{
180
181
182 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Crop")
183 FString Name;
184
185 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Crop")
186 FPlateCropSettings CropSettings;
187};
188
190UENUM()
192{
195
197 Manual,
198
200 Tracking,
201
203 Disable,
204
206};
207
209USTRUCT(BlueprintType)
211{
213
214
215 UPROPERTY(Interp, EditAnywhere, BlueprintReadWrite, Category = "Tracking Focus")
216 TSoftObjectPtr<AActor> ActorToTrack;
217
219 UPROPERTY(Interp, EditAnywhere, BlueprintReadWrite, Category = "Tracking Focus")
220 FVector RelativeOffset;
221
223 UPROPERTY(Transient, EditAnywhere, BlueprintReadWrite, Category = "Tracking Focus")
224 uint8 bDrawDebugTrackingFocusPoint : 1;
225
227 : RelativeOffset(ForceInitToZero),
228 bDrawDebugTrackingFocusPoint(false)
229 {}
230};
231
233USTRUCT(BlueprintType)
235{
237
238
239 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Focus Method")
241
243 UPROPERTY(Interp, EditAnywhere, BlueprintReadWrite, Category = "Manual Focus Settings", meta=(Units=cm))
244 float ManualFocusDistance;
245
247 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Tracking Focus Settings")
248 FCameraTrackingFocusSettings TrackingFocusSettings;
249
250#if WITH_EDITORONLY_DATA
252 UPROPERTY(Transient, EditAnywhere, Category = "Focus Settings")
254
256 UPROPERTY(EditAnywhere, Category = "Focus Settings", meta = (EditCondition = "bDrawDebugFocusPlane"))
258#endif
259
261 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Focus Settings")
262 uint8 bSmoothFocusChanges : 1;
263
265 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Focus Settings")
266 float FocusSmoothingInterpSpeed;
267
269 UPROPERTY(Interp, EditAnywhere, BlueprintReadWrite, Category = "Focus Settings")
270 float FocusOffset;
271
273 FocusMethod(ECameraFocusMethod::Manual),
274 ManualFocusDistance(100000.f),
275 TrackingFocusSettings(),
276#if WITH_EDITORONLY_DATA
278 DebugFocusPlaneColor(102, 26, 204, 153), // purple
279#endif
280 bSmoothFocusChanges(false),
281 FocusSmoothingInterpSpeed(8.f),
282 FocusOffset(0.f)
283 {}
284};
285
287UENUM()
289{
292
294 Enabled,
295
297};
298
299UCLASS(config=Engine, defaultconfig, meta=(DisplayName="Cinematic Camera"), MinimalAPI)
301{
303
304public:
305 CINEMATICCAMERA_API virtual void PostInitProperties() override;
306
307#if WITH_EDITOR
308 CINEMATICCAMERA_API virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
309#endif
310
312 UPROPERTY(config, EditAnywhere, BlueprintReadWrite, BlueprintSetter=SetDefaultLensPresetName, Category=Lens, meta=(GetOptions=GetLensPresetNames))
313 FString DefaultLensPresetName;
314
316 UPROPERTY(config, EditAnywhere, BlueprintReadWrite, BlueprintSetter=SetDefaultLensFocalLength, Category=Lens)
317 float DefaultLensFocalLength;
318
320 UPROPERTY(config, EditAnywhere, BlueprintReadWrite, BlueprintSetter=SetDefaultLensFStop, Category=Lens)
321 float DefaultLensFStop;
322
324 UPROPERTY(config, EditAnywhere, BlueprintReadWrite, BlueprintSetter=SetLensPresets, Category=Lens, meta=(TitleProperty=Name))
326
328 UPROPERTY(config, EditAnywhere, BlueprintReadWrite, BlueprintSetter=SetDefaultfilmbackPreset, Category=Filmback, meta=(GetOptions=GetFilmbackPresetNames))
329 FString DefaultFilmbackPreset;
330
332 UPROPERTY(config, EditAnywhere, BlueprintReadWrite, BlueprintSetter=SetFilmbackPresets, Category=Filmback, meta=(TitleProperty=Name))
333 TArray<FNamedFilmbackPreset> FilmbackPresets;
334
336 UPROPERTY(config, EditAnywhere, BlueprintReadWrite, BlueprintSetter=SetDefaultCropPresetName, Category=Crop, meta=(GetOptions=GetCropPresetNames))
337 FString DefaultCropPresetName;
338
340 UPROPERTY(config, EditAnywhere, BlueprintReadWrite, BlueprintSetter=SetCropPresets, Category=Crop, meta=(TitleProperty=Name))
342
343 static CINEMATICCAMERA_API TArray<FNamedLensPreset> const& GetLensPresets();
344 static CINEMATICCAMERA_API TArray<FNamedFilmbackPreset> const& GetFilmbackPresets();
346
347 // Gets the Lens settings associated with a given preset name
348 // Returns true if a preset with the given name was found
349 UFUNCTION(BlueprintCallable, Category=Cinematics, meta=(ReturnDisplayName = "Success"))
350 CINEMATICCAMERA_API bool GetLensPresetByName(const FString PresetName, FCameraLensSettings& LensSettings);
351
352 // Gets the Filmback settings associated with a given preset name
353 // Returns true if a preset with the given name was found
354 UFUNCTION(BlueprintCallable, Category=Cinematics, meta=(ReturnDisplayName = "Success"))
355 CINEMATICCAMERA_API bool GetFilmbackPresetByName(const FString PresetName, FCameraFilmbackSettings& FilmbackSettings);
356
357 // Gets the Crop settings associated with a given preset name
358 // Returns true if a preset with the given name was found
359 UFUNCTION(BlueprintCallable, Category=Cinematics, meta=(ReturnDisplayName = "Success"))
360 CINEMATICCAMERA_API bool GetCropPresetByName(const FString PresetName, FPlateCropSettings& CropSettings);
361
362private:
363 UFUNCTION(BlueprintCallable, Category=Cinematics)
364 static UCineCameraSettings* GetCineCameraSettings();
365
366 /* Internal Blueprint Setter functions that call SaveConfig after setting the variable to ensure settings persist */
367
368 UFUNCTION(BlueprintSetter)
369 void SetDefaultLensPresetName(const FString InDefaultLensPresetName);
370
371 UFUNCTION(BlueprintSetter)
372 void SetDefaultLensFocalLength(const float InDefaultLensFocalLength);
373
374 UFUNCTION(BlueprintSetter)
375 void SetDefaultLensFStop(const float InDefaultLensFStop);
376
377 UFUNCTION(BlueprintSetter)
378 void SetLensPresets(const TArray<FNamedLensPreset>& InLensPresets);
379
380 UFUNCTION(BlueprintSetter)
381 void SetDefaultFilmbackPreset(const FString InDefaultFilmbackPreset);
382
383 UFUNCTION(BlueprintSetter)
384 void SetFilmbackPresets(const TArray<FNamedFilmbackPreset>& InFilmbackPresets);
385
386 UFUNCTION(BlueprintSetter)
387 void SetDefaultCropPresetName(const FString InDefaultCropPresetName);
388
389 UFUNCTION(BlueprintSetter)
390 void SetCropPresets(const TArray<FNamedPlateCropPreset>& InCropPresets);
391
392 /* Functions used for the GetOptions metadata */
393
394 UFUNCTION()
395 TArray<FString> GetLensPresetNames() const;
396
397 UFUNCTION()
398 TArray<FString> GetFilmbackPresetNames() const;
399
400 UFUNCTION()
401 TArray<FString> GetCropPresetNames() const;
402
403 static const FString CineCameraConfigSection;
405 void CopyOldConfigSettings();
406 void CloseNotification();
407
408 // Sensor aspect ratio is derived from Sensor Height and Width so needs to be updated when either property is updated
409 void RecalcSensorAspectRatios();
410};
ECameraExposureMethod
Definition CineCameraSettings.h:289
ECameraFocusMethod
Definition CineCameraSettings.h:192
@ ForceInitToZero
Definition CoreMiscDefines.h:156
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define UCLASS(...)
Definition ObjectMacros.h:776
#define UENUM(...)
Definition ObjectMacros.h:749
#define USTRUCT(...)
Definition ObjectMacros.h:746
#define GENERATED_USTRUCT_BODY(...)
Definition ObjectMacros.h:767
USkinnedMeshComponent float
Definition SkinnedMeshComponent.h:60
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition Actor.h:257
Definition Engine.Build.cs:7
Definition Text.h:385
Definition SNotificationList.h:25
Definition Array.h:670
Definition SharedPointer.h:692
Definition CineCameraSettings.h:301
Definition DeveloperSettings.h:24
@ false
Definition radaudio_common.h:23
Definition CineCameraSettings.h:16
void RecalcSensorAspectRatio()
Definition CineCameraSettings.h:52
FCameraFilmbackSettings()
Definition CineCameraSettings.h:57
bool operator!=(const FCameraFilmbackSettings &Other) const
Definition CineCameraSettings.h:47
Definition CineCameraSettings.h:235
Definition CineCameraSettings.h:90
Definition CineCameraSettings.h:211
Definition Color.h:486
Definition CineCameraSettings.h:70
Definition CineCameraSettings.h:147
Definition CineCameraSettings.h:178
Definition CineCameraSettings.h:163
Definition Scene.h:693
Definition UnrealType.h:6865
Definition SoftObjectPtr.h:174