Skip to content

Commit 6247b95

Browse files
Merge branch 'dev/5.4' into '5.4'
UE5.4-2024.1 See merge request vr-vis/VR-Group/unreal-development/plugins/rwth-vr-toolkit!120
2 parents 892c6a2 + 673359e commit 6247b95

File tree

10 files changed

+89
-38
lines changed

10 files changed

+89
-38
lines changed

.gitlab-ci.yml

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,30 @@
33
# Virtual Reality & Immersive Visualisation Group.
44
#-------------------------------------------------------------------------------
55

6+
spec:
7+
inputs:
8+
unreal_version:
9+
description: The Unreal Engine version in the form of "major.minor"
10+
type: string
11+
regex: \d+\.\d+
12+
default: "5.4"
13+
build_type:
14+
description: The game build type.
15+
type: string
16+
options: ["DebugGame", "Shipping"]
17+
default: "DebugGame"
18+
number_of_old_versions:
19+
description: How many successful pipeline builds of this branch should be stored on the cluster.
20+
type: number
21+
default: 3
22+
custom_ndisplay_config:
23+
description: Custom nDisplay config stored on the cluster filesystem.
24+
type: string
25+
default: ""
26+
27+
---
28+
29+
630
# The include file can be change to either be removed or reference a specific commit.
731

832
include:
@@ -41,8 +65,9 @@ include:
4165
# Use the CUSTOM_NDISPLAY_CONFIG variable in case you need a custom ndisplay config. These are always located in /home/vrdemo/configs/ndisplay.
4266

4367
variables:
44-
UNREAL_VERSION: "5.4"
45-
CUSTOM_NDISPLAY_CONFIG: "aixcave_5_4.ndisplay"
68+
UNREAL_VERSION: $[[ inputs.unreal_version ]]
69+
NUMBER_OF_OLD_VERSIONS: $[[ inputs.number_of_old_versions ]]
70+
CUSTOM_NDISPLAY_CONFIG: $[[ inputs.custom_ndisplay_config ]]
4671

4772
stages:
4873
- analyze
@@ -113,7 +138,7 @@ Build_Windows:
113138
GIT_STRATEGY: none
114139
GIT_CHECKOUT: "false"
115140
# CLIENT_CONFIG: "Shipping"
116-
CLIENT_CONFIG: "DebugGame"
141+
CLIENT_CONFIG: $[[ inputs.build_type ]]
117142
needs:
118143
- job: "Generate_Project"
119144
artifacts: true
@@ -134,7 +159,7 @@ Build_Linux:
134159
GIT_STRATEGY: none
135160
GIT_CHECKOUT: "false"
136161
# CLIENT_CONFIG: "Shipping"
137-
CLIENT_CONFIG: "DebugGame"
162+
CLIENT_CONFIG: $[[ inputs.build_type ]]
138163
needs:
139164
- job: "Generate_Project"
140165
artifacts: true
@@ -146,16 +171,7 @@ Build_Linux_Without_Cluster:
146171
needs:
147172
- job: "Generate_Project_Without_Cluster"
148173
artifacts: true
149-
150-
# Deploys to vrdev
151-
.Deploy_Windows:
152-
rules:
153-
- if: $CI_PIPELINE_SOURCE == "web"
154-
- if: $CI_PIPELINE_SOURCE == "schedule"
155-
extends: .Deploy_VRDev_
156-
needs:
157-
- job: "Build_Windows"
158-
artifacts: true
174+
159175

160176
# Deploys to vrdemo instead of av006de. Use extends: .Deploy_CAVE_ to deploy to legacy av006de
161177
Deploy_CAVE:
561 Bytes
Binary file not shown.
157 Bytes
Binary file not shown.

