Skip to content
Snippets Groups Projects
Commit aa59f72b authored by David Gilbert's avatar David Gilbert :bug:
Browse files

refactor(all): Renames VirtualRealityUtilities to RWTHVRUtilities

parent 0d76172a
No related branches found
No related tags found
1 merge request!53refactor(utilities): Cleanup virtual reality utilities
Showing
with 43 additions and 43 deletions
......@@ -14,7 +14,7 @@
#include "Logging/StructuredLog.h"
#include "Materials/MaterialInstanceDynamic.h"
#include "Pawn/VirtualRealityPawn.h"
#include "Utility/VirtualRealityUtilities.h"
#include "Utility/RWTHVRUtilities.h"
DEFINE_LOG_CATEGORY(LogCAVEOverlay);
......@@ -160,11 +160,11 @@ void ACAVEOverlayController::BeginPlay()
// Not sure which place would be best...
const bool bValidPC = PC && PC->GetLocalPlayer();
if (!bValidPC || !UVirtualRealityUtilities::IsRoomMountedMode())
if (!bValidPC || !URWTHVRUtilities::IsRoomMountedMode())
return;
//Input config
if (UVirtualRealityUtilities::IsPrimaryNode())
if (URWTHVRUtilities::IsPrimaryNode())
{
if (CycleDoorTypeInputAction == nullptr || IMCCaveOverlayInputMapping == nullptr)
{
......
......@@ -4,7 +4,7 @@
#include "CaveSetup.h"
#include "Logging/StructuredLog.h"
#include "Utility/VirtualRealityUtilities.h"
#include "Utility/RWTHVRUtilities.h"
// Sets default values
......@@ -22,7 +22,7 @@ void ACaveSetup::BeginPlay()
{
Super::BeginPlay();
if (!UVirtualRealityUtilities::IsRoomMountedMode())
if (!URWTHVRUtilities::IsRoomMountedMode())
{
return;
}
......@@ -41,7 +41,7 @@ void ACaveSetup::BeginPlay()
// Apply the DTrack LiveLink Preset. Only do this if we are the primaryNode
if (UVirtualRealityUtilities::IsPrimaryNode())
if (URWTHVRUtilities::IsPrimaryNode())
{
if (LiveLinkPresetToApplyOnCave && LiveLinkPresetToApplyOnCave->IsValidLowLevelFast())
{
......
......@@ -7,7 +7,7 @@
#include "GameFramework/SpectatorPawn.h"
#include "Kismet/GameplayStatics.h"
#include "Logging/StructuredLog.h"
#include "Utility/VirtualRealityUtilities.h"
#include "Utility/RWTHVRUtilities.h"
FString ARWTHVRGameModeBase::InitNewPlayer(APlayerController* NewPlayerController, const FUniqueNetIdRepl& UniqueId,
......
......@@ -8,7 +8,7 @@
#include "Interaction/Interactors/GrabComponent.h"
#include "Logging/StructuredLog.h"
#include "Misc/Optional.h"
#include "Utility/VirtualRealityUtilities.h"
#include "Utility/RWTHVRUtilities.h"
UVRWidgetInteractionComponent::UVRWidgetInteractionComponent()
{
......
......@@ -6,7 +6,7 @@
#include "EnhancedInputSubsystems.h"
#include "Engine/LocalPlayer.h"
#include "GameFramework/PlayerController.h"
#include "Utility/VirtualRealityUtilities.h"
#include "Utility/RWTHVRUtilities.h"
#include "MotionControllerComponent.h"
void UContinuousMovementComponent::SetupPlayerInput(UInputComponent* PlayerInputComponent)
......@@ -54,7 +54,7 @@ void UContinuousMovementComponent::OnMove(const FInputActionValue& Value)
if (!VRPawn || !VRPawn->Controller)
return;
const bool bGazeDirected = UVirtualRealityUtilities::IsDesktopMode() || SteeringMode ==
const bool bGazeDirected = URWTHVRUtilities::IsDesktopMode() || SteeringMode ==
EVRSteeringModes::STEER_GAZE_DIRECTED;
const FVector ForwardDir = bGazeDirected
......
......@@ -7,7 +7,7 @@
#include "Engine/LocalPlayer.h"
#include "GameFramework/PlayerController.h"
#include "Pawn/VirtualRealityPawn.h"
#include "Utility/VirtualRealityUtilities.h"
#include "Utility/RWTHVRUtilities.h"
void UMovementComponentBase::SetupPlayerInput(UInputComponent* PlayerInputComponent)
{
......
......@@ -11,7 +11,7 @@
#include "NiagaraFunctionLibrary.h"
#include "Kismet/GameplayStatics.h"
#include "NiagaraDataInterfaceArrayFunctionLibrary.h"
#include "Utility/VirtualRealityUtilities.h"
#include "Utility/RWTHVRUtilities.h"
#include "MotionControllerComponent.h"
......
......@@ -6,7 +6,7 @@
#include "EnhancedInputComponent.h"
#include "EnhancedInputSubsystems.h"
#include "Pawn/VirtualRealityPawn.h"
#include "Utility/VirtualRealityUtilities.h"
#include "Utility/RWTHVRUtilities.h"
void UTurnComponent::SetupPlayerInput(UInputComponent* PlayerInputComponent)
{
......@@ -34,7 +34,7 @@ void UTurnComponent::SetupPlayerInput(UInputComponent* PlayerInputComponent)
}
// add Input Mapping context
InputSubsystem->AddMappingContext(UVirtualRealityUtilities::IsDesktopMode() ? IMCDesktopRotation : IMCTurn, 0);
InputSubsystem->AddMappingContext(URWTHVRUtilities::IsDesktopMode() ? IMCDesktopRotation : IMCTurn, 0);
UEnhancedInputComponent* EI = Cast<UEnhancedInputComponent>(PlayerInputComponent);
......@@ -48,7 +48,7 @@ void UTurnComponent::SetupPlayerInput(UInputComponent* PlayerInputComponent)
if (bAllowTurning)
{
// no snap turning for desktop mode
if (bSnapTurn && !UVirtualRealityUtilities::IsDesktopMode())
if (bSnapTurn && !URWTHVRUtilities::IsDesktopMode())
{
EI->BindAction(Turn, ETriggerEvent::Started, this, &UTurnComponent::OnBeginSnapTurn);
}
......@@ -59,7 +59,7 @@ void UTurnComponent::SetupPlayerInput(UInputComponent* PlayerInputComponent)
}
// bind additional functions for desktop rotations
if (UVirtualRealityUtilities::IsDesktopMode())
if (URWTHVRUtilities::IsDesktopMode())
{
EI->BindAction(DesktopRotation, ETriggerEvent::Started, this, &UTurnComponent::StartDesktopRotation);
EI->BindAction(DesktopRotation, ETriggerEvent::Completed, this, &UTurnComponent::EndDesktopRotation);
......@@ -79,7 +79,7 @@ void UTurnComponent::EndDesktopRotation()
void UTurnComponent::OnBeginTurn(const FInputActionValue& Value)
{
if (UVirtualRealityUtilities::IsDesktopMode() && !bApplyDesktopRotation)
if (URWTHVRUtilities::IsDesktopMode() && !bApplyDesktopRotation)
return;
if (!VRPawn || !VRPawn->Controller)
......@@ -89,7 +89,7 @@ void UTurnComponent::OnBeginTurn(const FInputActionValue& Value)
if (TurnValue.X != 0.f)
{
if (UVirtualRealityUtilities::IsDesktopMode() && bApplyDesktopRotation)
if (URWTHVRUtilities::IsDesktopMode() && bApplyDesktopRotation)
{
VRPawn->AddControllerYawInput(TurnRateFactor * TurnValue.X);
}
......@@ -101,7 +101,7 @@ void UTurnComponent::OnBeginTurn(const FInputActionValue& Value)
if (TurnValue.Y != 0.f)
{
if (UVirtualRealityUtilities::IsDesktopMode() && bApplyDesktopRotation)
if (URWTHVRUtilities::IsDesktopMode() && bApplyDesktopRotation)
{
VRPawn->AddControllerPitchInput(TurnRateFactor * -TurnValue.Y);
}
......
......@@ -13,7 +13,7 @@
#include "Pawn/ReplicatedCameraComponent.h"
#include "Pawn/ReplicatedMotionControllerComponent.h"
#include "Roles/LiveLinkTransformTypes.h"
#include "Utility/VirtualRealityUtilities.h"
#include "Utility/RWTHVRUtilities.h"
AVirtualRealityPawn::AVirtualRealityPawn(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
......@@ -42,7 +42,7 @@ void AVirtualRealityPawn::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
if (UVirtualRealityUtilities::IsDesktopMode() && IsLocallyControlled())
if (URWTHVRUtilities::IsDesktopMode() && IsLocallyControlled())
{
SetCameraOffset();
UpdateRightHandForDesktopInteraction();
......@@ -64,7 +64,7 @@ void AVirtualRealityPawn::NotifyControllerChanged()
if (IsLocallyControlled())
{
// Only do this for the primary node or when we're running in standalone
if (UVirtualRealityUtilities::IsRoomMountedMode() && (UVirtualRealityUtilities::IsPrimaryNode() ||
if (URWTHVRUtilities::IsRoomMountedMode() && (URWTHVRUtilities::IsPrimaryNode() ||
GetNetMode() == NM_Standalone))
{
// If we are also the authority (standalone or listen server), directly attach it to us.
......@@ -105,14 +105,14 @@ void AVirtualRealityPawn::SetupPlayerInputComponent(UInputComponent* PlayerInput
// Don't do anything with the type if it's been set to clustertype or anything.
const bool bClusterType = Type == EPlayerType::nDisplayPrimary || Type == EPlayerType::nDisplaySecondary;
if (!bClusterType && UVirtualRealityUtilities::IsHeadMountedMode())
if (!bClusterType && URWTHVRUtilities::IsHeadMountedMode())
{
// Could be too early to call this RPC...
State->RequestSetPlayerType(Type);
}
}
if (UVirtualRealityUtilities::IsDesktopMode())
if (URWTHVRUtilities::IsDesktopMode())
{
PlayerController->bShowMouseCursor = true;
PlayerController->bEnableClickEvents = true;
......@@ -129,7 +129,7 @@ void AVirtualRealityPawn::SetupPlayerInputComponent(UInputComponent* PlayerInput
void AVirtualRealityPawn::EvaluateLivelink() const
{
if (UVirtualRealityUtilities::IsRoomMountedMode() && IsLocallyControlled())
if (URWTHVRUtilities::IsRoomMountedMode() && IsLocallyControlled())
{
if (bDisableLiveLink || HeadSubjectRepresentation.Subject.IsNone() || HeadSubjectRepresentation.Role == nullptr)
{
......@@ -214,12 +214,12 @@ void AVirtualRealityPawn::SetupMotionControllerSources()
FName MotionControllerSourceLeft = EName::None;
FName MotionControllerSourceRight = EName::None;
if (UVirtualRealityUtilities::IsHeadMountedMode())
if (URWTHVRUtilities::IsHeadMountedMode())
{
MotionControllerSourceLeft = FName("Left");
MotionControllerSourceRight = FName("Right");
}
if (UVirtualRealityUtilities::IsRoomMountedMode())
if (URWTHVRUtilities::IsRoomMountedMode())
{
MotionControllerSourceLeft = LeftSubjectRepresentation.Subject;
MotionControllerSourceRight = RightSubjectRepresentation.Subject;
......
#include "Utility/VirtualRealityUtilities.h"
#include "Utility/RWTHVRUtilities.h"
#if PLATFORM_SUPPORTS_NDISPLAY
#include "DisplayClusterConfigurationTypes.h"
......@@ -20,12 +20,12 @@
DEFINE_LOG_CATEGORY(Toolkit);
bool UVirtualRealityUtilities::IsDesktopMode()
bool URWTHVRUtilities::IsDesktopMode()
{
return !IsRoomMountedMode() && !IsHeadMountedMode();
}
bool UVirtualRealityUtilities::IsRoomMountedMode()
bool URWTHVRUtilities::IsRoomMountedMode()
{
#if PLATFORM_SUPPORTS_NDISPLAY
return IDisplayCluster::Get().GetOperationMode() == EDisplayClusterOperationMode::Cluster;
......@@ -34,14 +34,14 @@ bool UVirtualRealityUtilities::IsRoomMountedMode()
#endif
}
bool UVirtualRealityUtilities::IsHeadMountedMode()
bool URWTHVRUtilities::IsHeadMountedMode()
{
// In editor builds: checks for EdEngine->IsVRPreviewActive()
// In packaged builds: checks for `-vr` in commandline or bStartInVR in UGeneralProjectSettings
return FAudioDevice::CanUseVRAudioDevice();
}
bool UVirtualRealityUtilities::IsCave()
bool URWTHVRUtilities::IsCave()
{
#if PLATFORM_SUPPORTS_NDISPLAY
if (!IsRoomMountedMode())
......@@ -55,7 +55,7 @@ bool UVirtualRealityUtilities::IsCave()
#endif
}
bool UVirtualRealityUtilities::IsRolv()
bool URWTHVRUtilities::IsRolv()
{
#if PLATFORM_SUPPORTS_NDISPLAY
if (!IsRoomMountedMode())
......@@ -70,7 +70,7 @@ bool UVirtualRealityUtilities::IsRolv()
}
/* Return true on the Primary in cluster mode and in a normal desktop session. Otherwise false */
bool UVirtualRealityUtilities::IsPrimaryNode()
bool URWTHVRUtilities::IsPrimaryNode()
{
#if PLATFORM_SUPPORTS_NDISPLAY
if (!IDisplayCluster::IsAvailable())
......@@ -88,12 +88,12 @@ bool UVirtualRealityUtilities::IsPrimaryNode()
#endif
}
bool UVirtualRealityUtilities::IsSecondaryNode()
bool URWTHVRUtilities::IsSecondaryNode()
{
return !IsPrimaryNode();
}
FString UVirtualRealityUtilities::GetNodeName()
FString URWTHVRUtilities::GetNodeName()
{
#if PLATFORM_SUPPORTS_NDISPLAY
return IsRoomMountedMode() ? IDisplayCluster::Get().GetClusterMgr()->GetNodeId() : FString(TEXT("Localhost"));
......@@ -102,7 +102,7 @@ FString UVirtualRealityUtilities::GetNodeName()
#endif
}
float UVirtualRealityUtilities::GetEyeDistance()
float URWTHVRUtilities::GetEyeDistance()
{
if (IsHeadMountedMode())
{
......@@ -119,7 +119,7 @@ float UVirtualRealityUtilities::GetEyeDistance()
}
}
EEyeStereoOffset UVirtualRealityUtilities::GetNodeEyeType()
EEyeStereoOffset URWTHVRUtilities::GetNodeEyeType()
{
#if PLATFORM_SUPPORTS_NDISPLAY
const ADisplayClusterRootActor* RootActor = IDisplayCluster::Get().GetGameMgr()->GetRootActor();
......@@ -131,7 +131,7 @@ EEyeStereoOffset UVirtualRealityUtilities::GetNodeEyeType()
#endif
}
USceneComponent* UVirtualRealityUtilities::GetClusterComponent(const FString& Name)
USceneComponent* URWTHVRUtilities::GetClusterComponent(const FString& Name)
{
#if PLATFORM_SUPPORTS_NDISPLAY
const ADisplayClusterRootActor* RootActor = IDisplayCluster::Get().GetGameMgr()->GetRootActor();
......@@ -141,7 +141,7 @@ USceneComponent* UVirtualRealityUtilities::GetClusterComponent(const FString& Na
#endif
}
USceneComponent* UVirtualRealityUtilities::GetNamedClusterComponent(const ENamedClusterComponent& Component)
USceneComponent* URWTHVRUtilities::GetNamedClusterComponent(const ENamedClusterComponent& Component)
{
switch (Component)
{
......@@ -175,7 +175,7 @@ USceneComponent* UVirtualRealityUtilities::GetNamedClusterComponent(const ENamed
}
}
void UVirtualRealityUtilities::ShowErrorAndQuit(UWorld* WorldContext, const FString& Message)
void URWTHVRUtilities::ShowErrorAndQuit(UWorld* WorldContext, const FString& Message)
{
UE_LOG(Toolkit, Error, TEXT("%s"), *Message)
#if WITH_EDITOR
......
......@@ -4,7 +4,7 @@
#include "Kismet/BlueprintFunctionLibrary.h"
#include "UObject/ConstructorHelpers.h"
#include "VirtualRealityUtilities.generated.h"
#include "RWTHVRUtilities.generated.h"
/**
......@@ -40,7 +40,7 @@ enum class EEyeStereoOffset
};
UCLASS()
class RWTHVRTOOLKIT_API UVirtualRealityUtilities : public UBlueprintFunctionLibrary
class RWTHVRTOOLKIT_API URWTHVRUtilities : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment