/** * @file * * @author Mamadou Babaei * * @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 "SGCore/SGBasicHandModel.h" #include "Runtime/Launch/Resources/Version.h" #include "SGCoreImpl/SGExportedFunctions.h" #include "SGInterop/SGIC_ESGFinger.h" #include "SGInterop/SGIC_FQuat.h" #include "SGInterop/SGIC_FSGBasicHandModelImpl.h" #include "SGInterop/SGIC_FString.h" #include "SGInterop/SGIC_FVector.h" #include "SGInterop/SGIC_TArray_float.h" #include "SGInterop/SGIC_TArray_FQuat.h" #include "SGInterop/SGIC_TArray_FVector.h" #include "SGInterop/SGIC_TArray_TArray_float.h" #include "SGUtils/SGArrayUtils.h" struct USGBasicHandModel::FImpl { /************************ * Member variables ************************/ FSGBasicHandModelImpl BasicHandModelImpl; /************************ * Owner object ************************/ USGBasicHandModel* Owner; /************************ * Constructor / Destructor ************************/ explicit FImpl(USGBasicHandModel* InOwner); ~FImpl(); /************************ * Default copy constructor & copy assignment operator ************************/ FImpl(const FImpl& Rhs) = default; FImpl& operator=(const FImpl& Rhs) = default; /************************ * Methods ************************/ void SyncUProperties(); void SyncImplObject(); }; USGBasicHandModel* USGBasicHandModel::NewBasicHandModel(UObject* Outer, const FSGBasicHandModelImpl& BasicHandModelImpl) { USGBasicHandModel* Instance = NewObject(Outer); Instance->SetBasicHandModelImpl(BasicHandModelImpl); return Instance; } USGBasicHandModel* USGBasicHandModel::NewBasicHandModel(UObject* Outer) { FSGIC_FSGBasicHandModelImpl OutBasicHandModelImplContainer; SGCoreImpl_FSGBasicHandModelImpl_ctor(&OutBasicHandModelImplContainer); return NewBasicHandModel(Outer, MoveTemp(OutBasicHandModelImplContainer.BasicHandModelImpl)); } USGBasicHandModel* USGBasicHandModel::NewBasicHandModel(UObject* Outer, const bool bRightHanded, const TArray>& Lengths, const TArray& StartPositions) { FSGIC_FSGBasicHandModelImpl OutBasicHandModelImplContainer; FSGIC_TArray_TArray_float LengthsContainer{Lengths}; FSGIC_TArray_FVector StartPositionsContainer{StartPositions}; SGCoreImpl_FSGBasicHandModelImpl_ctor_bRightHanded_Lengths_StartPosition( &OutBasicHandModelImplContainer, bRightHanded, &LengthsContainer, &StartPositionsContainer); return NewBasicHandModel(Outer, MoveTemp(OutBasicHandModelImplContainer.BasicHandModelImpl)); } USGBasicHandModel* USGBasicHandModel::NewBasicHandModel(UObject* Outer, const bool bRightHanded, const TArray& Lengths, const TArray& StartPositions) { FSGIC_FSGBasicHandModelImpl OutBasicHandModelImplContainer; FSGIC_TArray_TArray_float LengthsContainer{ FSGArrayUtils::FromNestedBPArray(Lengths) }; FSGIC_TArray_FVector StartPositionsContainer{StartPositions}; SGCoreImpl_FSGBasicHandModelImpl_ctor_bRightHanded_Lengths_StartPosition( &OutBasicHandModelImplContainer, bRightHanded, &LengthsContainer, &StartPositionsContainer); return NewBasicHandModel(Outer, MoveTemp(OutBasicHandModelImplContainer.BasicHandModelImpl)); } USGBasicHandModel* USGBasicHandModel::NewBasicHandModel(UObject* Outer, const bool bRightHanded, const TArray>& Lengths, const TArray& StartPositions, const TArray& StartRotations) { FSGIC_FSGBasicHandModelImpl OutBasicHandModelImplContainer; FSGIC_TArray_TArray_float LengthsContainer{Lengths}; FSGIC_TArray_FVector StartPositionsContainer{StartPositions}; FSGIC_TArray_FQuat StartRotationsContainer{StartRotations}; SGCoreImpl_FSGBasicHandModelImpl_ctor_bRightHanded_Lengths_StartPositions_StartRotations( &OutBasicHandModelImplContainer, bRightHanded, &LengthsContainer, &StartPositionsContainer, &StartRotationsContainer); return NewBasicHandModel(Outer, MoveTemp(OutBasicHandModelImplContainer.BasicHandModelImpl)); } USGBasicHandModel* USGBasicHandModel::NewBasicHandModel(UObject* Outer, const bool bRightHanded, const TArray>& Lengths, const TArray& StartPositions, const TArray& StartRotations) { FSGIC_FSGBasicHandModelImpl OutBasicHandModelImplContainer; FSGIC_TArray_TArray_float LengthsContainer{Lengths}; FSGIC_TArray_FVector StartPositionsContainer{StartPositions}; FSGIC_TArray_FQuat StartRotationsContainer{FSGArrayUtils::RotatorsToQuats(StartRotations)}; SGCoreImpl_FSGBasicHandModelImpl_ctor_bRightHanded_Lengths_StartPositions_StartRotations( &OutBasicHandModelImplContainer, bRightHanded, &LengthsContainer, &StartPositionsContainer, &StartRotationsContainer); return NewBasicHandModel(Outer, MoveTemp(OutBasicHandModelImplContainer.BasicHandModelImpl)); } USGBasicHandModel* USGBasicHandModel::NewBasicHandModel(UObject* Outer, const bool bRightHanded, const TArray& Lengths, const TArray& StartPositions, const TArray& StartRotations) { FSGIC_FSGBasicHandModelImpl OutBasicHandModelImplContainer; FSGIC_TArray_TArray_float LengthsContainer{ FSGArrayUtils::FromNestedBPArray(Lengths) }; FSGIC_TArray_FVector StartPositionsContainer{StartPositions}; FSGIC_TArray_FQuat StartRotationsContainer{StartRotations}; SGCoreImpl_FSGBasicHandModelImpl_ctor_bRightHanded_Lengths_StartPositions_StartRotations( &OutBasicHandModelImplContainer, bRightHanded, &LengthsContainer, &StartPositionsContainer, &StartRotationsContainer); return NewBasicHandModel(Outer, MoveTemp(OutBasicHandModelImplContainer.BasicHandModelImpl)); } USGBasicHandModel* USGBasicHandModel::NewBasicHandModel(UObject* Outer, const bool bRightHanded, const TArray& Lengths, const TArray& StartPositions, const TArray& StartRotations) { FSGIC_FSGBasicHandModelImpl OutBasicHandModelImplContainer; FSGIC_TArray_TArray_float LengthsContainer{ FSGArrayUtils::FromNestedBPArray(Lengths) }; FSGIC_TArray_FVector StartPositionsContainer{StartPositions}; FSGIC_TArray_FQuat StartRotationsContainer{FSGArrayUtils::RotatorsToQuats(StartRotations)}; SGCoreImpl_FSGBasicHandModelImpl_ctor_bRightHanded_Lengths_StartPositions_StartRotations( &OutBasicHandModelImplContainer, bRightHanded, &LengthsContainer, &StartPositionsContainer, &StartRotationsContainer); return NewBasicHandModel(Outer, MoveTemp(OutBasicHandModelImplContainer.BasicHandModelImpl)); } USGBasicHandModel* USGBasicHandModel::Default(UObject* Outer, const bool bRightHanded) { FSGIC_FSGBasicHandModelImpl OutBasicHandModelImplContainer; SGCoreImpl_FSGBasicHandModelImpl_Default(&OutBasicHandModelImplContainer, bRightHanded); return NewBasicHandModel(Outer, MoveTemp(OutBasicHandModelImplContainer.BasicHandModelImpl)); } USGBasicHandModel* USGBasicHandModel::Deserialize(UObject* Outer, const FString& SerializedString) { FSGIC_FSGBasicHandModelImpl OutBasicHandModelContainer; FSGIC_FString SerializedStringContainer{SerializedString}; SGCoreImpl_FSGBasicHandModelImpl_Deserialize(&OutBasicHandModelContainer, &SerializedStringContainer); return NewBasicHandModel(Outer, MoveTemp(OutBasicHandModelContainer.BasicHandModelImpl));; } TArray> USGBasicHandModel::GetBaseFingerLengths() { FSGIC_TArray_TArray_float OutLengthsContainer; SGCoreImpl_FSGBasicHandModelImpl_GetBaseFingerLengths(&OutLengthsContainer); return MoveTemp(OutLengthsContainer.Array); } TArray USGBasicHandModel::GetBaseJointPositions() { FSGIC_TArray_FVector OutPositionsContainer; SGCoreImpl_FSGBasicHandModelImpl_GetBaseJointPositions(&OutPositionsContainer); return MoveTemp(OutPositionsContainer.Array); } TArray USGBasicHandModel::GetBaseJointAngles() { FSGIC_TArray_FVector OutRotationsContainer; SGCoreImpl_FSGBasicHandModelImpl_GetBaseJointAngles(&OutRotationsContainer); return MoveTemp(OutRotationsContainer.Array); } USGBasicHandModel::USGBasicHandModel() : #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) #else Pimpl(TUniquePtr(new FImpl{this})) #endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) */ { FSGIC_FSGBasicHandModelImpl OutBasicHandModelImplContainer; SGCoreImpl_FSGBasicHandModelImpl_ctor(&OutBasicHandModelImplContainer); Pimpl->BasicHandModelImpl = MoveTemp(OutBasicHandModelImplContainer.BasicHandModelImpl); Pimpl->SyncUProperties(); } USGBasicHandModel::USGBasicHandModel(const bool bRightHanded, const TArray>& Lengths, const TArray& StartPositions) : #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) #else Pimpl(TUniquePtr(new FImpl{this})) #endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) */ { FSGIC_FSGBasicHandModelImpl OutBasicHandModelImplContainer; FSGIC_TArray_TArray_float LengthsContainer{Lengths}; FSGIC_TArray_FVector StartPositionsContainer{StartPositions}; SGCoreImpl_FSGBasicHandModelImpl_ctor_bRightHanded_Lengths_StartPosition( &OutBasicHandModelImplContainer, bRightHanded, &LengthsContainer, &StartPositionsContainer); Pimpl->BasicHandModelImpl = MoveTemp(OutBasicHandModelImplContainer.BasicHandModelImpl); Pimpl->SyncUProperties(); } USGBasicHandModel::USGBasicHandModel(bool bRightHanded, const TArray& Lengths, const TArray& StartPositions) : #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) #else Pimpl(TUniquePtr(new FImpl{this})) #endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) */ { FSGIC_FSGBasicHandModelImpl OutBasicHandModelImplContainer; FSGIC_TArray_TArray_float LengthsContainer{ FSGArrayUtils::FromNestedBPArray(Lengths) }; FSGIC_TArray_FVector StartPositionsContainer{StartPositions}; SGCoreImpl_FSGBasicHandModelImpl_ctor_bRightHanded_Lengths_StartPosition( &OutBasicHandModelImplContainer, bRightHanded, &LengthsContainer, &StartPositionsContainer); Pimpl->BasicHandModelImpl = MoveTemp(OutBasicHandModelImplContainer.BasicHandModelImpl); Pimpl->SyncUProperties(); } USGBasicHandModel::USGBasicHandModel(const bool bRightHanded, const TArray>& Lengths, const TArray& StartPositions, const TArray& StartRotations) : #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) #else Pimpl(TUniquePtr(new FImpl{this})) #endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) */ { FSGIC_FSGBasicHandModelImpl OutBasicHandModelImplContainer; FSGIC_TArray_TArray_float LengthsContainer{Lengths}; FSGIC_TArray_FVector StartPositionsContainer{StartPositions}; FSGIC_TArray_FQuat StartRotationsContainer{StartRotations}; SGCoreImpl_FSGBasicHandModelImpl_ctor_bRightHanded_Lengths_StartPositions_StartRotations( &OutBasicHandModelImplContainer, bRightHanded, &LengthsContainer, &StartPositionsContainer, &StartRotationsContainer); Pimpl->BasicHandModelImpl = MoveTemp(OutBasicHandModelImplContainer.BasicHandModelImpl); Pimpl->SyncUProperties(); } USGBasicHandModel::USGBasicHandModel(const bool bRightHanded, const TArray>& Lengths, const TArray& StartPositions, const TArray& StartRotations) : #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) #else Pimpl(TUniquePtr(new FImpl{this})) #endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) */ { FSGIC_FSGBasicHandModelImpl OutBasicHandModelImplContainer; FSGIC_TArray_TArray_float LengthsContainer{Lengths}; FSGIC_TArray_FVector StartPositionsContainer{StartPositions}; FSGIC_TArray_FQuat StartRotationsContainer{FSGArrayUtils::RotatorsToQuats(StartRotations)}; SGCoreImpl_FSGBasicHandModelImpl_ctor_bRightHanded_Lengths_StartPositions_StartRotations( &OutBasicHandModelImplContainer, bRightHanded, &LengthsContainer, &StartPositionsContainer, &StartRotationsContainer); Pimpl->BasicHandModelImpl = MoveTemp(OutBasicHandModelImplContainer.BasicHandModelImpl); Pimpl->SyncUProperties(); } USGBasicHandModel::USGBasicHandModel(const bool bRightHanded, const TArray& Lengths, const TArray& StartPositions, const TArray& StartRotations) : #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) #else Pimpl(TUniquePtr(new FImpl{this})) #endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) */ { FSGIC_FSGBasicHandModelImpl OutBasicHandModelImplContainer; FSGIC_TArray_TArray_float LengthsContainer{ FSGArrayUtils::FromNestedBPArray(Lengths) }; FSGIC_TArray_FVector StartPositionsContainer{StartPositions}; FSGIC_TArray_FQuat StartRotationsContainer{StartRotations}; SGCoreImpl_FSGBasicHandModelImpl_ctor_bRightHanded_Lengths_StartPositions_StartRotations( &OutBasicHandModelImplContainer, bRightHanded, &LengthsContainer, &StartPositionsContainer, &StartRotationsContainer); Pimpl->BasicHandModelImpl = MoveTemp(OutBasicHandModelImplContainer.BasicHandModelImpl); Pimpl->SyncUProperties(); } USGBasicHandModel::USGBasicHandModel(const bool bRightHanded, const TArray& Lengths, const TArray& StartPositions, const TArray& StartRotations) : #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) #else Pimpl(TUniquePtr(new FImpl{this})) #endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) */ { FSGIC_FSGBasicHandModelImpl OutBasicHandModelImplContainer; FSGIC_TArray_TArray_float LengthsContainer{ FSGArrayUtils::FromNestedBPArray(Lengths) }; FSGIC_TArray_FVector StartPositionsContainer{StartPositions}; FSGIC_TArray_FQuat StartRotationsContainer{FSGArrayUtils::RotatorsToQuats(StartRotations)}; SGCoreImpl_FSGBasicHandModelImpl_ctor_bRightHanded_Lengths_StartPositions_StartRotations( &OutBasicHandModelImplContainer, bRightHanded, &LengthsContainer, &StartPositionsContainer, &StartRotationsContainer); Pimpl->BasicHandModelImpl = MoveTemp(OutBasicHandModelImplContainer.BasicHandModelImpl); Pimpl->SyncUProperties(); } USGBasicHandModel::USGBasicHandModel(const FSGBasicHandModelImpl& BasicHandModelImpl) : #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) #else Pimpl(TUniquePtr(new FImpl{this})) #endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) */ { SetBasicHandModelImpl(BasicHandModelImpl); Pimpl->SyncUProperties(); } USGBasicHandModel::~USGBasicHandModel() = default; void USGBasicHandModel::SetBasicHandModelImpl(const FSGBasicHandModelImpl& BasicHandModelImpl) { FSGIC_FSGBasicHandModelImpl OutBasicHandModelContainer; FSGIC_FSGBasicHandModelImpl RhsContainer{BasicHandModelImpl}; SGCoreImpl_FSGBasicHandModelImpl_ctor_copy(&OutBasicHandModelContainer, &RhsContainer); Pimpl->BasicHandModelImpl = MoveTemp(OutBasicHandModelContainer.BasicHandModelImpl); } const FSGBasicHandModelImpl& USGBasicHandModel::ToBasicHandModelImpl() const { Pimpl->SyncImplObject(); return Pimpl->BasicHandModelImpl; } FSGBasicHandModelImpl& USGBasicHandModel::ToBasicHandModelImpl() { Pimpl->SyncImplObject(); return Pimpl->BasicHandModelImpl; } bool USGBasicHandModel::IsRight() const { FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; return SGCoreImpl_FSGBasicHandModelImpl_IsRight(&InstanceContainer); } TArray> USGBasicHandModel::GetFingerLengths() const { FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; FSGIC_TArray_TArray_float OutLengthsContainer; SGCoreImpl_FSGBasicHandModelImpl_GetFingerLengths(&InstanceContainer, &OutLengthsContainer); return MoveTemp(OutLengthsContainer.Array); } TArray USGBasicHandModel::GetFingerLengths(const ESGFinger Finger) const { Pimpl->SyncImplObject(); FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; FSGIC_TArray_float OutLengthsContainer; FSGIC_ESGFinger FingerContainer{Finger}; SGCoreImpl_FSGBasicHandModelImpl_GetFingerLengths_Finger(&InstanceContainer, &OutLengthsContainer, &FingerContainer); return MoveTemp(OutLengthsContainer.Array); } void USGBasicHandModel::SetFingerLengths(const ESGFinger Finger, const TArray& Lengths) { Pimpl->SyncImplObject(); FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; FSGIC_ESGFinger FingerContainer{Finger}; FSGIC_TArray_float LengthsContainer{Lengths}; SGCoreImpl_FSGBasicHandModelImpl_SetFingerLengths_ESGFinger(&InstanceContainer, &FingerContainer, &LengthsContainer); Pimpl->SyncUProperties(); } void USGBasicHandModel::SetFingerLengths(const uint8 Finger, const TArray& Lengths) { Pimpl->SyncImplObject(); FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; FSGIC_TArray_float LengthsContainer{Lengths}; SGCoreImpl_FSGBasicHandModelImpl_SetFingerLengths_uint8Finger(&InstanceContainer, Finger, &LengthsContainer); Pimpl->SyncUProperties(); } TArray> USGBasicHandModel::GetFingerRatios() const { FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; FSGIC_TArray_TArray_float OutRatiosContainer; SGCoreImpl_FSGBasicHandModelImpl_GetFingerRatios(&InstanceContainer, &OutRatiosContainer); return MoveTemp(OutRatiosContainer.Array); } TArray USGBasicHandModel::GetFingerRatios(const ESGFinger Finger) const { Pimpl->SyncImplObject(); FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; FSGIC_ESGFinger FingerContainer{Finger}; FSGIC_TArray_float OutRatiosContainer; SGCoreImpl_FSGBasicHandModelImpl_GetFingerRatios_Finger(&InstanceContainer, &OutRatiosContainer, &FingerContainer); return MoveTemp(OutRatiosContainer.Array); } TArray USGBasicHandModel::GetStartJointPositions() const { FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; FSGIC_TArray_FVector OutPositionsContainer; SGCoreImpl_FSGBasicHandModelImpl_GetStartJointPositions(&InstanceContainer, &OutPositionsContainer); return MoveTemp(OutPositionsContainer.Array); } void USGBasicHandModel::SetStartJointPosition(const ESGFinger Finger, const FVector& Position) { Pimpl->SyncImplObject(); FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; FSGIC_ESGFinger FingerContainer{Finger}; FSGIC_FVector PositionContainer{Position}; SGCoreImpl_FSGBasicHandModelImpl_SetStartJointPosition_ESGFinger(&InstanceContainer, &FingerContainer, &PositionContainer); Pimpl->SyncUProperties(); } void USGBasicHandModel::SetStartJointPosition(const uint8 Finger, const FVector& Position) { Pimpl->SyncImplObject(); FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; FSGIC_FVector PositionContainer{Position}; SGCoreImpl_FSGBasicHandModelImpl_SetStartJointPosition_uin8Finger(&InstanceContainer, Finger, &PositionContainer); Pimpl->SyncUProperties(); } TArray USGBasicHandModel::GetStartJointRotationsQ() const { FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; FSGIC_TArray_FQuat OutRotationsContainer; SGCoreImpl_FSGBasicHandModelImpl_GetStartJointRotations(&InstanceContainer, &OutRotationsContainer); return MoveTemp(OutRotationsContainer.Array); } TArray USGBasicHandModel::GetStartJointRotations() const { FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; FSGIC_TArray_FQuat OutRotationsContainer; SGCoreImpl_FSGBasicHandModelImpl_GetStartJointRotations(&InstanceContainer, &OutRotationsContainer); return FSGArrayUtils::QuatsToRotators(OutRotationsContainer.Array); } FVector USGBasicHandModel::GetJointPosition(const ESGFinger Finger) const { Pimpl->SyncImplObject(); FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; FSGIC_FVector OutPositionContainer; FSGIC_ESGFinger FingerContainer{Finger}; SGCoreImpl_FSGBasicHandModelImpl_GetJointPosition(&InstanceContainer, &OutPositionContainer, &FingerContainer); return MoveTemp(OutPositionContainer.Vector); } void USGBasicHandModel::SetJointPosition(const FVector& NewPosition, const ESGFinger Finger) { Pimpl->SyncImplObject(); FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; FSGIC_FVector NewPositionContainer{NewPosition}; FSGIC_ESGFinger FingerContainer{Finger}; SGCoreImpl_FSGBasicHandModelImpl_SetJointPosition(&InstanceContainer, &NewPositionContainer, &FingerContainer); Pimpl->SyncUProperties(); } FQuat USGBasicHandModel::GetJointRotationQ(const ESGFinger Finger) const { Pimpl->SyncImplObject(); FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; FSGIC_FQuat OutRotationContainer; FSGIC_ESGFinger FingerContainer{Finger}; SGCoreImpl_FSGBasicHandModelImpl_GetJointRotation(&InstanceContainer, &OutRotationContainer, &FingerContainer); return MoveTemp(OutRotationContainer.Quat); } FRotator USGBasicHandModel::GetJointRotation(const ESGFinger Finger) const { Pimpl->SyncImplObject(); FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; FSGIC_FQuat OutRotationContainer; FSGIC_ESGFinger FingerContainer{Finger}; SGCoreImpl_FSGBasicHandModelImpl_GetJointRotation(&InstanceContainer, &OutRotationContainer, &FingerContainer); return OutRotationContainer.Quat.Rotator(); } void USGBasicHandModel::SetJointRotation(const FQuat& NewRotation, const ESGFinger Finger) { Pimpl->SyncImplObject(); FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; FSGIC_FQuat NewRotationContainer{NewRotation}; FSGIC_ESGFinger FingerContainer{Finger}; SGCoreImpl_FSGBasicHandModelImpl_SetJointRotation(&InstanceContainer, &NewRotationContainer, &FingerContainer); Pimpl->SyncUProperties(); } void USGBasicHandModel::SetJointRotation(const FRotator& NewRotation, const ESGFinger Finger) { Pimpl->SyncImplObject(); FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; FSGIC_FQuat NewRotationContainer{NewRotation.Quaternion()}; FSGIC_ESGFinger FingerContainer{Finger}; SGCoreImpl_FSGBasicHandModelImpl_SetJointRotation(&InstanceContainer, &NewRotationContainer, &FingerContainer); Pimpl->SyncUProperties(); } TArray USGBasicHandModel::GetTotalLengths() const { FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; FSGIC_TArray_float OutLengthsContainer; SGCoreImpl_FSGBasicHandModelImpl_GetTotalLengths(&InstanceContainer, &OutLengthsContainer); return MoveTemp(OutLengthsContainer.Array); } float USGBasicHandModel::GetTotalLength(const ESGFinger Finger) const { Pimpl->SyncImplObject(); FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; FSGIC_ESGFinger FingerContainer{Finger}; return SGCoreImpl_FSGBasicHandModelImpl_GetTotalLength(&InstanceContainer, &FingerContainer); } TArray USGBasicHandModel::Get3DLengths(const ESGFinger Finger) const { Pimpl->SyncImplObject(); FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; FSGIC_TArray_FVector OutLengthsContainer; FSGIC_ESGFinger FingerContainer{Finger}; SGCoreImpl_FSGBasicHandModelImpl_Get3DLengths(&InstanceContainer, &OutLengthsContainer, &FingerContainer); return MoveTemp(OutLengthsContainer.Array); } bool USGBasicHandModel::Equals(const USGBasicHandModel* BasicHandModel) const { Pimpl->SyncImplObject(); FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; FSGIC_FSGBasicHandModelImpl BasicHandModelContainer{BasicHandModel->ToBasicHandModelImpl()}; return SGCoreImpl_FSGBasicHandModelImpl_Equals(&InstanceContainer, &BasicHandModelContainer); } FString USGBasicHandModel::ToString() const { Pimpl->SyncImplObject(); FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; FSGIC_FString OutStringContainer; SGCoreImpl_FSGBasicHandModelImpl_ToString(&InstanceContainer, &OutStringContainer); return MoveTemp(OutStringContainer.String); } FString USGBasicHandModel::ToString(const bool bLengthsOnly) const { Pimpl->SyncImplObject(); FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; FSGIC_FString OutStringContainer; SGCoreImpl_FSGBasicHandModelImpl_ToString_bLengthsOnly(&InstanceContainer, &OutStringContainer, bLengthsOnly); return MoveTemp(OutStringContainer.String); } FString USGBasicHandModel::SGSerialize() const { Pimpl->SyncImplObject(); FSGIC_FSGBasicHandModelImpl InstanceContainer{ToBasicHandModelImpl()}; FSGIC_FString OutStringContainer; SGCoreImpl_FSGBasicHandModelImpl_Serialize(&InstanceContainer, &OutStringContainer); return MoveTemp(OutStringContainer.String); } USGBasicHandModel::FImpl::FImpl(USGBasicHandModel* InOwner) : Owner(InOwner) { } USGBasicHandModel::FImpl::~FImpl() = default; void USGBasicHandModel::FImplDeleter::operator()(const FImpl* P) const { delete P; } void USGBasicHandModel::FImpl::SyncUProperties() { } void USGBasicHandModel::FImpl::SyncImplObject() { }