add the virtual hand kismet library
This commit is contained in:
@@ -36,9 +36,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Containers/Array.h"
|
#include "Containers/Array.h"
|
||||||
|
#include "Containers/Map.h"
|
||||||
#include "GameFramework/Actor.h"
|
#include "GameFramework/Actor.h"
|
||||||
#include "Math/Rotator.h"
|
#include "Math/Rotator.h"
|
||||||
#include "Math/Transform.h"
|
#include "Math/Transform.h"
|
||||||
|
#include "ReferenceSkeleton.h"
|
||||||
#include "Templates/UniquePtr.h"
|
#include "Templates/UniquePtr.h"
|
||||||
#include "UObject/NameTypes.h"
|
#include "UObject/NameTypes.h"
|
||||||
|
|
||||||
@@ -76,22 +78,22 @@ private:
|
|||||||
FImplDeleter PimplDeleter;
|
FImplDeleter PimplDeleter;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="SenseGlove", meta=(AllowPrivateAccess="true"))
|
UPROPERTY(VisibleAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
||||||
USceneComponent* SceneRoot;
|
USceneComponent* SceneRoot;
|
||||||
|
|
||||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="SenseGlove", meta=(AllowPrivateAccess="true"))
|
UPROPERTY(VisibleAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
||||||
USkeletalMeshComponent* Mesh;
|
USkeletalMeshComponent* Mesh;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="SenseGlove", meta=(AllowPrivateAccess="true"))
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
||||||
UClass* AnimInstanceClass;
|
UClass* AnimInstanceClass;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="SenseGlove", meta=(AllowPrivateAccess="true"))
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
||||||
uint8 bRight : 1;
|
uint8 bRight : 1;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="SenseGlove", meta=(AllowPrivateAccess="true"))
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
||||||
uint8 bHiddenInGameIfNoGloveDetected : 1;
|
uint8 bHiddenInGameIfNoGloveDetected : 1;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="SenseGlove", meta=(AllowPrivateAccess="true"))
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
||||||
uint8 bAnimateInEditor : 1;
|
uint8 bAnimateInEditor : 1;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -0,0 +1,150 @@
|
|||||||
|
/**
|
||||||
|
* @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();
|
||||||
|
}
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
/**
|
||||||
|
* @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
|
||||||
|
*
|
||||||
|
* A data class containing the minimum required data for a hand's forward
|
||||||
|
* kinematics.
|
||||||
|
* Used in both kinematics and calibration.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Containers/Array.h"
|
||||||
|
#include "Containers/Map.h"
|
||||||
|
#include "GameFramework/Actor.h"
|
||||||
|
#include "Math/Rotator.h"
|
||||||
|
#include "Math/Transform.h"
|
||||||
|
#include "UObject/NameTypes.h"
|
||||||
|
|
||||||
|
#include "SGKismet/SGBlueprintFunctionLibrary.h"
|
||||||
|
#include "SGTypes/SGNameArray.h"
|
||||||
|
|
||||||
|
#include "SGVirtualHandKismetLibrary.generated.h"
|
||||||
|
|
||||||
|
class USkeletalMeshComponent;
|
||||||
|
|
||||||
|
class ASGVirtualHand;
|
||||||
|
class USGHandPose;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents data of a user's hand required for forward kinematics.
|
||||||
|
*/
|
||||||
|
UCLASS(meta=(ScriptName = "SesneGloveVirtualHandKismetLibrary"))
|
||||||
|
class SENSEGLOVEKISMET_API UVirtualHandKismetLibrary final : public USGBlueprintFunctionLibrary
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Game Framework | Virtual Hand")
|
||||||
|
static TArray<FSGNameArray> GetLeftHandFingerBoneNames();
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Game Framework | Virtual Hand")
|
||||||
|
static TArray<FSGNameArray> GetRightHandFingerBoneNames();
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Game Framework | Virtual Hand")
|
||||||
|
static const FName& GetLeftHandFingerBoneName(int32 Finger, int32 Joint);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Game Framework | Virtual Hand")
|
||||||
|
static const FName& GetRightHandFingerBoneName(int32 Finger, int32 Joint);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Virtual Hand")
|
||||||
|
static USkeletalMeshComponent* GetMesh(const ASGVirtualHand* VirtualHand);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Virtual Hand")
|
||||||
|
static bool IsLeft(const ASGVirtualHand* VirtualHand);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Virtual Hand")
|
||||||
|
static bool IsRight(const ASGVirtualHand* VirtualHand);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Game Framework | Virtual Hand")
|
||||||
|
static void SetRight(UPARAM(ref) ASGVirtualHand* VirtualHand, bool bInRight);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Virtual Hand")
|
||||||
|
static bool IsHiddenInGameIfNoGloveDetected(const ASGVirtualHand* VirtualHand);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Game Framework | Virtual Hand")
|
||||||
|
static void SetHiddenIfNoGloveDetected(UPARAM(ref) ASGVirtualHand* VirtualHand, bool bInHiddenIfNoGloveDetected);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Virtual Hand")
|
||||||
|
static bool IsAnimateInEditor(const ASGVirtualHand* VirtualHand);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Game Framework | Virtual Hand")
|
||||||
|
static void SetAnimateInEditor(UPARAM(ref) ASGVirtualHand* VirtualHand, bool bInAnimateInEditor);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Virtual Hand")
|
||||||
|
USkeletalMesh* GetHandMesh(const ASGVirtualHand* VirtualHand) const;
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Virtual Hand")
|
||||||
|
void SetHandMesh(UPARAM(ref) ASGVirtualHand* VirtualHand,
|
||||||
|
USkeletalMesh* VirtualHandMesh, bool bReinitPos) const;
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Virtual Hand")
|
||||||
|
USkeleton* GetHandSkeleton(const ASGVirtualHand* VirtualHand) const;
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Virtual Hand")
|
||||||
|
bool IsGloveConnected(const ASGVirtualHand* VirtualHand) const;
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Game Framework | Virtual Hand")
|
||||||
|
USGHandPose* GetHandPose(UPARAM(ref) ASGVirtualHand* VirtualHand);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Virtual Hand")
|
||||||
|
const FName& GetFingerBoneName(const ASGVirtualHand* VirtualHand, int32 Finger, int32 Joint) const;
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Virtual Hand")
|
||||||
|
const FTransform& GetFingerBoneRefTransform(const ASGVirtualHand* VirtualHand, int32 Finger, int32 Joint) const;
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Virtual Hand")
|
||||||
|
FRotator GetFingerBoneRefRotation(const ASGVirtualHand* VirtualHand, int32 Finger, int32 Joint) const;
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Game Framework | Virtual Hand")
|
||||||
|
TMap<FName, FRotator> GetFingersBonesRotations(UPARAM(ref) ASGVirtualHand* VirtualHand);
|
||||||
|
};
|
||||||
@@ -55,8 +55,10 @@ public class SenseGloveKismet : ModuleRules
|
|||||||
"CoreUObject",
|
"CoreUObject",
|
||||||
"Engine",
|
"Engine",
|
||||||
"SenseGlove",
|
"SenseGlove",
|
||||||
|
"SenseGloveCore",
|
||||||
"SenseGloveLog",
|
"SenseGloveLog",
|
||||||
"SenseGloveTypes",
|
"SenseGloveTypes",
|
||||||
|
"SenseGloveUtils",
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user