157 lines
7.7 KiB
C++
157 lines
7.7 KiB
C++
/**
|
|
* @file
|
|
*
|
|
* @author Mamadou Babaei <mamadou@senseglove.com>
|
|
*
|
|
* @section LICENSE
|
|
*
|
|
* (The MIT License)
|
|
*
|
|
* Copyright (c) 2020 - 2022 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 "SGCore/SGQuatArray.h"
|
|
#include "SGCore/SGRotatorArray.h"
|
|
#include "SGCore/SGVectorArray.h"
|
|
#include "SGKismet/SGBlueprintFunctionLibrary.h"
|
|
#include "SGTypes/SGCoreTypes.h"
|
|
|
|
#include "SGHandPoseKismetLibrary.generated.h"
|
|
|
|
class USGBasicHandModel;
|
|
class USGHandPose;
|
|
|
|
UCLASS(meta=(ScriptName = "SesneGloveHandPoseKismetLibrary"))
|
|
class SENSEGLOVECOREKISMET_API USGHandPoseKismetLibrary final : public USGBlueprintFunctionLibrary
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Hand Pose", meta=(WorldContext="WorldContextObject"))
|
|
static USGHandPose* MakeHandPose(UObject* WorldContextObject);
|
|
|
|
UFUNCTION(BlueprintCallable, DisplayName="Make Hand Pose", Category="SenseGlove | Core | Hand Pose",
|
|
meta=(WorldContext="WorldContextObject"))
|
|
static USGHandPose* MakeHandPose_bRightHanded_JointPositions_FSGQuatArrayJointRotations_HandAngles(
|
|
UObject* WorldContextObject,
|
|
bool bRightHanded, const TArray<FSGVectorArray>& JointPositions, const TArray<FSGQuatArray>& JointRotations,
|
|
const TArray<FSGVectorArray>& HandAngles);
|
|
|
|
UFUNCTION(BlueprintCallable, DisplayName="Make Hand Pose", Category="SenseGlove | Core | Hand Pose",
|
|
meta=(WorldContext="WorldContextObject"))
|
|
static USGHandPose* MakeHandPose_bRightHanded_JointPositions_FSGRotatorArrayJointRotations_HandAngles(
|
|
UObject* WorldContextObject,
|
|
bool bRightHanded, const TArray<FSGVectorArray>& JointPositions, const TArray<FSGRotatorArray>& JointRotations,
|
|
const TArray<FSGVectorArray>& HandAngles);
|
|
|
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Hand Pose",
|
|
meta=(WorldContext="WorldContextObject"))
|
|
static USGHandPose* Deserialize(UObject* WorldContextObject, const FString& SerializedString);
|
|
|
|
UFUNCTION(BlueprintCallable, DisplayName="From Hand Angles", Category="SenseGlove | Core | Hand Pose",
|
|
meta=(WorldContext="WorldContextObject"))
|
|
static USGHandPose* FromHandAngles_HandAngles_bRightHanded_HandDimensions(
|
|
UObject* WorldContextObject,
|
|
const TArray<FSGVectorArray>& HandAngles, bool bRightHanded, const USGBasicHandModel* HandDimensions);
|
|
|
|
UFUNCTION(BlueprintCallable, DisplayName="From Hand Angles", Category="SenseGlove | Core | Hand Pose",
|
|
meta=(WorldContext="WorldContextObject"))
|
|
static USGHandPose* FromHandAngles_HandAngles_bRightHanded(
|
|
UObject* WorldContextObject,
|
|
const TArray<FSGVectorArray>& HandAngles, bool bRightHanded);
|
|
|
|
UFUNCTION(BlueprintCallable, DisplayName="Default Idle", Category="SenseGlove | Core | Hand Pose",
|
|
meta=(WorldContext="WorldContextObject"))
|
|
static USGHandPose* DefaultIdle_bRightHanded_HandDimensions(
|
|
UObject* WorldContextObject,
|
|
bool bRightHanded, const USGBasicHandModel* HandDimensions);
|
|
|
|
UFUNCTION(BlueprintCallable, DisplayName="Default Idle", Category="SenseGlove | Core | Hand Pose",
|
|
meta=(WorldContext="WorldContextObject"))
|
|
static USGHandPose* DefaultIdle_bRightHanded(UObject* WorldContextObject, bool bRightHanded);
|
|
|
|
UFUNCTION(BlueprintCallable, DisplayName="Flat Hand", Category="SenseGlove | Core | Hand Pose",
|
|
meta=(WorldContext="WorldContextObject"))
|
|
static USGHandPose*
|
|
FlatHand_bRightHanded_HandDimensions(UObject* WorldContextObject,
|
|
bool bRightHanded, const USGBasicHandModel* HandDimensions);
|
|
|
|
UFUNCTION(BlueprintCallable, DisplayName="Flat Hand", Category="SenseGlove | Core | Hand Pose",
|
|
meta=(WorldContext="WorldContextObject"))
|
|
static USGHandPose* FlatHand_bRightHanded(UObject* WorldContextObject, bool bRightHanded);
|
|
|
|
UFUNCTION(BlueprintCallable, DisplayName="Thumbs Up", Category="SenseGlove | Core | Hand Pose",
|
|
meta=(WorldContext="WorldContextObject"))
|
|
static USGHandPose*
|
|
ThumbsUp_bRightHanded_HandDimensions(UObject* WorldContextObject, bool bRightHanded,
|
|
const USGBasicHandModel* HandDimensions);
|
|
|
|
UFUNCTION(BlueprintCallable, DisplayName="Thumbs Up", Category="SenseGlove | Core | Hand Pose",
|
|
meta=(WorldContext="WorldContextObject"))
|
|
static USGHandPose* ThumbsUp_bRightHanded(UObject* WorldContextObject, bool bRightHanded);
|
|
|
|
UFUNCTION(BlueprintCallable, DisplayName="Fist", Category="SenseGlove | Core | Hand Pose",
|
|
meta=(WorldContext="WorldContextObject"))
|
|
static USGHandPose* Fist_bRightHanded_HandDimensions(UObject* WorldContextObject,
|
|
bool bRightHanded, const USGBasicHandModel* HandDimensions);
|
|
|
|
UFUNCTION(BlueprintCallable, DisplayName="Fist", Category="SenseGlove | Core | Hand Pose",
|
|
meta=(WorldContext="WorldContextObject"))
|
|
static USGHandPose* Fist_bRightHanded(UObject* WorldContextObject, bool bRightHanded);
|
|
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Hand Pose")
|
|
static bool IsRight(const USGHandPose* HandPose);
|
|
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Hand Pose")
|
|
static TArray<FSGVectorArray> GetJointPositions(const USGHandPose* HandPose);
|
|
|
|
UFUNCTION(BlueprintPure, DisplayName="Get Joint Rotations", Category="SenseGlove | Core | Hand Pose")
|
|
static TArray<FSGQuatArray> GetJointRotationsQ(const USGHandPose* HandPose);
|
|
|
|
UFUNCTION(BlueprintPure, DisplayName="Get Joint Rotations", Category="SenseGlove | Core | Hand Pose")
|
|
static TArray<FSGRotatorArray> GetJointRotations(const USGHandPose* HandPose);
|
|
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Hand Pose")
|
|
static TArray<FSGVectorArray> GetHandAngles(const USGHandPose* HandPose);
|
|
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Hand Pose")
|
|
static bool Equals(const USGHandPose* A, const USGHandPose* B);
|
|
|
|
UFUNCTION(BlueprintPure, DisplayName="Get Normalized Flexion", Category="SenseGlove | Core | Hand Pose")
|
|
static float GetNormalizedFlexion_Finger_bClamp01(const USGHandPose* HandPose,
|
|
ESGFinger Finger, bool bClamp01 = true);
|
|
|
|
UFUNCTION(BlueprintPure, DisplayName="Get Normalized Flexion", Category="SenseGlove | Core | Hand Pose")
|
|
static TArray<float> GetNormalizedFlexion_bClamp01(const USGHandPose* HandPose, bool bClamp01 = true);
|
|
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Hand Pose")
|
|
static FString ToString(const USGHandPose* HandPose, bool bShortFormat = false);
|
|
|
|
UFUNCTION(BlueprintPure, DisplayName="Serialize", Category="SenseGlove | Core | Hand Pose")
|
|
static FString SGSerialize(const USGHandPose* HandPose);
|
|
}; |