Compare commits

...
17 Commits
Author SHA1 Message Date
Mamadou Babaei 0b9ea54816 bump the plugin version to v2.3.2 2025-01-28 14:39:14 +01:00
Mamadou Babaei 685a4341c7 fix a critical issue where HandStates->GetTransform(KeyPoint) was incorrectly resolving to (&HandStates[0])->GetTransform(KeyPoint), causing both hands to use the left hand's wrist transform under specific conditions 2025-01-28 14:34:20 +01:00
Mamadou Babaei c0ed6f0554 bump the plugin version to v2.3.1 2024-11-27 10:11:14 +01:00
Mamadou Babaei 15aaf4f73c do an ensure check instead of silently ignoring the non-existent joint 2024-11-27 10:11:14 +01:00
Mamadou Babaei e5c11adec3 calculate the bone ref transforms using the current mesh rather than the reference mesh 2024-11-27 10:11:14 +01:00
Mamadou Babaei 5075b0bc17 white space and code formatting fixes 2024-11-27 10:11:14 +01:00
Mamadou Babaei 0c2ab3aa7b bump the plugin version to v2.3.0 2024-11-14 00:30:27 +01:00
Mamadou Babaei 98dba77a02 fix ue 5.5 deprecation warnings inside USGVirtualHandComponent 2024-11-14 00:26:03 +01:00
Mamadou Babaei e152842ead fix rocket build issues by adding missing the headers 2024-11-14 00:26:03 +01:00
Mamadou Babaei 3a59442cda list AndroidPermission plugin as a dependency 2024-11-14 00:26:03 +01:00
Mamadou Babaei 4a3db0b35a remove comments that probably pasted by mistake 2024-11-14 00:26:03 +01:00
Mamadou Babaei afdaaf4950 revamp the way the plugin requests permisions on Android by showing a pop-up to the user rather than silently crashing if those permisions were not already given 2024-11-14 00:26:03 +01:00
Mamadou Babaei 3e1bae1e9a implement the android permissions singleton responsible for requesting android permissions and checking those 2024-11-14 00:26:03 +01:00
Mamadou Babaei 60f09035ba re-order the required permissions alphabetically inside the android upl file 2024-11-14 00:26:03 +01:00
Mamadou Babaei 080e83a344 make the USGBackend constructor private 2024-11-14 00:26:03 +01:00
Mamadou Babaei 9a35132911 remove USGBackend class config specifier 2024-11-14 00:26:03 +01:00
Mamadou Babaei 5a2ed01e59 apply a minor formatting fix to the changelog 2024-11-14 00:26:03 +01:00
16 changed files with 408 additions and 75 deletions
+35 -1
View File
@@ -5,11 +5,45 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.3.2] - 2025-01-28
This patch release addresses a critical issue backported from the upcoming `2.4.x` release to `2.3.x`.
### Fixed
- Fix a critical issue backported from the upcoming `2.4.x` release where `HandStates->GetTransform(KeyPoint)` was incorrectly resolving to `(&HandStates[0])->GetTransform(KeyPoint)`, causing both hands to use the left hand's wrist transform under specific conditions. This occurred when the `bFallbackToHandTrackingIfNoGloveDetected` option was enabled, two gloves were present, and no hardware wrist-tracking device was active, resulting in both hands overlapping at the same transform.
## [2.3.1] - 2024-11-27
This patch release addresses a few issues with SenseGlove Sockets Editor.
### Fixed
- Additional minor fixes and improvements that may not be listed here.
### Changed
- The SenseGlove Sockets Editor now calculates hand bone reference transforms using the current virtual hand mesh being edited, rather than the reference mesh, when adding SenseGlove sockets.
## [2.3.0] - 2024-11-13
This minor release includes some improvements and adds official Unreal Engine `5.5` Fab support.
### Added
- Added `USGAndroidPermissions` to the `SenseGloveAndroid` module, enhancing the plugin's permission request process on Android. Now, a pop-up prompts the user to grant permissions, preventing silent crashes when permissions haven't been granted beforehand.
- Added Unreal Engine `5.5` Fab support.
### Fixed
- Fix UE `5.5` deprecation warnings inside `USGVirtualHandComponent`.
- Additional minor fixes and improvements that may not be listed here.
## [2.2.2] - 2024-11-08
This patch release addresses a few issues with both glove and hand-tracking.
# Fixed
### Fixed
- Fixed a chain of critical bugs that gets triggered due to `GloveConnectivityCheckInterval` getting passed as seconds to the engine rather than milliseconds. Thus, the default or any large value for `GloveConnectivityCheckInterval` causes noticeable long delays between glove-connectivity-check intervals and consequently renders the hand-tracking state invalid in certain situations when the `bFallbackToHandTrackingIfNoGloveDetected` option is false.
@@ -1,6 +1,6 @@
## Planned Features Completion Status
### Implemented as of v2.2.x
### Implemented as of v2.3.x
- [X] Full SenseGlove low-level core API access through Unreal C++.
- [X] Full SenseGlove low-level core API access through Blueprint.
@@ -38,8 +38,9 @@
- [X] The SenseGlove grab/touch sockets one-click-setup ability on any Epic-compliant virtual hand mesh from within the Unreal Editor's Content Browser, Skeleton Editor, or Skeletal Mesh Editor.
- [X] A flexible virtual hand animation system that can take the mesh bone's transforms into account for a more reliable hand animation.
- [X] Ability to manage the Engine Scalability Settings through the SenseGlove plugin in order to change the graphics settings on the fly.
- [X] Ability to automatically ask for the required permissions on Android when the plugin is enabled in any UE project.
### Upcoming features planned for the v2.3.x release
### Upcoming features planned for the v2.4.x release
### Planned features long-term
@@ -2,10 +2,10 @@
| | **Windows (MSVC 2017)** | **Windows (MSVC 2019)** | **Windows (MSVC 2022)** | **Linux x86-64 (Native Toolchain)** | **Linux AArch64 (Native Toolchain)** | **Meta Quest Stand-alone (Android NDK)** | **HTC VIVE Stand-alone (Android NDK)** | **Fab** | **Azure DevOps Version** |
|:--------:|:-----------------------:|:-----------------------:|:-----------------------:|:-----------------------------------:|:------------------------------------:|:----------------------------------------:|:--------------------------------------:|:--------:|:------------------------:|
| **5.5** | ❌ | ❌ | ✅ v2.2.x | ✅ v2.2.x | ✅ v2.2.x | ✅ v2.2.x (r25b) | ❓ | | ✅ v2.2.2 |
| **5.4** | ❌ | ❌ | ✅ v2.2.x | ✅ v2.2.x | ✅ v2.2.x | ✅ v2.2.x (r25b) | ❓ | ✅ v2.2.2 | ✅ v2.2.2 |
| **5.3** | ❌ | ✅ v2.2.x | ✅ v2.2.x | ✅ v2.2.x | ✅ v2.2.x | ✅ v2.2.x (r25b) | ❓ | ✅ v2.2.2 | ✅ v2.2.2 |
| **5.2** | ❌ | ✅ v2.2.x | ✅ v2.2.x | ✅ v2.2.x | ✅ v2.2.x | ✅ v2.2.x (r25b) | ❓ | ✅ v2.2.2 | ✅ v2.2.2 |
| **5.5** | ❌ | ❌ | ✅ v2.3.x | ✅ v2.3.x | ✅ v2.3.x | ✅ v2.3.x (r25b) | ❓ | ✅ v2.3.2 | ✅ v2.3.2 |
| **5.4** | ❌ | ❌ | ✅ v2.3.x | ✅ v2.3.x | ✅ v2.3.x | ✅ v2.3.x (r25b) | ❓ | ✅ v2.3.2 | ✅ v2.3.2 |
| **5.3** | ❌ | ✅ v2.3.x | ✅ v2.3.x | ✅ v2.3.x | ✅ v2.3.x | ✅ v2.3.x (r25b) | ❓ | ✅ v2.3.2 | ✅ v2.3.2 |
| **5.2** | ❌ | ✅ v2.3.x | ✅ v2.3.x | ✅ v2.3.x | ✅ v2.3.x | ✅ v2.3.x (r25b) | ❓ | ✅ v2.3.2 | ✅ v2.3.2 |
| **5.1** | ❌ | ⚠️ v2.0.x | ⚠️ v2.0.x | ⚠️ v2.0.x | ⚠️ v2.0.x | ⚠️ v2.0.x (r25b) | ❓ | ⚠️ v2.0.0 | ⚠️ v2.0.2 |
| **5.0** | ❌ | ⚠️ v1.6.x | ⚠️ v1.6.x | ⚠️ v1.6.x | ⚠️ v1.6.x | ⚠️ v1.6.x (r21e) | ❓ | ⚠️ v1.6.1 | ⚠️ v1.6.1 |
| **4.27** | ⚠️ v1.4.x | ⚠️ v1.4.x | ⚠️ v1.4.x | ⚠️ v1.4.x | ⚠️ v1.4.x | ⚠️ v1.4.x (r21e) | ❓ | ⚠️ v1.3.1 | ⚠️ v1.4.3 |
+5 -1
View File
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "2.2.2",
"VersionName": "2.3.2",
"FriendlyName": "SenseGlove",
"Description": "Integrating the SenseGlove haptic controller into Unreal Engine",
"Category": "Virtual Reality",
@@ -274,6 +274,10 @@
}
],
"Plugins": [
{
"Name": "AndroidPermission",
"Enabled": true
},
{
"Name": "OpenXR",
"Enabled": true,
@@ -236,7 +236,11 @@ 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;
@@ -291,6 +295,15 @@ 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),
TEXT("The AnimInstance class must be a subclass of USGVirtualHandAnimInstance!"));
Super::SetAnimInstanceClass(NewClass);
}
#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
void USGVirtualHandComponent::SetAnimClass(UClass* NewClass)
{
ensureAlwaysMsgf((TIsDerivedFrom<decltype(NewClass), USGVirtualHandAnimInstance>::IsDerived),
@@ -298,6 +311,7 @@ void USGVirtualHandComponent::SetAnimClass(UClass* NewClass)
Super::SetAnimClass(NewClass);
}
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
void USGVirtualHandComponent::PostInitProperties()
{
@@ -33,8 +33,6 @@
*/
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Delegates/IDelegateInstance.h"
@@ -146,7 +146,11 @@ 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 PostInitProperties() override;
@@ -0,0 +1,190 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 SenseGlove
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* @section DESCRIPTION
*
*
*/
#include "SGAndroid/SGAndroidPermissions.h"
#include "AndroidPermissionCallbackProxy.h"
#include "AndroidPermissionFunctionLibrary.h"
#include "Engine/Engine.h"
#include "SGLog/SGLog.h"
struct USGAndroidPermissions::FImpl
{
/************************
* Member variables
************************/
TFunction<void(const TArray<FString>&, const TArray<bool>&)> PermissionsGrantedCallback;
/************************
* Owner object
************************/
USGAndroidPermissions* Owner;
/************************
* Constructor / Destructor
************************/
explicit FImpl(USGAndroidPermissions* InOwner);
~FImpl();
/************************
* Default copy constructor & copy assignment operator
************************/
FImpl(const FImpl& Rhs) = default;
FImpl& operator=(const FImpl& Rhs) = default;
};
USGAndroidPermissions* USGAndroidPermissions::GetInstance()
{
if (!ensureAlwaysMsgf(GEngine, TEXT("The engine has not been initialized!")))
{
return nullptr;
}
USGAndroidPermissions* Instance{GEngine->GetEngineSubsystem<USGAndroidPermissions>()};
return Instance;
}
USGAndroidPermissions::USGAndroidPermissions()
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
}
void USGAndroidPermissions::Request(
const TFunction<void(const TArray<FString>&, const TArray<bool>&)>& PermissionsGrantedCallback)
{
TArray<FString> Permissions{
"android.permission.ACCESS_BACKGROUND_LOCATION",
"android.permission.ACCESS_FINE_LOCATION",
"android.permission.BLUETOOTH",
"android.permission.BLUETOOTH_ADMIN",
"android.permission.BLUETOOTH_ADVERTISE",
"android.permission.BLUETOOTH_CONNECT",
"android.permission.BLUETOOTH_SCAN",
};
bool bHasAllRequiredPermissions = false;
for (const FString& Permission: Permissions)
{
const bool bHasPermission = UAndroidPermissionFunctionLibrary::CheckPermission(Permission);
bHasAllRequiredPermissions = bHasPermission;
if (!bHasAllRequiredPermissions)
{
break;
}
}
if (!bHasAllRequiredPermissions)
{
Pimpl->PermissionsGrantedCallback = PermissionsGrantedCallback;
UAndroidPermissionFunctionLibrary::AcquirePermissions(
MoveTemp(Permissions))->OnPermissionsGrantedDelegate.AddUObject(
this, &USGAndroidPermissions::OnPermissionsGranted);
}
else
{
TArray<bool> GrantedResults;
for (int32 i = 0; i < Permissions.Num(); ++i)
{
GrantedResults.Add(true);
}
PermissionsGrantedCallback(MoveTemp(Permissions), MoveTemp(GrantedResults));
}
}
void USGAndroidPermissions::OnPermissionsGranted(const TArray<FString>& Permissions, const TArray<bool>& GrantResults)
{
if (!ensureAlwaysMsgf(Permissions.Num() == GrantResults.Num(),
TEXT("Mismatched number of Permissions and GrantedResults!")))
{
return;
}
for (int32 i = 0; i < Permissions.Num(); i++)
{
if (GrantResults[i])
{
SGLOG("Permission Granted", Permissions[i]);
}
else
{
SGLOG("Permission Denied", Permissions[i]);
}
}
Pimpl->PermissionsGrantedCallback(Permissions, GrantResults);
}
bool USGAndroidPermissions::ShouldCreateSubsystem(UObject* Outer) const
{
return true;
}
void USGAndroidPermissions::Initialize(FSubsystemCollectionBase& Collection)
{
SGLOG("Initializing the SenseGlove Android permissions singleton with the engine lifetime...");
Super::Initialize(Collection);
SGLOG("The SenseGlove Android permissions singleton has been successfully initialized with the engine lifetime!");
}
void USGAndroidPermissions::Deinitialize()
{
SGLOG("De-initializing the SenseGlove Android permissions singleton due to the engine lifetime expiration...");
Super::Deinitialize();
(void) Pimpl.Release();
SGLOG("The SenseGlove Android permissions singleton has been successfully de-initialized!");
}
USGAndroidPermissions::FImpl::FImpl(USGAndroidPermissions* InOwner)
: Owner(InOwner)
{
}
USGAndroidPermissions::FImpl::~FImpl() = default;
void USGAndroidPermissions::FImplDeleter::operator()(const FImpl* P) const
{
delete P;
}
@@ -35,6 +35,9 @@
#include "SenseGloveAndroidModule.h"
#include "Misc/CoreDelegates.h"
#include "SGAndroid/SGAndroidPermissions.h"
#include "SGAndroid/SGConnectJNI.h"
#include "SGAndroid/SGCoreJNI.h"
#include "SGLog/SGLog.h"
@@ -45,16 +48,8 @@ void FSenseGloveAndroidModule::StartupModule()
{
SGLOG("Starting up the SenseGloveAndroid module...");
#if PLATFORM_ANDROID
const int32 R1 = FSGConnectJNI::Initialize();
const int32 R2 = FSGCoreJNI::Initialize();
ensureAlwaysMsgf(R1 == 0,
TEXT("Failed to initialize the SGConnect JNI bridge to SGConnect for Android! Status Code: %d"), R1);
ensureAlwaysMsgf(R2 == 0,
TEXT("Failed to initialize the SGCore JNI bridge to SGConnect for Android! Status Code: %d"), R2);
#endif /* PLATFORM_ANDROID */
OnPostEngineInitHandle = FCoreDelegates::OnPostEngineInit.AddRaw(
this, &FSenseGloveAndroidModule::OnPostEngineInit);
}
void FSenseGloveAndroidModule::PreUnloadCallback()
@@ -72,4 +67,26 @@ void FSenseGloveAndroidModule::ShutdownModule()
SGLOG("Shutting down the SenseGloveAndroid module...");
}
void FSenseGloveAndroidModule::OnPostEngineInit() const
{
#if PLATFORM_ANDROID
USGAndroidPermissions::GetInstance()->Request(
[](const TArray<FString>& Permissions, const TArray<bool>& GrantResults)
{
const int32 R1 = FSGConnectJNI::Initialize();
const int32 R2 = FSGCoreJNI::Initialize();
ensureAlwaysMsgf(R1 == 0,
TEXT(
"Failed to initialize the SGConnect JNI bridge to SGConnect for Android! Status Code: %d"
), R1);
ensureAlwaysMsgf(R2 == 0,
TEXT("Failed to initialize the SGCore JNI bridge to SGConnect for Android! Status Code: %d"
), R2);
});
#endif /* PLATFORM_ANDROID */
}
#undef LOCTEXT_NAMESPACE
@@ -35,17 +35,24 @@
#pragma once
#include "Delegates/IDelegateInstance.h"
#include "Modules/ModuleInterface.h"
#define LOCTEXT_NAMESPACE "SenseGloveAndroid"
class FSenseGloveAndroidModule : public IModuleInterface
{
private:
FDelegateHandle OnPostEngineInitHandle;
public:
virtual void StartupModule() override;
virtual void PreUnloadCallback() override;
virtual void PostLoadCallback() override;
virtual void ShutdownModule() override;
private:
void OnPostEngineInit() const;
};
#undef LOCTEXT_NAMESPACE
@@ -0,0 +1,82 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 SenseGlove
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* @section DESCRIPTION
*
*
*/
#pragma once
#include "Containers/Array.h"
#include "Containers/UnrealString.h"
#include "Subsystems/EngineSubsystem.h"
#include "Templates/Function.h"
#include "Templates/SharedPointer.h"
#include "UObject/ObjectMacros.h"
#include "SGAndroidPermissions.generated.h"
UCLASS()
class SENSEGLOVEANDROID_API USGAndroidPermissions : public UEngineSubsystem
{
GENERATED_BODY()
public:
static USGAndroidPermissions* GetInstance();
private:
struct FImpl;
struct FImplDeleter
{
void operator()(const FImpl* P) const;
};
TUniquePtr<FImpl, FImplDeleter> Pimpl;
FImplDeleter PimplDeleter;
private:
USGAndroidPermissions();
public:
void Request(
const TFunction<void(const TArray<FString>&, const TArray<bool>&)>& PermissionsGrantedCallback);
private:
void OnPermissionsGranted(
const TArray<FString>& Permissions, const TArray<bool>& GrantResults);
public:
virtual bool ShouldCreateSubsystem(UObject* Outer) const override;
virtual void Initialize(FSubsystemCollectionBase& Collection) override;
virtual void Deinitialize() override;
};
@@ -46,6 +46,7 @@ public class SenseGloveAndroid : ModuleRules
PrivateDependencyModuleNames.AddRange(
new string[]
{
"AndroidPermission",
"Core",
"CoreUObject",
"Engine",
@@ -116,13 +116,13 @@
</if>
</loopElements>
<addPermission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
<addPermission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<addPermission android:name="android.permission.BLUETOOTH"/>
<addPermission android:name="android.permission.BLUETOOTH_ADMIN"/>
<addPermission android:name="android.permission.BLUETOOTH_ADVERTISE"/>
<addPermission android:name="android.permission.BLUETOOTH_CONNECT"/>
<addPermission android:name="android.permission.BLUETOOTH_SCAN"/>
<addPermission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
<addPermission android:name="android.permission.ACCESS_FINE_LOCATION"/>
</androidManifestUpdates>
<buildGradleAdditions>
@@ -44,7 +44,7 @@
#include "SGBackend.generated.h"
UCLASS(config = SenseGloveBackend)
UCLASS()
class SENSEGLOVEBACKEND_API USGBackend : public UEngineSubsystem
{
GENERATED_BODY()
@@ -67,7 +67,7 @@ private:
TUniquePtr<FImpl, FImplDeleter> Pimpl;
FImplDeleter PimplDeleter;
public:
private:
USGBackend();
public:
@@ -99,7 +99,7 @@ struct FSGAssetUtils::FImpl
static bool IsLeftHandMesh(const ISkeletalMeshEditor* SkeletalMeshEditor, const USkeletalMesh* SkeletalMesh);
static bool IsRightHandMesh(const ISkeletalMeshEditor* SkeletalMeshEditor, const USkeletalMesh* SkeletalMesh);
static FTransform GetHandBoneBoneRefTransform(bool bRight, const FName& BoneName);
static FTransform GetHandBoneRefTransform(const USkeletalMesh* SkeletalMesh, const FName& BoneName);
static bool AddSocket(
const ISkeletalMeshEditor* SkeletalMeshEditor, USkeletalMesh* SkeletalMesh,
@@ -310,50 +310,34 @@ bool FSGAssetUtils::FImpl::IsRightHandMesh(
return true;
}
FTransform FSGAssetUtils::FImpl::GetHandBoneBoneRefTransform(const bool bRight, const FName& BoneName)
FTransform FSGAssetUtils::FImpl::GetHandBoneRefTransform(
const USkeletalMesh* SkeletalMesh, const FName& BoneName)
{
const FSGVirtualHandMeshSettings& MeshSettings{GetVirtualHandSettings().MeshSettings};
const TSoftObjectPtr<USkeletalMesh>& HandMesh{
bRight
? MeshSettings.LeftHandReferenceMesh
: MeshSettings.RightHandReferenceMesh
};
if (HandMesh.IsValid())
if (!ensureAlwaysMsgf(IsValid(SkeletalMesh), TEXT("Invalid SkeletalMesh")))
{
const FReferenceSkeleton& ReferenceSkeleton{HandMesh->GetRefSkeleton()};
return FTransform::Identity;
}
const FReferenceSkeleton& ReferenceSkeleton{SkeletalMesh->GetRefSkeleton()};
const int32 BoneIndex = ReferenceSkeleton.FindBoneIndex(BoneName);
if (BoneIndex == INDEX_NONE)
if (!ensureAlwaysMsgf(BoneIndex != INDEX_NONE,
TEXT("Could not find a bone index for the '%s' joint!"), *BoneName.ToString()))
{
SGLOG_WARNING(FString::Printf(TEXT("Could not find a bone index for the '%s' joint!"),
*BoneName.ToString()));
return FTransform::Identity;
}
const TArray<FTransform> Transforms{ReferenceSkeleton.GetRefBonePose()};
ensureAlwaysMsgf(Transforms.Num() > 0 && Transforms.Num() > BoneIndex,
TEXT("Invalid bone index '%d' or no transforms found!"), BoneIndex);
if (!ensureAlwaysMsgf(Transforms.Num() > 0 && Transforms.Num() > BoneIndex,
TEXT("Invalid bone index '%d' or no transforms found!"), BoneIndex))
{
return FTransform::Identity;
}
const FTransform& Transform{Transforms[BoneIndex]};
return Transform;
}
ensureAlwaysMsgf(
bRight
? MeshSettings.RightHandDefaultReferenceBoneTransforms.Contains(BoneName)
: MeshSettings.LeftHandDefaultReferenceBoneTransforms.Contains(BoneName),
TEXT("Invalid bone name '%s'!"), *BoneName.ToString());
const FTransform& Transform{
bRight
? MeshSettings.RightHandDefaultReferenceBoneTransforms[BoneName]
: MeshSettings.LeftHandDefaultReferenceBoneTransforms[BoneName]
};
return Transform;
}
bool FSGAssetUtils::FImpl::AddSocket(
const ISkeletalMeshEditor* SkeletalMeshEditor, USkeletalMesh* SkeletalMesh,
const FName& BoneName, const FName& SocketName, const FTransform& SocketTransform)
@@ -468,7 +452,7 @@ bool FSGAssetUtils::FImpl::AddFingertipColliderSocket(
};
FTransform SocketTransform{
GetHandBoneBoneRefTransform(bRight, BoneName)
GetHandBoneRefTransform(SkeletalMesh, BoneName)
};
const bool bAddedSocket = AddSocket(
@@ -651,7 +635,6 @@ bool FSGAssetUtils::FImpl::AddSenseGloveSockets(const ISkeletalMeshEditor* Skele
return false;
}
const bool TouchLittleCollider = AddTouchLittleColliderSocket(
SkeletalMeshEditor, SkeletalMesh, bIsRight);
if (!TouchLittleCollider)
@@ -661,7 +644,6 @@ bool FSGAssetUtils::FImpl::AddSenseGloveSockets(const ISkeletalMeshEditor* Skele
return false;
}
return true;
}
@@ -786,7 +768,6 @@ bool FSGAssetUtils::FImpl::AddSenseGloveSockets(USkeletalMesh* SkeletalMesh, USk
return true;
}
bool FSGAssetUtils::FImpl::ClearExistingSockets(USkeletalMesh* SkeletalMesh, USkeleton* Skeleton)
{
if (!ensureAlwaysMsgf(IsValid(SkeletalMesh), TEXT("Invalid SkeletalMesh!")))
@@ -2075,7 +2075,7 @@ bool FSGXRTracker::FImpl::UpdateXRHandTrackingData(
XR_ENSURE(XRLocateHandJointsEXT(OutHandState.HandTracker, &LocateInfo, &OutHandState.Locations));
OutHandState.bTracked = OutHandState.Locations.isActive == XR_TRUE;
OutHandState.bHasReceivedJointPoses |= HandStates->bTracked;
OutHandState.bHasReceivedJointPoses |= OutHandState.bTracked;
if (!OutHandState.bTracked)
{
return false;
@@ -2209,7 +2209,7 @@ bool FSGXRTracker::FImpl::GetControllerTransform(
}
const EHandKeypoint KeyPoint = KeyPointInfoPtr->Key;
const FTransform& ControllerTransform{HandStates->GetTransform(KeyPoint)};
const FTransform& ControllerTransform{HandState.GetTransform(KeyPoint)};
OutTransform = ControllerTransform;
bOutMotionSourceHandTracking = true;
bTracked = HandState.bTracked;