150 lines
5.1 KiB
C++
150 lines
5.1 KiB
C++
/**
|
|
* @file
|
|
*
|
|
* @author Mamadou Babaei <mamadou@senseglove.com>
|
|
*
|
|
* @section LICENSE
|
|
*
|
|
* (The MIT License)
|
|
*
|
|
* Copyright (c) 2020 - 2023 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 "SGKismet/SGVirtualHandKismetLibrary.h"
|
|
|
|
#include "SenseGlove/GameFramework/SGVirtualHand.h"
|
|
#include "SGCore/SGHandPose.h"
|
|
#include "SGUtils/SGArrayUtils.h"
|
|
|
|
TArray<FSGNameArray> UVirtualHandKismetLibrary::GetLeftHandFingerBoneNames()
|
|
{
|
|
return FSGArrayUtils::ToNestedBPArray<FName, FSGNameArray>(ASGVirtualHand::GetLeftHandFingerBoneNames());
|
|
}
|
|
|
|
TArray<FSGNameArray> UVirtualHandKismetLibrary::GetRightHandFingerBoneNames()
|
|
{
|
|
return FSGArrayUtils::ToNestedBPArray<FName, FSGNameArray>(ASGVirtualHand::GetRightHandFingerBoneNames());
|
|
}
|
|
|
|
const FName& UVirtualHandKismetLibrary::GetLeftHandFingerBoneName(const int32 Finger, const int32 Joint)
|
|
{
|
|
return ASGVirtualHand::GetLeftHandFingerBoneName(Finger, Joint);
|
|
}
|
|
|
|
const FName& UVirtualHandKismetLibrary::GetRightHandFingerBoneName(const int32 Finger, const int32 Joint)
|
|
{
|
|
return ASGVirtualHand::GetRightHandFingerBoneName(Finger, Joint);
|
|
}
|
|
|
|
USkeletalMeshComponent* UVirtualHandKismetLibrary::GetMesh(const ASGVirtualHand* VirtualHand)
|
|
{
|
|
return VirtualHand->GetMesh();
|
|
}
|
|
|
|
bool UVirtualHandKismetLibrary::IsLeft(const ASGVirtualHand* VirtualHand)
|
|
{
|
|
return VirtualHand->IsLeft();
|
|
}
|
|
|
|
bool UVirtualHandKismetLibrary::IsRight(const ASGVirtualHand* VirtualHand)
|
|
{
|
|
return VirtualHand->IsRight();
|
|
}
|
|
|
|
void UVirtualHandKismetLibrary::SetRight(ASGVirtualHand* VirtualHand, const bool bInRight)
|
|
{
|
|
VirtualHand->SetRight(bInRight);
|
|
}
|
|
|
|
bool UVirtualHandKismetLibrary::IsHiddenInGameIfNoGloveDetected(const ASGVirtualHand* VirtualHand)
|
|
{
|
|
return VirtualHand->IsHiddenInGameIfNoGloveDetected();
|
|
}
|
|
|
|
void UVirtualHandKismetLibrary::SetHiddenIfNoGloveDetected(ASGVirtualHand* VirtualHand,
|
|
const bool bInHiddenIfNoGloveDetected)
|
|
{
|
|
VirtualHand->SetHiddenIfNoGloveDetected(bInHiddenIfNoGloveDetected);
|
|
}
|
|
|
|
bool UVirtualHandKismetLibrary::IsAnimateInEditor(const ASGVirtualHand* VirtualHand)
|
|
{
|
|
return VirtualHand->IsAnimateInEditor();
|
|
}
|
|
|
|
void UVirtualHandKismetLibrary::SetAnimateInEditor(ASGVirtualHand* VirtualHand, const bool bInAnimateInEditor)
|
|
{
|
|
VirtualHand->SetAnimateInEditor(bInAnimateInEditor);
|
|
}
|
|
|
|
USkeletalMesh* UVirtualHandKismetLibrary::GetHandMesh(const ASGVirtualHand* VirtualHand) const
|
|
{
|
|
return VirtualHand->GetHandMesh();
|
|
}
|
|
|
|
void UVirtualHandKismetLibrary::SetHandMesh(UPARAM(ref) ASGVirtualHand* VirtualHand,
|
|
USkeletalMesh* VirtualHandMesh, const bool bReinitPos) const
|
|
{
|
|
VirtualHand->SetHandMesh(VirtualHandMesh, bReinitPos);
|
|
}
|
|
|
|
USkeleton* UVirtualHandKismetLibrary::GetHandSkeleton(const ASGVirtualHand* VirtualHand) const
|
|
{
|
|
return VirtualHand->GetHandSkeleton();
|
|
}
|
|
|
|
bool UVirtualHandKismetLibrary::IsGloveConnected(const ASGVirtualHand* VirtualHand) const
|
|
{
|
|
return VirtualHand->IsGloveConnected();
|
|
}
|
|
|
|
USGHandPose* UVirtualHandKismetLibrary::GetHandPose(ASGVirtualHand* VirtualHand)
|
|
{
|
|
return VirtualHand->GetHandPose();
|
|
}
|
|
|
|
const FName& UVirtualHandKismetLibrary::GetFingerBoneName(const ASGVirtualHand* VirtualHand,
|
|
const int32 Finger, const int32 Joint) const
|
|
{
|
|
return VirtualHand->GetFingerBoneName(Finger, Joint);
|
|
}
|
|
|
|
const FTransform& UVirtualHandKismetLibrary::GetFingerBoneRefTransform(const ASGVirtualHand* VirtualHand,
|
|
const int32 Finger, const int32 Joint) const
|
|
{
|
|
return VirtualHand->GetFingerBoneRefTransform(Finger, Joint);
|
|
}
|
|
|
|
FRotator UVirtualHandKismetLibrary::GetFingerBoneRefRotation(const ASGVirtualHand* VirtualHand,
|
|
const int32 Finger, const int32 Joint) const
|
|
{
|
|
return VirtualHand->GetFingerBoneRefRotation(Finger, Joint);
|
|
}
|
|
|
|
TMap<FName, FRotator> UVirtualHandKismetLibrary::GetFingersBonesRotations(ASGVirtualHand* VirtualHand)
|
|
{
|
|
return VirtualHand->GetFingersBonesRotations();
|
|
} |