From 851e2150aa2a6dbdfcde42cb49d8ae15965fbc16 Mon Sep 17 00:00:00 2001 From: David Gilbert <gilbert@vr.rwth-aachen.de> Date: Wed, 22 Nov 2023 13:53:48 +0100 Subject: [PATCH] refactor(replication): Renames FTransformRep to FReplicatedTransform --- Config/DefaultRWTHVRToolkit.ini | 3 ++- .../Private/Core/ClientTransformReplication.cpp | 4 ++-- .../Core/{VRTransformRep.h => ReplicatedTransform.h} | 6 +++--- .../Private/Pawn/ReplicatedCameraComponent.cpp | 4 ++-- .../Private/Pawn/ReplicatedMotionControllerComponent.cpp | 4 ++-- .../RWTHVRToolkit/Public/Core/ClientTransformReplication.h | 6 +++--- .../RWTHVRToolkit/Public/Pawn/ReplicatedCameraComponent.h | 6 +++--- .../Public/Pawn/ReplicatedMotionControllerComponent.h | 6 +++--- 8 files changed, 20 insertions(+), 19 deletions(-) rename Source/RWTHVRToolkit/Private/Core/{VRTransformRep.h => ReplicatedTransform.h} (92%) diff --git a/Config/DefaultRWTHVRToolkit.ini b/Config/DefaultRWTHVRToolkit.ini index 193e4efa..60fb5b2d 100644 --- a/Config/DefaultRWTHVRToolkit.ini +++ b/Config/DefaultRWTHVRToolkit.ini @@ -2,4 +2,5 @@ +PackageRedirects=(OldName="/nDisplayExtensions",NewName="/RWTHVRToolkit",MatchSubstring=true) +PackageRedirects=(OldName="/DisplayClusterExtensions",NewName="/RWTHVRToolkit",MatchSubstring=true) +ClassRedirects=(OldName="/Script/RWTHVRToolkit.VirtualRealityPawn",NewName="/Script/RWTHVRToolkit.RWTHVRPawn") -+ClassRedirects=(OldName="/Script/RWTHVRToolkit.VRPawnMovement",NewName="/Script/RWTHVRToolkit.CollisionHandlingMovement") \ No newline at end of file ++ClassRedirects=(OldName="/Script/RWTHVRToolkit.VRPawnMovement",NewName="/Script/RWTHVRToolkit.CollisionHandlingMovement") ++StructRedirects=(OldName="/Script/RWTHVRToolkit.VRTransformRep",NewName="/Script/RWTHVRToolkit.ReplicatedTransform") \ No newline at end of file diff --git a/Source/RWTHVRToolkit/Private/Core/ClientTransformReplication.cpp b/Source/RWTHVRToolkit/Private/Core/ClientTransformReplication.cpp index 08651d74..5063c9cf 100644 --- a/Source/RWTHVRToolkit/Private/Core/ClientTransformReplication.cpp +++ b/Source/RWTHVRToolkit/Private/Core/ClientTransformReplication.cpp @@ -77,7 +77,7 @@ void UClientTransformReplication::GetLifetimeReplicatedProps(TArray<class FLifet } // Apply the state update on the server -void UClientTransformReplication::ServerSendControllerTransformRpc_Implementation(FVRTransformRep NewTransform) +void UClientTransformReplication::ServerSendControllerTransformRpc_Implementation(FReplicatedTransform NewTransform) { // Store new transform and trigger OnRep_Function ReplicatedTransform = NewTransform; @@ -90,7 +90,7 @@ void UClientTransformReplication::ServerSendControllerTransformRpc_Implementatio OnRep_ReplicatedTransform(); } -bool UClientTransformReplication::ServerSendControllerTransformRpc_Validate(FVRTransformRep NewTransform) +bool UClientTransformReplication::ServerSendControllerTransformRpc_Validate(FReplicatedTransform NewTransform) { return true; // Optionally check to make sure that player is inside of their bounds and deny it if they aren't? diff --git a/Source/RWTHVRToolkit/Private/Core/VRTransformRep.h b/Source/RWTHVRToolkit/Private/Core/ReplicatedTransform.h similarity index 92% rename from Source/RWTHVRToolkit/Private/Core/VRTransformRep.h rename to Source/RWTHVRToolkit/Private/Core/ReplicatedTransform.h index c9bc577b..17953b8f 100644 --- a/Source/RWTHVRToolkit/Private/Core/VRTransformRep.h +++ b/Source/RWTHVRToolkit/Private/Core/ReplicatedTransform.h @@ -1,11 +1,11 @@ #pragma once #include "CoreMinimal.h" -#include "VRTransformRep.generated.h" +#include "ReplicatedTransform.generated.h" // Simple custom transform struct for more efficient repliation, from VRE Plugin USTRUCT() -struct RWTHVRTOOLKIT_API FVRTransformRep +struct RWTHVRTOOLKIT_API FReplicatedTransform { GENERATED_USTRUCT_BODY() @@ -16,7 +16,7 @@ public: UPROPERTY(Transient) FRotator Rotation; - FVRTransformRep() + FReplicatedTransform() { Position = FVector::ZeroVector; Rotation = FRotator::ZeroRotator; diff --git a/Source/RWTHVRToolkit/Private/Pawn/ReplicatedCameraComponent.cpp b/Source/RWTHVRToolkit/Private/Pawn/ReplicatedCameraComponent.cpp index be9d5221..970b6503 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/ReplicatedCameraComponent.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/ReplicatedCameraComponent.cpp @@ -66,7 +66,7 @@ void UReplicatedCameraComponent::GetLifetimeReplicatedProps(TArray<class FLifeti DOREPLIFETIME(UReplicatedCameraComponent, ControllerNetUpdateRate); } -void UReplicatedCameraComponent::ServerSendControllerTransformRpc_Implementation(FVRTransformRep NewTransform) +void UReplicatedCameraComponent::ServerSendControllerTransformRpc_Implementation(FReplicatedTransform NewTransform) { // Store new transform and trigger OnRep_Function ReplicatedTransform = NewTransform; @@ -75,7 +75,7 @@ void UReplicatedCameraComponent::ServerSendControllerTransformRpc_Implementation OnRep_ReplicatedTransform(); } -bool UReplicatedCameraComponent::ServerSendControllerTransformRpc_Validate(FVRTransformRep NewTransform) +bool UReplicatedCameraComponent::ServerSendControllerTransformRpc_Validate(FReplicatedTransform NewTransform) { return true; // Optionally check to make sure that player is inside of their bounds and deny it if they aren't? diff --git a/Source/RWTHVRToolkit/Private/Pawn/ReplicatedMotionControllerComponent.cpp b/Source/RWTHVRToolkit/Private/Pawn/ReplicatedMotionControllerComponent.cpp index 21da54cb..7de46b1f 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/ReplicatedMotionControllerComponent.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/ReplicatedMotionControllerComponent.cpp @@ -69,7 +69,7 @@ void UReplicatedMotionControllerComponent::GetLifetimeReplicatedProps( // See UClientTransformReplication::ServerSendControllerTransformRpc_Implementation void UReplicatedMotionControllerComponent::ServerSendControllerTransformRpc_Implementation( - FVRTransformRep NewTransform) + FReplicatedTransform NewTransform) { // Store new transform and trigger OnRep_Function ReplicatedTransform = NewTransform; @@ -78,7 +78,7 @@ void UReplicatedMotionControllerComponent::ServerSendControllerTransformRpc_Impl OnRep_ReplicatedTransform(); } -bool UReplicatedMotionControllerComponent::ServerSendControllerTransformRpc_Validate(FVRTransformRep NewTransform) +bool UReplicatedMotionControllerComponent::ServerSendControllerTransformRpc_Validate(FReplicatedTransform NewTransform) { return true; // Optionally check to make sure that player is inside of their bounds and deny it if they aren't? diff --git a/Source/RWTHVRToolkit/Public/Core/ClientTransformReplication.h b/Source/RWTHVRToolkit/Public/Core/ClientTransformReplication.h index 3c6eda9c..7791947c 100644 --- a/Source/RWTHVRToolkit/Public/Core/ClientTransformReplication.h +++ b/Source/RWTHVRToolkit/Public/Core/ClientTransformReplication.h @@ -4,7 +4,7 @@ #include "CoreMinimal.h" #include "Components/ActorComponent.h" -#include "Core/VRTransformRep.h" +#include "Core/ReplicatedTransform.h" #include "ClientTransformReplication.generated.h" @@ -44,7 +44,7 @@ protected: // Replicated transform property - used to replicate from server to all non-owning clients UPROPERTY(EditDefaultsOnly, ReplicatedUsing = OnRep_ReplicatedTransform, Category = "Networking") - FVRTransformRep ReplicatedTransform; + FReplicatedTransform ReplicatedTransform; // Called whenever ReplicatedTransform is replicated to clients. Not called on Owning client, manually called on server UFUNCTION() @@ -59,7 +59,7 @@ protected: // Unreliable Server RPC that sends the transform from owning client to the server UFUNCTION(Unreliable, Server, WithValidation) - void ServerSendControllerTransformRpc(FVRTransformRep NewTransform); + void ServerSendControllerTransformRpc(FReplicatedTransform NewTransform); // Function called each tick that checks if we need to send a new state from our local net owner to the server. void UpdateState(float DeltaTime); diff --git a/Source/RWTHVRToolkit/Public/Pawn/ReplicatedCameraComponent.h b/Source/RWTHVRToolkit/Public/Pawn/ReplicatedCameraComponent.h index 7657f0c9..a68cee69 100644 --- a/Source/RWTHVRToolkit/Public/Pawn/ReplicatedCameraComponent.h +++ b/Source/RWTHVRToolkit/Public/Pawn/ReplicatedCameraComponent.h @@ -4,7 +4,7 @@ #include "CoreMinimal.h" #include "Camera/CameraComponent.h" -#include "Core/VRTransformRep.h" +#include "Core/ReplicatedTransform.h" #include "ReplicatedCameraComponent.generated.h" /** @@ -37,7 +37,7 @@ protected: float ControllerNetUpdateCount; UPROPERTY(EditDefaultsOnly, ReplicatedUsing = OnRep_ReplicatedTransform, Category = "Networking") - FVRTransformRep ReplicatedTransform; + FReplicatedTransform ReplicatedTransform; void UpdateState(float DeltaTime); @@ -50,7 +50,7 @@ protected: } UFUNCTION(Unreliable, Server, WithValidation) - void ServerSendControllerTransformRpc(FVRTransformRep NewTransform); + void ServerSendControllerTransformRpc(FReplicatedTransform NewTransform); public: // Called every frame diff --git a/Source/RWTHVRToolkit/Public/Pawn/ReplicatedMotionControllerComponent.h b/Source/RWTHVRToolkit/Public/Pawn/ReplicatedMotionControllerComponent.h index 030f9a00..a743dbf8 100644 --- a/Source/RWTHVRToolkit/Public/Pawn/ReplicatedMotionControllerComponent.h +++ b/Source/RWTHVRToolkit/Public/Pawn/ReplicatedMotionControllerComponent.h @@ -4,7 +4,7 @@ #include "CoreMinimal.h" #include "MotionControllerComponent.h" -#include "Core/VRTransformRep.h" +#include "Core/ReplicatedTransform.h" #include "ReplicatedMotionControllerComponent.generated.h" /** @@ -33,7 +33,7 @@ protected: float ControllerNetUpdateCount; UPROPERTY(EditDefaultsOnly, ReplicatedUsing = OnRep_ReplicatedTransform, Category = "Networking") - FVRTransformRep ReplicatedTransform; + FReplicatedTransform ReplicatedTransform; /* * See UClientTransformReplication for a description of the replication functions, they work exactly the same way. @@ -48,7 +48,7 @@ protected: } UFUNCTION(Unreliable, Server, WithValidation) - void ServerSendControllerTransformRpc(FVRTransformRep NewTransform); + void ServerSendControllerTransformRpc(FReplicatedTransform NewTransform); public: // Called every frame -- GitLab