Source/RWTHVRToolkit/Private/Core/ClientTransformReplication.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ void UClientTransformReplication::UpdateState(float DeltaTime)
2626
// Only do this if we actually replicate the actor
2727
if (GetIsReplicated())
2828
{
29-
const FVector Loc = OwningActor->GetActorLocation();
30-
const FRotator Rot = OwningActor->GetActorRotation();
29+
const FVector Loc = OwningActor->GetRootComponent()->GetRelativeLocation();
30+
const FRotator Rot = OwningActor->GetRootComponent()->GetRelativeRotation();
3131

3232
// Only update state if the local state changed
3333
if (!Loc.Equals(ReplicatedTransform.Position) || !Rot.Equals(ReplicatedTransform.Rotation))

Source/RWTHVRToolkit/Private/Interaction/Interactors/DirectInteractionComponent.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ void UDirectInteractionComponent::TickComponent(float DeltaTime, ELevelTick Tick
7070
// Call hover end events on all components that were previously in range, but not anymore
7171
for (UInteractableComponent* PrevInteractableComp : PreviousInteractableComponentsInRange)
7272
{
73+
// It can happen that a previous component was destroyed
74+
if (!PrevInteractableComp || !PrevInteractableComp->IsValidLowLevel())
75+
{
76+
ComponentsToRemove.Add(PrevInteractableComp); // might have to use indices here
77+
continue;
78+
}
79+
7380
if (!CurrentInteractableCompsInRange.Contains(PrevInteractableComp))
7481
{
7582
ComponentsToRemove.AddUnique(PrevInteractableComp);

Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
#include "Utility/RWTHVRUtilities.h"
1919

2020
#if PLATFORM_SUPPORTS_CLUSTER
21+
#include "DisplayClusterRootActor.h"
22+
#include "ScalableConfigInterface.h"
23+
#include "IDisplayCluster.h"
24+
#include "Game/IDisplayClusterGameManager.h"
2125
#include "Components/DisplayClusterSceneComponentSyncParent.h"
2226
#endif
2327

@@ -56,11 +60,7 @@ ARWTHVRPawn::ARWTHVRPawn(const FObjectInitializer& ObjectInitializer) : Super(Ob
5660
});
5761
}
5862

59-
void ARWTHVRPawn::BeginPlay()
60-
{
61-
Super::BeginPlay();
62-
InitialWorldToMeters = GetWorldSettings()->WorldToMeters;
63-
}
63+
void ARWTHVRPawn::BeginPlay() { Super::BeginPlay(); }
6464

6565
void ARWTHVRPawn::Tick(float DeltaSeconds)
6666
{
@@ -75,17 +75,37 @@ void ARWTHVRPawn::Tick(float DeltaSeconds)
7575
}
7676

7777
/*
78-
* Scales the Pawn while also adjusting the WorldToMeters ratio to adjust for pupillary distance.
79-
* Only supports uniform scaling.
78+
* Scales the Pawn. Only supports uniform scaling.
8079
*/
8180
void ARWTHVRPawn::SetScale(float NewScale)
8281
{
83-
FVector OldScale = GetActorScale();
8482
UniformScale = NewScale;
8583
FVector NewScaleVector = FVector(UniformScale, UniformScale, UniformScale);
86-
GetWorldSettings()->WorldToMeters = InitialWorldToMeters * UniformScale;
8784
SetActorRelativeScale3D(NewScaleVector);
88-
OnScaleChanged.Broadcast(OldScale, NewScale);
85+
86+
#if PLATFORM_SUPPORTS_CLUSTER
87+
const ARWTHVRPlayerState* State = GetPlayerState<ARWTHVRPlayerState>();
88+
if (URWTHVRUtilities::IsRoomMountedMode() && State && State->GetCorrespondingClusterActor())
89+
{
90+
if (const auto GameMgr = IDisplayCluster::Get().GetGameMgr())
91+
{
92+
if (const auto ClusterRootActor = GameMgr->GetRootActor())
93+
{
94+
if (ClusterRootActor->Implements<UScalableConfigInterface>())
95+
{
96+
IScalableConfigInterface::Execute_OnScaleChanged(ClusterRootActor, NewScale);
97+
}
98+
else
99+
{
100+
UE_LOGFMT(Toolkit, Warning,
101+
"The ClusterRootActor {0} does not implement the ScalableConfigInterface. Scaling the "
102+
"Pawn on the cluster will lead to unintended behavior.",
103+
ClusterRootActor->GetName());
104+
}
105+
}
106+
}
107+
}
108+
#endif
89109
}
90110

91111
float ARWTHVRPawn::GetScale() { return UniformScale; }
@@ -118,6 +138,12 @@ void ARWTHVRPawn::NotifyControllerChanged()
118138
AttachClustertoPawn();
119139
}
120140
}
141+
else
142+
{
143+
UE_LOGFMT(Toolkit, Warning,
144+
"ARWTHVRPawn: PlayerState is not a subclass of ARWTHVRPlayerState. Cluster attachment only works "
145+
"with correct PlayerStates!");
146+
}
121147
}
122148
}
123149

