drop support for unreal engine 5.4

This commit is contained in:
Mamadou Babaei
2026-02-17 16:03:02 +01:00
parent b01ce25abe
commit eb7ec1773f
16 changed files with 28 additions and 545 deletions
+5
View File
@@ -25,6 +25,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Bumped the SenseGlove Unreal Engine Marketplace Packager to `v0.6.1-85c5a6e`.
- Bumped the copyright years.
### Removed
- Dropped support for Unreal Engine `5.4`, which was already deprecated via the `v2.7.x` release series.
- Dropped support for Epic Native/Cross Toolchains `v22` (previously used for building UE `5.3` and `5.4` Linux dependencies), as they were already deprecated via previous releases.
### Documentation
- Ensure deterministic dependency builds by pinning Rust toolchain.
@@ -107,7 +107,6 @@ void FSGVirtualHandAnimInstanceProxy::PreEvaluateAnimation(UAnimInstance* InAnim
return;
}
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
HandTrackingState = VirtualHand->GetHandTrackingState();
if (!HandTrackingState.bValid)
{
@@ -115,26 +114,11 @@ void FSGVirtualHandAnimInstanceProxy::PreEvaluateAnimation(UAnimInstance* InAnim
}
ensureAlwaysMsgf(HandTrackingState.HandKeyLocations.Num() == HandTrackingState.HandKeyRotations.Num(),
TEXT("Mismatched hand tracking state locations and rotations!"));
#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
MotionControllerData = VirtualHand->GetMotionControllerData();
if (!MotionControllerData.bValid)
{
return;
}
ensureAlwaysMsgf(MotionControllerData.HandKeyPositions.Num() == MotionControllerData.HandKeyRotations.Num(),
TEXT("Mismatched motion controller data positions and rotations!"));
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
BoneNamesMap.Empty();
for (TArray<FQuat>::SizeType HandKeyIndex = 0;
HandKeyIndex <
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
HandTrackingState.HandKeyRotations.Num()
#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
MotionControllerData.HandKeyRotations.Num()
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
; ++HandKeyIndex)
HandKeyIndex < HandTrackingState.HandKeyRotations.Num();
++HandKeyIndex)
{
const FName& BoneName{VirtualHand->GetHandBoneName(HandKeyIndex)};
BoneNamesMap.Add(HandKeyIndex, BoneName);
@@ -152,17 +136,10 @@ bool FSGVirtualHandAnimInstanceProxy::Evaluate(FPoseContext& Output)
return FAnimInstanceProxy::Evaluate(Output);
}
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
if (!HandTrackingState.bValid)
{
return FAnimInstanceProxy::Evaluate(Output);
}
#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
if (!MotionControllerData.bValid)
{
return FAnimInstanceProxy::Evaluate(Output);
}
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
FComponentSpacePoseContext PoseContext{Output.AnimInstanceProxy};
PoseContext.Pose.InitPose(Output.Pose);
@@ -187,15 +164,9 @@ bool FSGVirtualHandAnimInstanceProxy::Evaluate(FPoseContext& Output)
BoneReference.BoneIndex = BoneIndex;
BoneReference.bUseSkeletonIndex = true;
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
const FVector& HandKeyLocation{HandTrackingState.HandKeyLocations[HandKeyIndex]};
const FQuat& HandKeyRotation{HandTrackingState.HandKeyRotations[HandKeyIndex]};
const FTransform HandKeyTransform{HandKeyRotation, HandKeyLocation};
#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
const FVector& HandKeyPosition{MotionControllerData.HandKeyPositions[HandKeyIndex]};
const FQuat& HandKeyRotation{MotionControllerData.HandKeyRotations[HandKeyIndex]};
const FTransform HandKeyTransform{HandKeyRotation, HandKeyPosition};
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
const FTransform BoneTransform{AnimationBoneCorrectionOffsetTransform * HandKeyTransform};
FRotator BoneRotation{BoneTransform.GetRotation().Rotator()};
@@ -99,13 +99,7 @@ struct USGVirtualHandComponent::FImpl
ECollisionEnabled::Type CachedCollisionEnabled;
FCollisionResponseContainer CachedCollisionResponse;
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION < 7
FXRMotionControllerData MotionControllerData;
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION < 7 */
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
FXRHandTrackingState HandTrackingState;
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
/************************
* Owner object
@@ -247,11 +241,7 @@ USGVirtualHandComponent::USGVirtualHandComponent(const FObjectInitializer& Objec
Super::SetCollisionResponseToChannel(ECC_Vehicle, ECR_Block);
Super::SetCollisionResponseToChannel(ECC_Destructible, ECR_Block);
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
Super::SetAnimInstanceClass(USGVirtualHandAnimInstance::StaticClass());
#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
Super::SetAnimClass(USGVirtualHandAnimInstance::StaticClass());
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
bRight = true;
@@ -314,7 +304,6 @@ FSGVirtualHandSettings USGVirtualHandComponent::GetVirtualHandSettings() const
return VirtualHandSettings;
}
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
void USGVirtualHandComponent::SetAnimInstanceClass(UClass* NewClass)
{
ensureAlwaysMsgf((TIsDerivedFrom<decltype(NewClass), USGVirtualHandAnimInstance>::IsDerived),
@@ -322,15 +311,6 @@ void USGVirtualHandComponent::SetAnimInstanceClass(UClass* NewClass)
Super::SetAnimInstanceClass(NewClass);
}
#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
void USGVirtualHandComponent::SetAnimClass(UClass* NewClass)
{
ensureAlwaysMsgf((TIsDerivedFrom<decltype(NewClass), USGVirtualHandAnimInstance>::IsDerived),
TEXT("The AnimInstance class must be a subclass of USGVirtualHandAnimInstance!"));
Super::SetAnimClass(NewClass);
}
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
void USGVirtualHandComponent::PostInitProperties()
{
@@ -476,12 +456,10 @@ USGHapticGlove* USGVirtualHandComponent::GetConnectedGlove() const
return Glove;
}
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
const FXRHandTrackingState& USGVirtualHandComponent::GetHandTrackingState() const
{
return Pimpl->HandTrackingState;
}
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
const TArray<FName>& USGVirtualHandComponent::GetHandBoneNames() const
{
@@ -754,34 +732,14 @@ void USGVirtualHandComponent::FImpl::UpdateXRData()
{
const EControllerHand Hand = Owner->IsRight() ? EControllerHand::Right : EControllerHand::Left;
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION < 7
{
FXRMotionControllerData Data;
Data.bValid = false;
FXRHandTrackingState State;
State.bValid = false;
const bool bGotHandTrackingState =
FSGXRTracker::GetHandTrackingState(
Owner, EXRSpaceType::UnrealWorldSpace, Hand, State);
PRAGMA_DISABLE_DEPRECATION_WARNINGS
const bool bGotMotionControllerData =
FSGXRTracker::GetMotionControllerData(Owner, Hand, Data);
PRAGMA_ENABLE_DEPRECATION_WARNINGS
(void)
bGotMotionControllerData;
MotionControllerData = MoveTemp(Data);
}
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION < 7 */
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
{
FXRHandTrackingState State;
State.bValid = false;
const bool bGotHandTrackingState =
FSGXRTracker::GetHandTrackingState(
Owner, EXRSpaceType::UnrealWorldSpace, Hand, State);
(void) bGotHandTrackingState;
HandTrackingState = MoveTemp(State);
}
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
(void) bGotHandTrackingState;
HandTrackingState = MoveTemp(State);
}
void USGVirtualHandComponent::FImpl::SetVisibility(const bool bInVisible)
@@ -802,14 +760,7 @@ void USGVirtualHandComponent::FImpl::SetVisibility(const bool bInVisible)
void USGVirtualHandComponent::FImpl::UpdateVisibility()
{
const bool bHandDataAvailable =
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
HandTrackingState.bValid
#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
MotionControllerData.bValid
&& MotionControllerData.DeviceVisualType == EXRVisualType::Hand
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
;
const bool bHandDataAvailable = HandTrackingState.bValid;
const bool bHandVisible = Owner->IsVisible();
const bool bShouldBeVisibleWhenHandDataUnavailable =
Owner->GetVirtualHandSettings().bVisibleWhenHandDataUnavailable;
@@ -868,23 +819,12 @@ void USGVirtualHandComponent::FImpl::DrawDebugVirtualHand() const
return;
}
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
if (!HandTrackingState.bValid)
{
return;
}
FSGDebugVirtualHand::Draw(World, HandTrackingState, Owner->GetVirtualHandSettings().DebuggingSettings);
#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
if (!MotionControllerData.bValid
|| MotionControllerData.DeviceVisualType == EXRVisualType::Hand)
{
return;
}
FSGDebugVirtualHand::Draw(World, MotionControllerData, Owner->GetVirtualHandSettings().DebuggingSettings);
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
}
void USGVirtualHandComponent::FImpl::TriggerHandVisibilityChangedEvent(const bool bNewVisibility) const
@@ -56,13 +56,7 @@ struct USGWristTrackerComponent::FImpl
bool bOverridePluginSettingsPropertyAlreadyModified;
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION < 7
FXRMotionControllerData MotionControllerData;
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION < 7 */
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
FXRHandTrackingState HandTrackingState;
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
/************************
* Owner object
@@ -257,19 +251,10 @@ void USGWristTrackerComponent::EditorTick(
Pimpl->UpdateWristTrackingData();
}
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION < 7
const FXRMotionControllerData& USGWristTrackerComponent::GetMotionControllerData() const
{
return Pimpl->MotionControllerData;
}
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION < 7 */
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
const FXRHandTrackingState& USGWristTrackerComponent::GetHandTrackingState() const
{
return Pimpl->HandTrackingState;
}
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
USGWristTrackerComponent::FImpl::FImpl(USGWristTrackerComponent* InOwner)
: bOverridePluginSettingsPropertyAlreadyModified(false),
@@ -333,34 +318,14 @@ void USGWristTrackerComponent::FImpl::UpdateXRData()
{
const EControllerHand Hand = Owner->IsRight() ? EControllerHand::Right : EControllerHand::Left;
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION < 7
{
FXRMotionControllerData Data;
Data.bValid = false;
FXRHandTrackingState State;
State.bValid = false;
const bool bGotHandTrackingState =
FSGXRTracker::GetHandTrackingState(
Owner, EXRSpaceType::UnrealWorldSpace, Hand, State);
PRAGMA_DISABLE_DEPRECATION_WARNINGS
const bool bGotMotionControllerData =
FSGXRTracker::GetMotionControllerData(Owner, Hand, Data);
PRAGMA_ENABLE_DEPRECATION_WARNINGS
(void)
bGotMotionControllerData;
MotionControllerData = MoveTemp(Data);
}
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION < 7 */
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
{
FXRHandTrackingState State;
State.bValid = false;
const bool bGotHandTrackingState =
FSGXRTracker::GetHandTrackingState(
Owner, EXRSpaceType::UnrealWorldSpace, Hand, State);
(void) bGotHandTrackingState;
HandTrackingState = MoveTemp(State);
}
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
(void) bGotHandTrackingState;
HandTrackingState = MoveTemp(State);
}
void USGWristTrackerComponent::FImpl::UpdateWristTrackingData() const
@@ -200,9 +200,7 @@ void USGGameUserSettings::SetEngineScalabilitySettings(ESGEngineScalabilitySetti
ScalabilityQuality.SetEffectsQuality(ScalabilityValue);
ScalabilityQuality.SetFoliageQuality(ScalabilityValue);
ScalabilityQuality.SetShadingQuality(ScalabilityValue);
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 4
ScalabilityQuality.SetLandscapeQuality(ScalabilityValue);
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 4 */
}
else
{
@@ -275,9 +273,7 @@ bool USGGameUserSettings::FImpl::DoesCurrentSettingsMatch(const ESGEngineScalabi
const int32 CurrentEffectQuality = Owner->ScalabilityQuality.EffectsQuality;
const int32 CurrentFoliageQuality = Owner->ScalabilityQuality.FoliageQuality;
const int32 CurrentShadingQuality = Owner->ScalabilityQuality.ShadingQuality;
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 4
const int32 CurrentLandscapeQuality = Owner->ScalabilityQuality.LandscapeQuality;
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 4 */
if (FMath::IsNearlyEqual(CurrentResolutionScaleNormalized, ResolutionScaleNormalized)
&& CurrentViewDistanceQuality == ScalabilityValue
@@ -290,10 +286,7 @@ bool USGGameUserSettings::FImpl::DoesCurrentSettingsMatch(const ESGEngineScalabi
&& CurrentEffectQuality == ScalabilityValue
&& CurrentFoliageQuality == ScalabilityValue
&& CurrentShadingQuality == ScalabilityValue
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 4
&& CurrentLandscapeQuality == ScalabilityValue
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 4 */
)
&& CurrentLandscapeQuality == ScalabilityValue)
{
return true;
}
@@ -2193,13 +2193,7 @@ void ASGPawn::FImpl::RecordHandVelocity(FSGGrabState& GrabState, const float Del
{
if (GrabState.HandVelocityHistory.IsValidIndex(0))
{
GrabState.HandVelocityHistory.RemoveAt(0, 1,
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
EAllowShrinking::No
#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
false
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
);
GrabState.HandVelocityHistory.RemoveAt(0, 1, EAllowShrinking::No);
GrabState.HandVelocityHistory.Emplace(MoveTemp(HandVelocity));
}
}
@@ -68,11 +68,7 @@ private:
bool bVirtualHandVisible;
bool bMarkRenderStateDirty;
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
FXRHandTrackingState HandTrackingState;
#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
FXRMotionControllerData MotionControllerData;
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
TMap<TArray<FQuat>::SizeType, FName> BoneNamesMap;
@@ -109,17 +105,10 @@ protected:
return bMarkRenderStateDirty;
}
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
FORCEINLINE const FXRHandTrackingState& GetHandTrackingState() const
{
return HandTrackingState;
}
#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
FORCEINLINE const FXRMotionControllerData& GetMotionControllerData() const
{
return MotionControllerData;
}
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
FORCEINLINE const TMap<TArray<FQuat>::SizeType, FName>& GetBoneNamesMap() const
{
@@ -146,11 +146,7 @@ public:
}
public:
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
virtual void SetAnimInstanceClass(class UClass* NewClass) override;
#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
virtual void SetAnimClass(class UClass* NewClass) override;
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
virtual void SetAnimInstanceClass(UClass* NewClass) override;
virtual void PostInitProperties() override;
@@ -181,9 +177,7 @@ public:
bool IsGloveConnected() const;
USGHapticGlove* GetConnectedGlove() const;
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
const FXRHandTrackingState& GetHandTrackingState() const;
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
public:
const TArray<FName>& GetHandBoneNames() const;
@@ -165,7 +165,5 @@ protected:
FActorComponentTickFunction* ThisTickFunction);
public:
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
const FXRHandTrackingState& GetHandTrackingState() const;
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
};
@@ -44,7 +44,6 @@
#include "SGDebug/SGDebugCube.h"
#include "SGDebug/SGDebugGizmo.h"
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
void FSGDebugVirtualHand::Draw(
const UWorld* World,
const FXRHandTrackingState& HandTrackingState,
@@ -115,5 +114,4 @@ void FSGDebugVirtualHand::Draw(
FSGDebugGizmo::Draw(World, HandKeyLocation, HandKeyRotation, Settings);
}
}
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
}
@@ -48,7 +48,6 @@ class UWorld;
class SENSEGLOVEDEBUG_API FSGDebugVirtualHand final
{
public:
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
static void Draw(
const UWorld* World,
const FXRHandTrackingState& HandTrackingState,
@@ -58,7 +57,6 @@ public:
const UWorld* World,
const FXRHandTrackingState& HandTrackingState,
const FSGDebugGizmoSettings& Settings);
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
public:
FSGDebugVirtualHand() = delete;
@@ -37,18 +37,14 @@
#include "Runtime/Launch/Resources/Version.h"
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
#include "Async/Async.h"
#include "Async/Future.h"
#include "Async/TaskGraphInterfaces.h"
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
#include "Engine/Engine.h"
#include "IHeadMountedDisplay.h"
#include "IXRTrackingSystem.h"
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
#include "Misc/Optional.h"
#include "Misc/Timespan.h"
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
#include "SGSettings/SGSettings.h"
@@ -72,12 +68,6 @@ struct FSGHMDTracker::FStaticImpl
void FSGHMDTracker::FStaticImpl::GetHMDMonitorInfo(
IHeadMountedDisplay* Device, IHeadMountedDisplay::MonitorInfo& OutMonitorInfo)
{
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION <= 4
Device->GetHMDMonitorInfo(OutMonitorInfo);
return;
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION <= 4 */
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
TPromise<TOptional<IHeadMountedDisplay::MonitorInfo>> Promise;
const TFuture<TOptional<IHeadMountedDisplay::MonitorInfo>> Future{Promise.GetFuture()};
@@ -100,7 +90,6 @@ void FSGHMDTracker::FStaticImpl::GetHMDMonitorInfo(
OutMonitorInfo = Result.GetValue();
}
}
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
}
FName FSGHMDTracker::GetDeviceName()
@@ -35,26 +35,20 @@
#include "SGTracking/SGXRTracker.h"
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
#include "Async/Async.h"
#include "Async/Future.h"
#include "Async/TaskGraphInterfaces.h"
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
#include "Containers/Array.h"
#include "Containers/Map.h"
#include "Engine/Engine.h"
#include "Engine/SkeletalMesh.h"
#include "Engine/World.h"
#include "GameFramework/WorldSettings.h"
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 4
#include "IOpenXRHMD.h"
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 4 */
#include "IOpenXRHMDModule.h"
#include "IXRTrackingSystem.h"
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
#include "Misc/Optional.h"
#include "Misc/Timespan.h"
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
#include "OpenXRCore.h"
#include "SGCore/SGHapticGlove.h"
@@ -1013,237 +1007,6 @@ FTransform FSGXRTracker::FImpl::GetMeshFingerStartBoneRefTransform(
return Transform;
}
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION < 7
bool FSGXRTracker::GetMotionControllerData(
UObject* WorldContextObject,
const EControllerHand Hand,
FXRMotionControllerData& OutMotionControllerData)
{
OutMotionControllerData.DeviceName = NAME_None;
OutMotionControllerData.ApplicationInstanceID = FApp::GetInstanceId();
OutMotionControllerData.DeviceVisualType = EXRVisualType::Controller;
OutMotionControllerData.TrackingStatus = ETrackingStatus::NotTracked;
OutMotionControllerData.HandIndex = Hand;
OutMotionControllerData.bValid = false;
if (!IsValid(WorldContextObject))
{
return false;
}
IXRTrackingSystem* XRTrackingSystem{GEngine ? GEngine->XRSystem.Get() : nullptr};
if (!XRTrackingSystem)
{
return false;
}
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 4
IOpenXRHMD* OpenXRHMD{XRTrackingSystem->GetIOpenXRHMD()};
#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 4 */
FOpenXRHMD* OpenXRHMD{static_cast<FOpenXRHMD*>(GEngine->XRSystem.Get())};
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 4 */
if (!OpenXRHMD)
{
return false;
}
TArray<int32> Devices;
const int32 HandIndex = static_cast<int32>(Hand);
const bool bGotDevices =
XRTrackingSystem->EnumerateTrackedDevices(Devices, EXRTrackedDeviceType::Controller);
if (bGotDevices && Devices.IsValidIndex(HandIndex))
{
const XrSession Session{OpenXRHMD->GetSession()};
if (Session)
{
XrInteractionProfileState Profile = {XR_TYPE_INTERACTION_PROFILE_STATE};
const XrPath TopLevelUserPath{OpenXRHMD->GetTrackedDevicePath(Devices[HandIndex])};
const XrResult CurrentInteractionProfile{
xrGetCurrentInteractionProfile(Session, TopLevelUserPath, &Profile)
};
if (XR_SUCCEEDED(CurrentInteractionProfile) && Profile.interactionProfile != XR_NULL_PATH)
{
OutMotionControllerData.DeviceName = FOpenXRPath(Profile.interactionProfile);
}
}
}
static const FName HandTrackerName{"OpenXRHandTracking"};
TArray<IHandTracker*> HandTrackers = IModularFeatures::Get().GetModularFeatureImplementations<IHandTracker>(
IHandTracker::GetModularFeatureName());
IHandTracker* HandTracker{nullptr};
for (IHandTracker* HandTrackerIterator: HandTrackers)
{
if (!HandTrackerIterator)
{
continue;
}
const FName DeviceTypeName{HandTrackerIterator->GetHandTrackerDeviceTypeName()};
if (DeviceTypeName != HandTrackerName)
{
continue;
}
FSGXRTracker* SGXRTracker{static_cast<FSGXRTracker*>(HandTrackerIterator)};
if (!SGXRTracker)
{
continue;
}
HandTracker = SGXRTracker;
break;
}
if (Hand == EControllerHand::Left || Hand == EControllerHand::Right)
{
static const FName MotionControllerName("OpenXR");
TArray<IMotionController*> MotionControllers{
IModularFeatures::Get().GetModularFeatureImplementations<IMotionController>(
IMotionController::GetModularFeatureName())
};
IMotionController* MotionController{nullptr};
for (IMotionController* MotionControllerIterator: MotionControllers)
{
if (!MotionControllerIterator)
{
continue;
}
const FName DeviceTypeName{MotionControllerIterator->GetMotionControllerDeviceTypeName()};
if (DeviceTypeName != MotionControllerName)
{
continue;
}
MotionController = MotionControllerIterator;
break;
}
const float WorldToMeters = XRTrackingSystem->GetWorldToMetersScale();
if (MotionController)
{
const FTransform TrackingToWorld{XRTrackingSystem->GetTrackingToWorldTransform()};
{
const FName AimSource{Hand == EControllerHand::Left ? FName{TEXT("LeftAim")} : FName{TEXT("RightAim")}};
FRotator AimSourceRotation;
FVector AimSourcePosition;
const bool bGotAimOrientationAndPosition =
MotionController->GetControllerOrientationAndPosition(
0, AimSource, AimSourceRotation, AimSourcePosition, WorldToMeters);
if (bGotAimOrientationAndPosition)
{
OutMotionControllerData.AimPosition = TrackingToWorld.TransformPosition(AimSourcePosition);
OutMotionControllerData.AimRotation =
TrackingToWorld.TransformRotation(AimSourceRotation.Quaternion());
}
OutMotionControllerData.bValid |= bGotAimOrientationAndPosition;
}
const FName GripSource{Hand == EControllerHand::Left ? FName{TEXT("LeftGrip")} : FName{TEXT("RightGrip")}};
{
FRotator GripRotation;
FVector GripPosition;
const bool bGotGripSourceOrientationAndPosition =
MotionController->GetControllerOrientationAndPosition(
0, GripSource, GripRotation, GripPosition, WorldToMeters);
if (bGotGripSourceOrientationAndPosition)
{
OutMotionControllerData.GripPosition = TrackingToWorld.TransformPosition(GripPosition);
OutMotionControllerData.GripRotation =
TrackingToWorld.TransformRotation(GripRotation.Quaternion());
}
OutMotionControllerData.bValid |= bGotGripSourceOrientationAndPosition;
}
{
const FName PalmSource{
Hand == EControllerHand::Left ? FName{TEXT("LeftPalm")} : FName{TEXT("RightPalm")}
};
FRotator PalmRotation;
FVector PalmPosition;
const bool bGotPalmOrientationAndPosition = MotionController->GetControllerOrientationAndPosition(
0, PalmSource, PalmRotation, PalmPosition, WorldToMeters);
if (bGotPalmOrientationAndPosition)
{
OutMotionControllerData.GripPosition = TrackingToWorld.TransformPosition(PalmPosition);
OutMotionControllerData.GripRotation =
TrackingToWorld.TransformRotation(PalmRotation.Quaternion());
}
OutMotionControllerData.bValid |= bGotPalmOrientationAndPosition;
}
OutMotionControllerData.TrackingStatus = MotionController->GetControllerTrackingStatus(0, GripSource);
}
const bool bHandTrackingStateValid = HandTracker && HandTracker->IsHandTrackingStateValid();
if (bHandTrackingStateValid)
{
OutMotionControllerData.DeviceVisualType = EXRVisualType::Hand;
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
bool bTracked = false;
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
OutMotionControllerData.bValid = HandTracker->GetAllKeypointStates(
Hand,
OutMotionControllerData.HandKeyPositions,
OutMotionControllerData.HandKeyRotations,
OutMotionControllerData.HandKeyRadii
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
, bTracked
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
);
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
// Unused!
(void) bTracked;
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
// TODO
// Begin backward compatibility with the deprecated function, remove this block along with the deprecated
// GetAllKeypointStates (though it should be time to remove this entire function as well)!
if (!OutMotionControllerData.bValid)
{
PRAGMA_DISABLE_DEPRECATION_WARNINGS
OutMotionControllerData.bValid = HandTracker->GetAllKeypointStates(
Hand,
OutMotionControllerData.HandKeyPositions,
OutMotionControllerData.HandKeyRotations,
OutMotionControllerData.HandKeyRadii);
PRAGMA_ENABLE_DEPRECATION_WARNINGS
}
// End backward compability.
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
if (!ensureAlwaysMsgf(
!OutMotionControllerData.bValid
|| (OutMotionControllerData.HandKeyPositions.Num() == EHandKeypointCount
&& OutMotionControllerData.HandKeyRotations.Num() == EHandKeypointCount
&& OutMotionControllerData.HandKeyRadii.Num() == EHandKeypointCount),
TEXT("Corrupted OutMotionControllerData!")))
{
OutMotionControllerData.bValid = false;
return false;
}
}
}
if (OutMotionControllerData.bValid)
{
OutMotionControllerData.TrackingStatus = ETrackingStatus::Tracked;
}
return OutMotionControllerData.bValid;
}
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION < 7 */
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
bool FSGXRTracker::GetMotionControllerState(
UObject* WorldContextObject,
const EXRSpaceType XRSpaceType, const EControllerHand Hand, const EXRControllerPoseType XRControllerPoseType,
@@ -1313,11 +1076,7 @@ bool FSGXRTracker::GetMotionControllerState(
return false;
}
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 4
IOpenXRHMD* OpenXRHMD{XRTrackingSystem->GetIOpenXRHMD()};
#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 4 */
FOpenXRHMD* OpenXRHMD{static_cast<FOpenXRHMD*>(GEngine->XRSystem.Get())};
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 4 */
if (!OpenXRHMD)
{
return false;
@@ -1450,11 +1209,7 @@ bool FSGXRTracker::GetHandTrackingState(
return false;
}
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 4
IOpenXRHMD* OpenXRHMD{XRTrackingSystem->GetIOpenXRHMD()};
#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 4 */
FOpenXRHMD* OpenXRHMD{static_cast<FOpenXRHMD*>(GEngine->XRSystem.Get())};
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 4 */
if (!OpenXRHMD)
{
return false;
@@ -1486,25 +1241,6 @@ bool FSGXRTracker::GetHandTrackingState(
OutHandTrackingState.HandKeyRadii,
bTracked);
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION < 7
/// TODO
// Begin backward compatibility with the deprecated function, remove this block along with the deprecated
// GetAllKeypointStates.
if (!OutHandTrackingState.bValid)
{
PRAGMA_DISABLE_DEPRECATION_WARNINGS
OutHandTrackingState.bValid = HandTracker->GetAllKeypointStates(
Hand,
OutHandTrackingState.HandKeyLocations,
OutHandTrackingState.HandKeyRotations,
OutHandTrackingState.HandKeyRadii);
PRAGMA_ENABLE_DEPRECATION_WARNINGS
bTracked = OutHandTrackingState.bValid;
// The inability to distinguish this is the reason for the deprecation.
}
// End backward compability.
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION < 7 */
if (!ensureAlwaysMsgf(
!OutHandTrackingState.bValid
|| (OutHandTrackingState.HandKeyLocations.Num() == EHandKeypointCount
@@ -1526,8 +1262,6 @@ bool FSGXRTracker::GetHandTrackingState(
return OutHandTrackingState.bValid;
}
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
FSGXRTracker::FSGXRTracker(const TSharedRef<FGenericApplicationMessageHandler>& InMessageHandler)
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
@@ -1912,17 +1646,10 @@ bool FSGXRTracker::GetKeypointState(
return bGotTransform;
}
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
bool FSGXRTracker::GetAllKeypointStates(
const EControllerHand Hand,
TArray<FVector>& OutPositions, TArray<FQuat>& OutRotations, TArray<float>& OutRadii,
bool& OutIsTracked) const
#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
bool FSGXRTracker::GetAllKeypointStates(
const EControllerHand Hand,
TArray<FVector>& OutPositions, TArray<FQuat>& OutRotations, TArray<float>& OutRadii) const
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5*/
{
if (!IsHandTrackingStateValid())
{
@@ -1948,9 +1675,7 @@ bool FSGXRTracker::GetAllKeypointStates(
return false;
}
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
OutIsTracked = HandState.bTracked;
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5*/
// If we ever received poses we return the last data we received, even if not currently tracking to avoid poping
// back to (0.0f, 0.0f, 0.0f) and the like.
@@ -2216,43 +1941,6 @@ bool FSGXRTracker::FImpl::GetControllerTransform(
IMotionController::GetModularFeatureName())
};
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION <= 4
for (const IMotionController* MotionController: MotionControllers)
{
if (!MotionController)
{
continue;
}
const ETrackingStatus TrackingStatus = MotionController->GetControllerTrackingStatus(
DeviceIndex, PositionalTrackingHardwareMotionSource);
if (TrackingStatus == ETrackingStatus::NotTracked)
{
continue;
}
const FName DeviceTypeName{MotionController->GetMotionControllerDeviceTypeName()};
if (DeviceTypeName != TargetPositionalTrackingProviderName)
{
continue;
}
FRotator Orientation;
FVector Position;
const bool bGotTransform = MotionController->GetControllerOrientationAndPosition(
DeviceIndex, PositionalTrackingHardwareMotionSource,
Orientation, Position, WorldToMetersScale);
if (bGotTransform)
{
OutTransform = FTransform{Orientation, Position};
bOutMotionSourceHandTracking = false;
bTracked = true;
break;
}
}
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION <= 4 */
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
TPromise<TOptional<FTransform>> Promise;
const TFuture<TOptional<FTransform>> Future{Promise.GetFuture()};
@@ -2311,7 +1999,6 @@ bool FSGXRTracker::FImpl::GetControllerTransform(
bTracked = true;
}
}
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
}
if (!bTracked && bFallbackToHandTrackingIfNoGloveDetected)
@@ -55,7 +55,6 @@ class SENSEGLOVETRACKING_API FSGXRTracker final : public IOpenXRExtensionPlugin,
public IHandTracker
{
public:
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
static bool GetMotionControllerState(
UObject* WorldContextObject,
EXRSpaceType XRSpaceType, EControllerHand Hand, EXRControllerPoseType XRControllerPoseType,
@@ -64,7 +63,6 @@ public:
UObject* WorldContextObject,
EXRSpaceType XRSpaceType, EControllerHand Hand,
FXRHandTrackingState& OutHandTrackingState);
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
private:
struct FImpl;
@@ -159,14 +157,8 @@ public:
EControllerHand Hand,
EHandKeypoint Keypoint, FTransform& OutTransform, float& OutRadius) const override;
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
virtual bool GetAllKeypointStates(
EControllerHand Hand,
TArray<FVector>& OutPositions, TArray<FQuat>& OutRotations, TArray<float>& OutRadii,
bool& OutIsTracked) const override;
#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
virtual bool GetAllKeypointStates(
EControllerHand Hand,
TArray<FVector>& OutPositions, TArray<FQuat>& OutRotations, TArray<float>& OutRadii) const override;
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
};
@@ -61,23 +61,6 @@ public class SenseGloveTracking : ModuleRules
}
);
#if ! UE_5_4_OR_LATER
string OpenXRHMDPrivateIncludeDir = Path.GetFullPath(Target.RelativeEnginePath);
OpenXRHMDPrivateIncludeDir = Path.Combine(OpenXRHMDPrivateIncludeDir, "Plugins");
OpenXRHMDPrivateIncludeDir = Path.Combine(OpenXRHMDPrivateIncludeDir, "Runtime");
OpenXRHMDPrivateIncludeDir = Path.Combine(OpenXRHMDPrivateIncludeDir, "OpenXR");
OpenXRHMDPrivateIncludeDir = Path.Combine(OpenXRHMDPrivateIncludeDir, "Source");
OpenXRHMDPrivateIncludeDir = Path.Combine(OpenXRHMDPrivateIncludeDir, "OpenXRHMD");
OpenXRHMDPrivateIncludeDir = Path.Combine(OpenXRHMDPrivateIncludeDir, "Private");
PrivateIncludePaths.AddRange(
new string[]
{
OpenXRHMDPrivateIncludeDir,
}
);
#endif
PrivateDependencyModuleNames.AddRange(
new string[]
{
@@ -55,21 +55,8 @@ UWorld* FSGEngineUtils::GetWorld()
if (IsValid(GEditor))
{
{
const bool bIsPIE =
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
UE::GetPlayInEditorID()
#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
GPlayInEditorID
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
!= -1;
const int32 WorldPIEInstance = bIsPIE
?
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
UE::GetPlayInEditorID()
#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
GPlayInEditorID
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
: 1;
const bool bIsPIE = UE::GetPlayInEditorID() != -1;
const int32 WorldPIEInstance = bIsPIE ? UE::GetPlayInEditorID() : 1;
const FWorldContext* WorldContext{GEditor->GetPIEWorldContext(WorldPIEInstance)};
if (WorldContext)
{