211 lines
8.2 KiB
C++
211 lines
8.2 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/SGSenseGloveInfoKismetLibrary.h"
|
|
|
|
#include "SGCore/SGSenseGloveInfo.h"
|
|
#include "SGUtils/SGArrayUtils.h"
|
|
|
|
USGSenseGloveInfo* USGSenseGloveInfoKismetLibrary::MakeSenseGloveInfo(UObject* WorldContextObject)
|
|
{
|
|
return USGSenseGloveInfo::NewSenseGloveInfo(WorldContextObject);
|
|
}
|
|
|
|
USGSenseGloveInfo*
|
|
USGSenseGloveInfoKismetLibrary::MakeSenseGloveInfo_DI_HV_FV_SFV_bRH_NOS_FQuat_IC_SP_TArrayFQuat_SR_GL_F(
|
|
UObject* WorldContextObject, const FString& DeviceId,
|
|
const FString& HardwareVersion, const int32 FirmwareVersion, const int32 SubFirmwareVersion,
|
|
const bool bRightHanded, const int32 NumberOfSensors, const FQuat& ImuCorrection,
|
|
const TArray<FVector>& StartPositions, const TArray<FQuat>& StartRotations,
|
|
const TArray<FSGVectorArray>& GloveLengths, const TArray<bool>& Functions)
|
|
{
|
|
return USGSenseGloveInfo::NewSenseGloveInfo(WorldContextObject, DeviceId,
|
|
HardwareVersion, FirmwareVersion, SubFirmwareVersion,
|
|
bRightHanded, NumberOfSensors, ImuCorrection,
|
|
StartPositions, StartRotations,
|
|
GloveLengths, Functions);
|
|
}
|
|
|
|
USGSenseGloveInfo*
|
|
USGSenseGloveInfoKismetLibrary::MakeSenseGloveInfo_DI_HV_FV_SFV_bRH_NOS_FRotator_IC_SP_TArrayFRotator_SR_GL_F(
|
|
UObject* WorldContextObject, const FString& DeviceId,
|
|
const FString& HardwareVersion, const int32 FirmwareVersion, const int32 SubFirmwareVersion,
|
|
const bool bRightHanded, const int32 NumberOfSensors, const FRotator& ImuCorrection,
|
|
const TArray<FVector>& StartPositions, const TArray<FRotator>& StartRotations,
|
|
const TArray<FSGVectorArray>& GloveLengths, const TArray<bool>& Functions)
|
|
{
|
|
return USGSenseGloveInfo::NewSenseGloveInfo(WorldContextObject, DeviceId,
|
|
HardwareVersion, FirmwareVersion, SubFirmwareVersion,
|
|
bRightHanded, NumberOfSensors, ImuCorrection,
|
|
StartPositions, StartRotations,
|
|
GloveLengths, Functions);
|
|
}
|
|
|
|
bool USGSenseGloveInfoKismetLibrary::Parse(UObject* WorldContextObject,
|
|
const FString& ConstantsString, USGSenseGloveInfo*& OutGloveInfo,
|
|
const bool bUpdateOldModels)
|
|
{
|
|
return USGSenseGloveInfo::Parse(WorldContextObject, ConstantsString, OutGloveInfo, bUpdateOldModels);
|
|
}
|
|
|
|
USGSenseGloveInfo* USGSenseGloveInfoKismetLibrary::Deserialize(UObject* WorldContextObject,
|
|
const FString& SerializedString)
|
|
{
|
|
return USGSenseGloveInfo::Deserialize(WorldContextObject, SerializedString);
|
|
}
|
|
|
|
FString USGSenseGloveInfoKismetLibrary::GetDeviceId(const USGSenseGloveInfo* SenseGloveInfo)
|
|
{
|
|
return SenseGloveInfo->GetDeviceId();
|
|
}
|
|
|
|
FString USGSenseGloveInfoKismetLibrary::GetHardwareVersion(const USGSenseGloveInfo* SenseGloveInfo)
|
|
{
|
|
return SenseGloveInfo->GetHardwareVersion();
|
|
}
|
|
|
|
int32 USGSenseGloveInfoKismetLibrary::GetFirmwareVersion(const USGSenseGloveInfo* SenseGloveInfo)
|
|
{
|
|
return SenseGloveInfo->GetFirmwareVersion();
|
|
}
|
|
|
|
int32 USGSenseGloveInfoKismetLibrary::GetSubFirmwareVersion(const USGSenseGloveInfo* SenseGloveInfo)
|
|
{
|
|
return SenseGloveInfo->GetSubFirmwareVersion();
|
|
}
|
|
|
|
bool USGSenseGloveInfoKismetLibrary::IsRight(const USGSenseGloveInfo* SenseGloveInfo)
|
|
{
|
|
return SenseGloveInfo->IsRight();
|
|
}
|
|
|
|
int32 USGSenseGloveInfoKismetLibrary::GetNumberOfSensors(const USGSenseGloveInfo* SenseGloveInfo)
|
|
{
|
|
return SenseGloveInfo->GetNumberOfSensors();
|
|
}
|
|
|
|
FQuat USGSenseGloveInfoKismetLibrary::GetImuCorrection_FQuat(const USGSenseGloveInfo* SenseGloveInfo)
|
|
{
|
|
return SenseGloveInfo->GetImuCorrectionQ();
|
|
}
|
|
|
|
FRotator USGSenseGloveInfoKismetLibrary::GetImuCorrection_FRotator(const USGSenseGloveInfo* SenseGloveInfo)
|
|
{
|
|
return SenseGloveInfo->GetImuCorrection();
|
|
}
|
|
|
|
TArray<FVector> USGSenseGloveInfoKismetLibrary::GetStartPositions(const USGSenseGloveInfo* SenseGloveInfo)
|
|
{
|
|
return SenseGloveInfo->GetStartPositions();
|
|
}
|
|
|
|
TArray<FQuat> USGSenseGloveInfoKismetLibrary::GetStartRotations_TArrayFQuat(const USGSenseGloveInfo* SenseGloveInfo)
|
|
{
|
|
return SenseGloveInfo->GetStartRotationsQ();
|
|
}
|
|
|
|
TArray<FRotator> USGSenseGloveInfoKismetLibrary::GetStartRotations_TArrayFRotator(
|
|
const USGSenseGloveInfo* SenseGloveInfo)
|
|
{
|
|
return SenseGloveInfo->GetStartRotations();
|
|
}
|
|
|
|
TArray<FSGVectorArray> USGSenseGloveInfoKismetLibrary::GetGloveLengths(const USGSenseGloveInfo* SenseGloveInfo)
|
|
{
|
|
return FSGArrayUtils::ToBPNestedArray<FVector, FSGVectorArray>(SenseGloveInfo->GetGloveLengths());
|
|
}
|
|
|
|
TArray<bool> USGSenseGloveInfoKismetLibrary::GetFunctions(const USGSenseGloveInfo* SenseGloveInfo)
|
|
{
|
|
return SenseGloveInfo->GetFunctions();
|
|
}
|
|
|
|
FVector USGSenseGloveInfoKismetLibrary::GetStartPosition(const USGSenseGloveInfo* SenseGloveInfo,
|
|
const ESGFinger Finger)
|
|
{
|
|
return SenseGloveInfo->GetStartPosition(Finger);
|
|
}
|
|
|
|
FQuat USGSenseGloveInfoKismetLibrary::GetStartRotation_FQuat(const USGSenseGloveInfo* SenseGloveInfo,
|
|
const ESGFinger Finger)
|
|
{
|
|
return SenseGloveInfo->GetStartRotationQ(Finger);
|
|
}
|
|
|
|
FRotator USGSenseGloveInfoKismetLibrary::GetStartRotation_FRotator(const USGSenseGloveInfo* SenseGloveInfo,
|
|
const ESGFinger Finger)
|
|
{
|
|
return SenseGloveInfo->GetStartRotation(Finger);
|
|
}
|
|
|
|
TArray<FVector> USGSenseGloveInfoKismetLibrary::GetGloveLengths_F(const USGSenseGloveInfo* SenseGloveInfo,
|
|
const ESGFinger Finger)
|
|
{
|
|
return SenseGloveInfo->GetGloveLengths(Finger);
|
|
}
|
|
|
|
TArray<FSGVectorArray> USGSenseGloveInfoKismetLibrary::ToGloveAngles(const USGSenseGloveInfo* SenseGloveInfo,
|
|
const TArray<FSGFloatArray>& SensorAngles)
|
|
{
|
|
TArray<TArray<float>> SensorAnglesNestedArray{
|
|
FSGArrayUtils::FromBPNestedArray<
|
|
float, FSGFloatArray, &FSGFloatArray::FloatArray>(SensorAngles)
|
|
};
|
|
TArray<FSGVectorArray> GloveAngles{
|
|
FSGArrayUtils::ToBPNestedArray<FVector, FSGVectorArray>(
|
|
SenseGloveInfo->ToGloveAngles(MoveTemp(SensorAnglesNestedArray)))
|
|
};
|
|
return MoveTemp(GloveAngles);
|
|
}
|
|
|
|
bool USGSenseGloveInfoKismetLibrary::Equals(const USGSenseGloveInfo* A, const USGSenseGloveInfo* B)
|
|
{
|
|
return A->Equals(B);
|
|
}
|
|
|
|
FString USGSenseGloveInfoKismetLibrary::ToString(const USGSenseGloveInfo* SenseGloveInfo)
|
|
{
|
|
return SenseGloveInfo->ToString();
|
|
}
|
|
|
|
FString USGSenseGloveInfoKismetLibrary::ToString_bSN(const USGSenseGloveInfo* SenseGloveInfo, const bool bShortNotation)
|
|
{
|
|
return SenseGloveInfo->ToString(bShortNotation);
|
|
}
|
|
|
|
FString USGSenseGloveInfoKismetLibrary::SGSerialize(const USGSenseGloveInfo* SenseGloveInfo)
|
|
{
|
|
return SenseGloveInfo->SGSerialize();
|
|
} |