@@ -150,14 +176,18 @@ void ARWTHVRPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponen
150176
if (ARWTHVRPlayerState* State = GetPlayerState<ARWTHVRPlayerState>())
151177
{
152178
// Might not be properly synced yet?
153-
const EPlayerType Type = State->GetPlayerType();
179+
EPlayerType Type = State->GetPlayerType();
154180

155181
// Don't do anything with the type if it's been set to clustertype or anything.
156182
// This is already being done when connecting to the server.
157183
const bool bClusterType = Type == EPlayerType::nDisplayPrimary || Type == EPlayerType::nDisplaySecondary;
158184

159-
if (!bClusterType && URWTHVRUtilities::IsHeadMountedMode())
185+
if (!bClusterType)
160186
{
187+
if (URWTHVRUtilities::IsHeadMountedMode())
188+
Type = EPlayerType::HMD;
189+
190+
UE_LOGFMT(Toolkit, Display, "Pawn: Requesting Player Type {T}...", StaticCast<int8>(Type));
161191
// Could be too early to call this RPC...
162192
State->RequestSetPlayerType(Type);
163193
}

Source/RWTHVRToolkit/Private/Utility/RWTHVRUtilities.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "Utility/RWTHVRUtilities.h"
22

33
#include "AudioDevice.h"
4+
#include "HeadMountedDisplayFunctionLibrary.h"
45
#include "IHeadMountedDisplay.h"
56
#include "IXRTrackingSystem.h"
67
#include "Engine/Engine.h"
@@ -16,12 +17,7 @@ DEFINE_LOG_CATEGORY(Toolkit);
1617

1718
bool URWTHVRUtilities::IsDesktopMode() { return !IsRoomMountedMode() && !IsHeadMountedMode(); }
1819

19-
bool URWTHVRUtilities::IsHeadMountedMode()
20-
{
21-
// In editor builds: checks for EdEngine->IsVRPreviewActive()
22-
// In packaged builds: checks for `-vr` in commandline or bStartInVR in UGeneralProjectSettings
23-
return FAudioDevice::CanUseVRAudioDevice();
24-
}
20+
bool URWTHVRUtilities::IsHeadMountedMode() { return UHeadMountedDisplayFunctionLibrary::IsHeadMountedDisplayEnabled(); }
2521

2622
bool URWTHVRUtilities::IsRoomMountedMode()
2723
{
@@ -38,7 +34,7 @@ bool URWTHVRUtilities::IsPrimaryNode()
3834
return URWTHVRClusterUtilities::IsPrimaryNode();
3935
#else
4036
return false;
41-
#endif
37+
#endif
4238
}
4339

4440
float URWTHVRUtilities::GetEyeDistance()

Source/RWTHVRToolkit/Public/Core/ClientTransformReplication.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ class RWTHVRTOOLKIT_API UClientTransformReplication : public UActorComponent
5656
// For now, directly apply the transforms:
5757
auto* OwningActor = GetOwner();
5858
if (OwningActor && OwningActor->HasValidRootComponent())
59-
OwningActor->SetActorLocationAndRotation(ReplicatedTransform.Position, ReplicatedTransform.Rotation);
59+
{
60+
OwningActor->SetActorRelativeLocation(ReplicatedTransform.Position);
61+
OwningActor->SetActorRelativeRotation(ReplicatedTransform.Rotation);
62+
}
6063
}
6164

6265
// Unreliable Server RPC that sends the transform from owning client to the server

Source/RWTHVRToolkit/Public/Pawn/RWTHVRPawn.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,5 @@ class RWTHVRTOOLKIT_API ARWTHVRPawn : public APawn
122122

123123
private:
124124
UInputComponent* ActivePlayerInputComponent;
125-
float InitialWorldToMeters;
126125
float UniformScale;
127126
};

Source/RWTHVRToolkit/RWTHVRToolkit.Build.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public RWTHVRToolkit(ReadOnlyTargetRules Target) : base(Target)
3838
PrivateDependencyModuleNames.AddRange(
3939
new string[]
4040
{
41-
"NetCore"
41+
"NetCore", "XRBase"
4242
}
4343
);
4444
if (Target.bBuildEditor == true)

0 commit comments

Comments
 (0)