From 31e221dcb7144dce42235617c8fbe74ade1ff264 Mon Sep 17 00:00:00 2001
From: David Gilbert <gilbert@vr.rwth-aachen.de>
Date: Tue, 16 Apr 2024 16:32:11 +0200
Subject: [PATCH] fix: Fixes issue with CaveOverlay, renames logging and
 actually adds some logging.

---
 .../Private/CAVEOverlay/CAVEOverlayController.cpp           | 6 ++++++
 Source/RWTHVRCluster/Private/CaveSetup.cpp                  | 5 +++--
 .../Private/Utility/RWTHVRClusterUtilities.cpp              | 2 +-
 .../RWTHVRCluster/Public/Utility/RWTHVRClusterUtilities.h   | 2 +-
 4 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/Source/RWTHVRCluster/Private/CAVEOverlay/CAVEOverlayController.cpp b/Source/RWTHVRCluster/Private/CAVEOverlay/CAVEOverlayController.cpp
index 4f27161..968e799 100644
--- a/Source/RWTHVRCluster/Private/CAVEOverlay/CAVEOverlayController.cpp
+++ b/Source/RWTHVRCluster/Private/CAVEOverlay/CAVEOverlayController.cpp
@@ -217,6 +217,12 @@ void ACAVEOverlayController::BeginPlay()
 	// Set Text to "" until someone presses the key for the first time
 	Overlay->CornerText->SetText(FText::FromString(""));
 
+	if (!SignStaticMesh)
+	{
+		UE_LOGFMT(LogCAVEOverlay, Error, "SignStaticMesh not set in CaveOverlayController!");
+		return;
+	}
+
 	// Get the pawn so we can have access to head and hand positions
 	if (const auto* VRPawn = Cast<APawn>(PC->GetPawnOrSpectator()))
 	{
diff --git a/Source/RWTHVRCluster/Private/CaveSetup.cpp b/Source/RWTHVRCluster/Private/CaveSetup.cpp
index 63456d4..369f4e9 100644
--- a/Source/RWTHVRCluster/Private/CaveSetup.cpp
+++ b/Source/RWTHVRCluster/Private/CaveSetup.cpp
@@ -23,6 +23,7 @@ void ACaveSetup::BeginPlay()
 
 	if (!URWTHVRClusterUtilities::IsRoomMountedMode())
 	{
+		UE_LOGFMT(RWTHVRCluster, Display, "CaveSetup: Not in RoomMountedMode, doing nothing.");
 		return;
 	}
 
@@ -33,7 +34,7 @@ void ACaveSetup::BeginPlay()
 		{
 			const auto Actor = World->SpawnActor(ActorClass);
 			Actor->AttachToActor(this, FAttachmentTransformRules::SnapToTargetNotIncludingScale);
-			UE_LOGFMT(LogTemp, Display, "CaveSetup: Spawned Actor {Actor} on the Cave and attached it.",
+			UE_LOGFMT(RWTHVRCluster, Display, "CaveSetup: Spawned Actor {Actor} on the Cave and attached it.",
 					  Actor->GetName());
 		}
 	}
@@ -46,7 +47,7 @@ void ACaveSetup::BeginPlay()
 		{
 			LiveLinkPresetToApplyOnCave->ApplyToClientLatent();
 
-			UE_LOGFMT(LogTemp, Display, "CaveSetup: Applied LiveLinkPreset {Preset} to Client.",
+			UE_LOGFMT(RWTHVRCluster, Display, "CaveSetup: Applied LiveLinkPreset {Preset} to Client.",
 					  LiveLinkPresetToApplyOnCave->GetName());
 		}
 	}
diff --git a/Source/RWTHVRCluster/Private/Utility/RWTHVRClusterUtilities.cpp b/Source/RWTHVRCluster/Private/Utility/RWTHVRClusterUtilities.cpp
index f1f2a4c..2893475 100644
--- a/Source/RWTHVRCluster/Private/Utility/RWTHVRClusterUtilities.cpp
+++ b/Source/RWTHVRCluster/Private/Utility/RWTHVRClusterUtilities.cpp
@@ -10,7 +10,7 @@
 #include "Engine/LocalPlayer.h"
 #include "Game/IDisplayClusterGameManager.h"
 
-DEFINE_LOG_CATEGORY(ClusterPlugin);
+DEFINE_LOG_CATEGORY(RWTHVRCluster);
 
 bool URWTHVRClusterUtilities::IsRoomMountedMode()
 {
diff --git a/Source/RWTHVRCluster/Public/Utility/RWTHVRClusterUtilities.h b/Source/RWTHVRCluster/Public/Utility/RWTHVRClusterUtilities.h
index cfd6f30..0ead84a 100644
--- a/Source/RWTHVRCluster/Public/Utility/RWTHVRClusterUtilities.h
+++ b/Source/RWTHVRCluster/Public/Utility/RWTHVRClusterUtilities.h
@@ -11,7 +11,7 @@
 /**
  * Custom log category for all ClusterPlugin related components
  */
-DECLARE_LOG_CATEGORY_EXTERN(ClusterPlugin, Log, All);
+DECLARE_LOG_CATEGORY_EXTERN(RWTHVRCluster, Log, All);
 
 UENUM(BlueprintType)
 enum class ENamedClusterComponent : uint8
-- 
GitLab