Files
Plugin/Source/SenseGloveKismet/Public/SGKismet/SGVirtualHandKismetLibrary.h
T

129 lines
5.5 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
*
* 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);
};