You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
103 lines
5.6 KiB
103 lines
5.6 KiB
// Copyright Voulz 2021-2025. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "CineCameraComponent.h"
|
|
#include "ArchVisCineCameraComponent.generated.h"
|
|
|
|
/**
|
|
*
|
|
*/
|
|
UCLASS(HideCategories = (CameraSettings), HideFunctions = (SetFieldOfView, SetAspectRatio), Blueprintable, ClassGroup = Camera, meta = (BlueprintSpawnableComponent, DisplayName = "ArchVis Cine Camera Component"), Config = Engine)
|
|
class ARCHVISTOOLS_API UArchVisCineCameraComponent : public UCineCameraComponent
|
|
{
|
|
GENERATED_BODY()
|
|
public:
|
|
/** Set to True to activate a 2-Point Perspective mode which corrects the vertical lines to ensure they are actually vertical. The strength of the correction can be adjusted. */
|
|
UPROPERTY(BlueprintReadWrite, EditAnywhere, Interp, Category = "ArchVis Cine Camera Settings", meta = (DisplayName = "Correct Perspective (Auto)", InlineEditConditionToggle))
|
|
bool bCorrectPerspective = true;
|
|
|
|
/** The Strength of the correction. Set to 0.0 to disable the correction and to 1.0 for it to be full strength. */
|
|
UPROPERTY(BlueprintReadWrite, EditAnywhere, Interp, Category = "ArchVis Cine Camera Settings",
|
|
meta = (ClampMin = 0.00, EditCondition = "bCorrectPerspective", UIMax = 1.00, UIMin = 0.00))
|
|
float CorrectionStrength = 1.0F;
|
|
|
|
/** The Projection Offset of the Camera. Allows viewing beyond the screen while keeping the same projection and vanishing points. */
|
|
UPROPERTY(BlueprintReadWrite, EditAnywhere, Interp, Category = "ArchVis Cine Camera Settings", meta = (DisplayName = "Manual Correction (Shift)"))
|
|
FVector2D ProjectionOffset;
|
|
|
|
/** The final Projection Offset computed internally */
|
|
UPROPERTY(meta = (DeprecatedProperty))
|
|
FVector2D FinalProjectionOffset;
|
|
|
|
/** Set to True to allow the camera to roll */
|
|
UPROPERTY(AdvancedDisplay, BlueprintReadWrite, EditAnywhere, Interp, Category = "ArchVis Cine Camera Settings")
|
|
bool bAllowRoll = false;
|
|
|
|
/** The Maximum Pitch of the Camera. The camera will not rotate beyond this angle. Need to be less than 90. */
|
|
UPROPERTY(AdvancedDisplay, BlueprintReadWrite, EditAnywhere, Interp, Category = "ArchVis Cine Camera Settings", meta = (ClampMax = 89.99, ClampMin = 0.00, UIMax = 89.50, UIMin = 0.00))
|
|
float MaxPitch = 85.0F;
|
|
|
|
|
|
/**
|
|
* [IN 5.1, use `Custom Near Clippling Plane` instead, but you can also animate this property]
|
|
* Allows the overriding of the Near Clipping Plane if the value is bigger than 0. To handle it automatically, you need to set bAutomaticNearClipPlaneHandling to true.
|
|
* Outside of the Movie Render Queue, the Near Clip Plane default settings is set in the Project Settings > Engine - General Settings > Settings > Near Clip Plane and
|
|
* can also be set with the command r.SetNearClipPlane
|
|
* If `bAutomaticNearClipPlaneHandling` is set to false, it will only change the value of `OverrideNearClipPlane` but not actually set the Clipping Plane.
|
|
*/
|
|
UPROPERTY(meta = (DeprecatedProperty, DeprecationMessage = "Use `Custom Near Clippling Plane` instead"))
|
|
float OverrideNearClipPlane = -1.0;
|
|
|
|
UE_DEPRECATED(5.1, "Cinematic Cameras now have a property `Custom Near Clippling Plane` or you can set `OverrideNearClipPlane` directly.")
|
|
/**
|
|
* [DEPRECATED IN 5.1, you can set `OverrideNearClipPlane` directly]
|
|
* If set to true, the Global Near Clipping Plane will automatically try to adjust to the value of `OverrideNearClipPlane`. If set to false, the component will not alter the Global Near Clipping Plane even if OverrideNearClipPlane is set
|
|
*/
|
|
UPROPERTY()
|
|
bool bAutomaticNearClipPlaneHandling = false;
|
|
|
|
|
|
UE_DEPRECATED(4.27, "Only use for internal Debugging. You can achieve a similar outcome by setting `bCorrectPerspective` instead. ")
|
|
/** Circuit Breaker used for debugging. Set to False to force disable the perspective correction. Will be Deprecated in the future */
|
|
UPROPERTY(meta=(DeprecatedProperty, DeprecationMessage="Only use for internal Debugging. You can achieve a similar outcome by setting `bCorrectPerspective` instead. "))
|
|
bool bGetCorrectedView = true;
|
|
|
|
UE_DEPRECATED(5.2, "Not used anymore.")
|
|
/**
|
|
* If true, will use `CameraComponent::AddAdditiveOffset` to handle the projection.
|
|
* This is the solution that works best, especially if trying to pilot the camera in the editor, but needs to be turned off if AdditiveOffset is used (when using Camera Shakes for example).
|
|
* In case of issue or conflicting use of the AdditiveOffset, set to false and let me know.
|
|
*/
|
|
UPROPERTY()
|
|
bool bUseAdditiveOffset = true;
|
|
|
|
|
|
/**
|
|
* @brief Initialise this Component to align with the given CameraComponent or CineCameraComponent
|
|
* @param CameraComponent the CameraComponent or CineCameraComponent to copy properties from
|
|
* @param bCopyTransform If set to true, will copy the world transform of the given CameraComponent and apply it to this Component
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category = "ArchVis Cine Camera Settings")
|
|
void InitFromCameraComponent(const UCameraComponent* CameraComponent, bool bCopyTransform = false);
|
|
|
|
#if WITH_EDITORONLY_DATA
|
|
UE_DEPRECATED(5.2, "Not used anymore.")
|
|
/** Draw Debug Lines to understand how the Correction is computed */
|
|
UPROPERTY()
|
|
bool bDrawDebugLines = false;
|
|
#endif
|
|
|
|
/**
|
|
* @brief Gets the MinimalViewInfo of the current view as per the current settings. Will call GetCameraViewAndClipPlaneCorrected or GetCameraViewAndClipPlaneUncorrected
|
|
* @param DeltaTime Time used for some interpolation function within UCineCameraComponent
|
|
* @param DesiredView Returns the camera's Point of View.
|
|
*/
|
|
virtual void GetCameraView(float DeltaTime, FMinimalViewInfo& DesiredView) override;
|
|
|
|
#if WITH_EDITOR
|
|
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
|
|
|
|
#endif
|
|
};
|