RealtimeStyleTransferRuntime/Source/LyraGame/Camera/LyraUICameraManagerComponen...

69 lines
1.9 KiB
C++
Raw Normal View History

2022-05-23 18:41:30 +00:00
// Copyright Epic Games, Inc. All Rights Reserved.
#include "LyraUICameraManagerComponent.h"
#include "EngineUtils.h"
#include "Algo/Transform.h"
#include "DrawDebugHelpers.h"
#include "Engine/Canvas.h"
#include "GameFramework/PlayerController.h"
#include "Engine/LocalPlayer.h"
#include "Slate/SceneViewport.h"
#include "Blueprint/WidgetLayoutLibrary.h"
#include "GameFramework/HUD.h"
#include "Engine/Engine.h"
#include "LyraCameraMode.h"
#include "LyraPlayerCameraManager.h"
ULyraUICameraManagerComponent* ULyraUICameraManagerComponent::GetComponent(APlayerController* PC)
{
if (PC != nullptr)
{
if (ALyraPlayerCameraManager* PCCamera = Cast<ALyraPlayerCameraManager>(PC->PlayerCameraManager))
{
return PCCamera->GetUICameraComponent();
}
}
return nullptr;
}
ULyraUICameraManagerComponent::ULyraUICameraManagerComponent()
{
bWantsInitializeComponent = true;
if (!HasAnyFlags(RF_ClassDefaultObject))
{
// Register "showdebug" hook.
if (!IsRunningDedicatedServer())
{
AHUD::OnShowDebugInfo.AddUObject(this, &ThisClass::OnShowDebugInfo);
}
}
}
void ULyraUICameraManagerComponent::InitializeComponent()
{
Super::InitializeComponent();
}
void ULyraUICameraManagerComponent::SetViewTarget(AActor* InViewTarget, FViewTargetTransitionParams TransitionParams)
{
TGuardValue<bool> UpdatingViewTargetGuard(bUpdatingViewTarget, true);
ViewTarget = InViewTarget;
CastChecked<ALyraPlayerCameraManager>(GetOwner())->SetViewTarget(ViewTarget, TransitionParams);
}
bool ULyraUICameraManagerComponent::NeedsToUpdateViewTarget() const
{
return false;
}
void ULyraUICameraManagerComponent::UpdateViewTarget(struct FTViewTarget& OutVT, float DeltaTime)
{
}
void ULyraUICameraManagerComponent::OnShowDebugInfo(AHUD* HUD, UCanvas* Canvas, const FDebugDisplayInfo& DisplayInfo, float& YL, float& YPos)
{
}