Files
Plugin/Source/SenseGloveCoreKismet/Private/SGCoreKismet/SGBasicHandModelKismetLibrary.cpp
T

237 lines
9.1 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
*
*
*/
#include "SGCoreKismet/SGBasicHandModelKismetLibrary.h"
#include "SGCore/SGBasicHandModel.h"
#include "SGUtils//SGArrayUtils.h"
USGBasicHandModel* USGBasicHandModelKismetLibrary::MakeBasicHandModel(UObject* WorldContextObject)
{
return USGBasicHandModel::NewBasicHandModel(WorldContextObject);
}
USGBasicHandModel* USGBasicHandModelKismetLibrary::MakeBasicHandModel_bRH_L_SP(
UObject* WorldContextObject,
const bool bRightHanded, const TArray<FSGFloatArray>& Lengths, const TArray<FVector>& StartPositions)
{
return USGBasicHandModel::NewBasicHandModel(WorldContextObject, bRightHanded, Lengths, StartPositions);
}
USGBasicHandModel* USGBasicHandModelKismetLibrary::MakeBasicHandModel_bRH_L_SP_TArrayFQuat_SR(
UObject* WorldContextObject,
const bool bRightHanded, const TArray<FSGFloatArray>& Lengths,
const TArray<FVector>& StartPositions, const TArray<FQuat>& StartRotations)
{
return USGBasicHandModel::NewBasicHandModel(WorldContextObject, bRightHanded, Lengths,
StartPositions, StartRotations);
}
USGBasicHandModel* USGBasicHandModelKismetLibrary::MakeBasicHandModel_bRH_L_SP_TArrayFRotator_SR(
UObject* WorldContextObject,
const bool bRightHanded, const TArray<FSGFloatArray>& Lengths,
const TArray<FVector>& StartPositions, const TArray<FRotator>& StartRotations)
{
return USGBasicHandModel::NewBasicHandModel(WorldContextObject, bRightHanded, Lengths,
StartPositions, StartRotations);
}
USGBasicHandModel* USGBasicHandModelKismetLibrary::Default(UObject* WorldContextObject, const bool bRightHanded)
{
return USGBasicHandModel::Default(WorldContextObject, bRightHanded);
}
USGBasicHandModel* USGBasicHandModelKismetLibrary::Deserialize(UObject* WorldContextObject,
const FString& SerializedString)
{
return USGBasicHandModel::Deserialize(WorldContextObject, SerializedString);
}
TArray<FSGFloatArray> USGBasicHandModelKismetLibrary::GetBaseFingerLengths()
{
return FSGArrayUtils::ToNestedBPArray<float, FSGFloatArray>(USGBasicHandModel::GetBaseFingerLengths());
}
TArray<FVector> USGBasicHandModelKismetLibrary::GetBaseJointPositions()
{
return USGBasicHandModel::GetBaseJointPositions();
}
TArray<FVector> USGBasicHandModelKismetLibrary::GetBaseJointRotations()
{
return USGBasicHandModel::GetBaseJointRotations();
}
bool USGBasicHandModelKismetLibrary::IsRight(const USGBasicHandModel* BasicHandModel)
{
return BasicHandModel->IsRight();
}
TArray<FSGFloatArray> USGBasicHandModelKismetLibrary::GetFingerLengths(const USGBasicHandModel* BasicHandModel)
{
return FSGArrayUtils::ToNestedBPArray<float, FSGFloatArray>(BasicHandModel->GetFingerLengths());
}
TArray<float> USGBasicHandModelKismetLibrary::GetFingerLengths_F(const USGBasicHandModel* BasicHandModel,
const ESGFinger Finger)
{
return BasicHandModel->GetFingerLengths(Finger);
}
void USGBasicHandModelKismetLibrary::SetFingerLengths_ESGFinger_F_L(USGBasicHandModel* BasicHandModel,
const ESGFinger Finger,
const TArray<float>& Lengths)
{
BasicHandModel->SetFingerLengths(Finger, Lengths);
}
void USGBasicHandModelKismetLibrary::SetFingerLengths_uint8_F_L(USGBasicHandModel* BasicHandModel,
const uint8 Finger, const TArray<float>& Lengths)
{
BasicHandModel->SetFingerLengths(Finger, Lengths);
}
TArray<FSGFloatArray> USGBasicHandModelKismetLibrary::GetFingerRatios(const USGBasicHandModel* BasicHandModel) const
{
return FSGArrayUtils::ToNestedBPArray<float, FSGFloatArray>(BasicHandModel->GetFingerRatios());
}
TArray<float> USGBasicHandModelKismetLibrary::GetFingerRatios_F(const USGBasicHandModel* BasicHandModel,
const ESGFinger Finger)
{
return BasicHandModel->GetFingerRatios(Finger);
}
TArray<FVector> USGBasicHandModelKismetLibrary::GetStartJointPositions(const USGBasicHandModel* BasicHandModel)
{
return BasicHandModel->GetStartJointPositions();
}
void USGBasicHandModelKismetLibrary::SetStartJointPosition_ESGFinger_F_P(USGBasicHandModel* BasicHandModel,
const ESGFinger Finger,
const FVector& Position)
{
BasicHandModel->SetStartJointPosition(Finger, Position);
}
void USGBasicHandModelKismetLibrary::SetStartJointPosition_uint8_F_P(USGBasicHandModel* BasicHandModel,
const uint8 Finger, const FVector& Position)
{
BasicHandModel->SetStartJointPosition(Finger, Position);
}
TArray<FQuat> USGBasicHandModelKismetLibrary::GetStartJointRotations_TArrayFQuat(
const USGBasicHandModel* BasicHandModel)
{
return BasicHandModel->GetStartJointRotationsQ();
}
TArray<FRotator> USGBasicHandModelKismetLibrary::GetStartJointRotations_TArrayFRotator(
const USGBasicHandModel* BasicHandModel)
{
return BasicHandModel->GetStartJointRotations();
}
FVector USGBasicHandModelKismetLibrary::GetJointPosition(const USGBasicHandModel* BasicHandModel,
const ESGFinger Finger)
{
return BasicHandModel->GetJointPosition(Finger);
}
void USGBasicHandModelKismetLibrary::SetJointPosition(USGBasicHandModel* BasicHandModel, const FVector& NewPosition,
const ESGFinger Finger)
{
return BasicHandModel->SetJointPosition(NewPosition, Finger);
}
FQuat USGBasicHandModelKismetLibrary::GetJointRotation_FQuat(const USGBasicHandModel* BasicHandModel,
const ESGFinger Finger)
{
return BasicHandModel->GetJointRotationQ(Finger);
}
FRotator USGBasicHandModelKismetLibrary::GetJointRotation_FRotator(const USGBasicHandModel* BasicHandModel,
const ESGFinger Finger)
{
return BasicHandModel->GetJointRotation(Finger);
}
void USGBasicHandModelKismetLibrary::SetJointRotation_FQuat_NR_F(USGBasicHandModel* BasicHandModel,
const FQuat& NewRotation, const ESGFinger Finger)
{
return BasicHandModel->SetJointRotation(NewRotation, Finger);
}
void USGBasicHandModelKismetLibrary::SetJointRotation_FRotator_NR_F(USGBasicHandModel* BasicHandModel,
const FRotator& NewRotation, const ESGFinger Finger)
{
return BasicHandModel->SetJointRotation(NewRotation, Finger);
}
TArray<float> USGBasicHandModelKismetLibrary::GetTotalLengths(const USGBasicHandModel* BasicHandModel)
{
return BasicHandModel->GetTotalLengths();
}
float USGBasicHandModelKismetLibrary::GetTotalLength(const USGBasicHandModel* BasicHandModel, const ESGFinger Finger)
{
return BasicHandModel->GetTotalLength(Finger);
}
TArray<FVector> USGBasicHandModelKismetLibrary::Get3DLengths(const USGBasicHandModel* BasicHandModel,
const ESGFinger Finger)
{
return BasicHandModel->Get3DLengths(Finger);
}
bool USGBasicHandModelKismetLibrary::Equals(const USGBasicHandModel* A, const USGBasicHandModel* B)
{
return A->Equals(B);
}
FString USGBasicHandModelKismetLibrary::ToString(const USGBasicHandModel* BasicHandModel)
{
return BasicHandModel->ToString();
}
FString USGBasicHandModelKismetLibrary::ToString_bLO(const USGBasicHandModel* BasicHandModel, const bool bLengthsOnly)
{
return BasicHandModel->ToString(bLengthsOnly);
}
FString USGBasicHandModelKismetLibrary::SGSerialize(const USGBasicHandModel* BasicHandModel)
{
return BasicHandModel->SGSerialize();
}