From e144de6af67374a2413daafba472bad04ebfce8f Mon Sep 17 00:00:00 2001 From: Mamadou Babaei Date: Thu, 1 Jun 2023 23:21:42 +0200 Subject: [PATCH] add a complementary internal method to IsUsingUserMesh, IsUsingDefaultMesh for checking various hand meshes --- .../Components/SGVirtualHandComponent.cpp | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Source/SenseGlove/Private/SenseGlove/Components/SGVirtualHandComponent.cpp b/Source/SenseGlove/Private/SenseGlove/Components/SGVirtualHandComponent.cpp index 89ad6fc5..977fb862 100644 --- a/Source/SenseGlove/Private/SenseGlove/Components/SGVirtualHandComponent.cpp +++ b/Source/SenseGlove/Private/SenseGlove/Components/SGVirtualHandComponent.cpp @@ -114,6 +114,7 @@ struct USGVirtualHandComponent::FImpl bool IsEditor() const; FString GetDefaultMeshPath() const; + bool IsUsingDefaultMesh() const; bool IsUsingUserMesh() const; USkeletalMesh* LoadDefaultMesh() const; void SetDefaultMesh() const; @@ -514,6 +515,30 @@ FString USGVirtualHandComponent::FImpl::GetDefaultMeshPath() const return MoveTemp(SkeletalMeshPath); } +bool USGVirtualHandComponent::FImpl::IsUsingDefaultMesh() const +{ + const USkeletalMesh* CurrentMesh{GetMesh()}; + if (!IsValid(CurrentMesh)) + { + return false; + } + + const FString CurrentMeshPath(CurrentMesh->GetPathName()); + const FString LeftHandDefaultMeshPath(GetDefaultLeftHandMeshPath()); + const FString LeftHandDefaultMeshPathOnly(GetDefaultLeftHandMeshPathOnly()); + const FString RightHandDefaultMeshPath(GetDefaultRightHandMeshPath()); + const FString RightHandDefaultMeshPathOnly(GetDefaultRightHandMeshPathOnly()); + if (CurrentMeshPath == LeftHandDefaultMeshPath + || CurrentMeshPath == LeftHandDefaultMeshPathOnly + || CurrentMeshPath == RightHandDefaultMeshPath + || CurrentMeshPath == RightHandDefaultMeshPathOnly) + { + return true; + } + + return false; +} + bool USGVirtualHandComponent::FImpl::IsUsingUserMesh() const { const USkeletalMesh* CurrentMesh{GetMesh()};