make FSGXRTracker::GetMotionControllerData() behave the same as 5.4 on both 5.2 and 5.3

This commit is contained in:
Mamadou Babaei
2024-07-11 15:40:46 +02:00
parent f174c6675d
commit 6b71f2500c
3 changed files with 27 additions and 8 deletions
@@ -41,12 +41,15 @@
#include "Engine/SkeletalMesh.h"
#include "Engine/World.h"
#include "GameFramework/WorldSettings.h"
#if ENGINE_MAJOR_VERSION > 5 && ENGINE_MINOR_VERSION >= 4
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 4
#include "IOpenXRHMD.h"
#endif /* ENGINE_MAJOR_VERSION > 5 && ENGINE_MINOR_VERSION >= 4 */
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 4 */
#include "IOpenXRHMDModule.h"
#include "IXRTrackingSystem.h"
#include "OpenXRCore.h"
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION <= 3
#include "OpenXRHMD.h"
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION <= 3 */
#include "Runtime/Launch/Resources/Version.h"
#include "SGCore/SGHapticGlove.h"
@@ -996,8 +999,11 @@ bool FSGXRTracker::GetMotionControllerData(
return false;
}
#if ENGINE_MAJOR_VERSION > 5 && ENGINE_MINOR_VERSION >= 4
#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;
@@ -1158,9 +1164,6 @@ bool FSGXRTracker::GetMotionControllerData(
/// TODO
// This is reportedly a WMR-specific convenience function for rapid prototyping. Not sure if it's useful for OpenXR.
OutMotionControllerData.bIsGrasped = false;
#else /* ENGINE_MAJOR_VERSION > 5 && ENGINE_MINOR_VERSION >= 4 */
XRTrackingSystem->GetMotionControllerData(WorldContextObject, Hand, OutMotionControllerData);
#endif /* ENGINE_MAJOR_VERSION > 5 && ENGINE_MINOR_VERSION >= 4 */
return OutMotionControllerData.bValid;
}
@@ -34,6 +34,7 @@
using System;
using System.IO;
using UnrealBuildTool;
public class SenseGloveTracking : ModuleRules
@@ -66,6 +67,23 @@ 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[]
{