diff --git a/Source/SenseGlove/Private/SenseGlove/Components/SGVirtualHandComponent.cpp b/Source/SenseGlove/Private/SenseGlove/Components/SGVirtualHandComponent.cpp index 46a8a4cd..87e52d26 100644 --- a/Source/SenseGlove/Private/SenseGlove/Components/SGVirtualHandComponent.cpp +++ b/Source/SenseGlove/Private/SenseGlove/Components/SGVirtualHandComponent.cpp @@ -51,7 +51,6 @@ #include "SGCore/SGHapticGlove.h" #include "SGDebug/SGDebugVirtualHand.h" #include "SGLog/SGLog.h" -#include "SGSettings/SGSettings.h" #include "SGTracking/SGGloveTracker.h" struct USGVirtualHandComponent::FImpl @@ -88,13 +87,6 @@ struct USGVirtualHandComponent::FImpl return Path; } - static const FSGVirtualHandSettings& GetVirtualHandSettings() - { - const USGSettings* Settings{USGSettings::GetInstance()}; - ensureAlwaysMsgf(Settings, TEXT("The settings subsystem has not been initialized!")); - return Settings->GetVirtualHandSettings(); - } - /************************ * Member variables ************************/ @@ -152,12 +144,12 @@ struct USGVirtualHandComponent::FImpl const TArray& USGVirtualHandComponent::GetLeftHandBoneNames() { - return FImpl::GetVirtualHandSettings().LeftHandBoneNames; + return GetVirtualHandSettings().MeshSettings.LeftHandBoneNames; } const TArray& USGVirtualHandComponent::GetRightHandBoneNames() { - return FImpl::GetVirtualHandSettings().RightHandBoneNames; + return GetVirtualHandSettings().MeshSettings.RightHandBoneNames; } const FName& USGVirtualHandComponent::GetLeftHandBoneName(const int32 Joint) @@ -214,29 +206,6 @@ USGVirtualHandComponent::USGVirtualHandComponent(const FObjectInitializer& Objec bRight = true; bVisibleWhenHandDataUnavailable = false; - AnimationBoneRotationCorrectionOffset = FRotator{0.0f, 90.0f, 90.0f}; - bShouldAnimationApplyBoneLocation = true; - - bAutoStopAllHapticsOnEndPlay = true; - - GrabSocketName = FName{TEXT("GenericGrabPoint")}; - - DefaultFingertipsGrabColliderSize = FVector{0.08f, 0.08f, 0.08f}; - - ThumbFingertipGrabSocketName = FName{TEXT("GrabThumbFingertip")}; - IndexFingertipGrabSocketName = FName{TEXT("GrabIndexFingertip")}; - MiddleFingertipGrabSocketName = FName{TEXT("GrabMiddleFingertip")}; - - DefaultFingertipsTouchColliderSize = FVector{0.08f, 0.08f, 0.08f}; - - ThumbFingertipTouchSocketName = FName{TEXT("TouchThumbFingertip")}; - IndexFingertipTouchSocketName = FName{TEXT("TouchIndexFingertip")}; - MiddleFingertipTouchSocketName = FName{TEXT("TouchMiddleFingertip")}; - RingFingertipTouchSocketName = FName{TEXT("TouchRingFingertip")}; - PinkyFingertipTouchSocketName = FName{TEXT("TouchPinkyFingertip")}; - - DebugVirtualHandSettings = FSGDebugVirtualHandSettings{}; - Super::SetSkeletalMesh(nullptr, true); WristTracker = nullptr; @@ -352,7 +321,7 @@ void USGVirtualHandComponent::TickComponent( Pimpl->UpdateVisibility(); - if (DebugVirtualHandSettings.DrawingMode != ESGDebugVirtualHandDrawingMode::None) + if (GetVirtualHandDebuggingSettings().DrawingMode != ESGDebugVirtualHandDrawingMode::None) { Pimpl->DrawDebugVirtualHand(); } @@ -375,7 +344,7 @@ void USGVirtualHandComponent::EditorTick( { Pimpl->UpdateVisibility(); - if (DebugVirtualHandSettings.DrawingMode != ESGDebugVirtualHandDrawingMode::None) + if (GetVirtualHandDebuggingSettings().DrawingMode != ESGDebugVirtualHandDrawingMode::None) { Pimpl->DrawDebugVirtualHand(); } @@ -677,7 +646,7 @@ void USGVirtualHandComponent::FImpl::DrawDebugVirtualHand() const return; } - FSGDebugVirtualHand::Draw(World, MotionControllerData, Owner->DebugVirtualHandSettings); + FSGDebugVirtualHand::Draw(World, MotionControllerData, Owner->GetVirtualHandDebuggingSettings()); } void USGVirtualHandComponent::FImpl::TriggerHandVisibilityChangedEvent(const bool bNewVisibility) const diff --git a/Source/SenseGlove/Private/SenseGlove/GameFramework/SGPawn.cpp b/Source/SenseGlove/Private/SenseGlove/GameFramework/SGPawn.cpp index 74e72545..4e4ccc8f 100644 --- a/Source/SenseGlove/Private/SenseGlove/GameFramework/SGPawn.cpp +++ b/Source/SenseGlove/Private/SenseGlove/GameFramework/SGPawn.cpp @@ -189,7 +189,8 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer) ControllerVisualizerLeft->SetupAttachment(WristTrackerLeft); ControllerVisualizerLeft->SetDisplayModelSource(FName("OpenXR")); - HandLeft = ObjectInitializer.CreateDefaultSubobject(this, TEXT("HandLeft")); + HandLeft = ObjectInitializer.CreateDefaultSubobject( + this, TEXT("HandLeft")); HandLeft->SetupAttachment(GetRootComponent()); HandLeft->SetCanEverAffectNavigation(false); HandLeft->SetGenerateOverlapEvents(true); @@ -206,13 +207,14 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer) HandLeft->SetCollisionResponseToChannel(ECC_Destructible, ECR_Block); HandLeft->SetRight(false); HandLeft->SetVisibleWhenHandDataUnavailable(false); - HandLeft->SetRelativeRotation(FImpl::GetVirtualHandSettings().RootBoneRotationCorrection, + HandLeft->SetRelativeRotation(FImpl::GetVirtualHandSettings().MeshSettings.RootBoneRotationCorrection, false, nullptr, ETeleportType::None); HandLeft->SetRelativeLocation(FVector{30.0f, -20.0f, -10.0f}, false, nullptr, ETeleportType::None); HandLeft->SetWristTracker(WristTrackerLeft); - RealHandLeft = ObjectInitializer.CreateDefaultSubobject(this, TEXT("RealHandLeft")); + RealHandLeft = ObjectInitializer.CreateDefaultSubobject( + this, TEXT("RealHandLeft")); RealHandLeft->SetupAttachment(GetRootComponent()); RealHandLeft->SetCanEverAffectNavigation(false); RealHandLeft->SetGenerateOverlapEvents(true); @@ -230,16 +232,17 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer) RealHandLeft->SetRight(false); Pimpl->SetVisibility(RealHandLeft, false); RealHandLeft->SetVisibleWhenHandDataUnavailable(false); - RealHandLeft->SetRelativeRotation(FImpl::GetVirtualHandSettings().RootBoneRotationCorrection, + RealHandLeft->SetRelativeRotation(FImpl::GetVirtualHandSettings().MeshSettings.RootBoneRotationCorrection, false, nullptr, ETeleportType::None); RealHandLeft->SetRelativeLocation(FVector{30.0f, -20.0f, -10.0f}, false, nullptr, ETeleportType::None); RealHandLeft->SetWristTracker(WristTrackerLeft); - FSGDebugVirtualHandSettings RealHandLeftDebugSettings; - RealHandLeftDebugSettings.bDrawDebugVirtualHand = true; - RealHandLeftDebugSettings.DrawingMode = ESGDebugVirtualHandDrawingMode::GizmoJoints; - RealHandLeft->SetDebugVirtualHandSettings(MoveTemp(RealHandLeftDebugSettings)); + /// FIXME - REFACTOR + // FSGVirtualHandDebuggingSettings RealHandLeftDebugSettings; + // RealHandLeftDebugSettings.bDrawDebugVirtualHand = true; + // RealHandLeftDebugSettings.DrawingMode = ESGDebugVirtualHandDrawingMode::GizmoJoints; + // RealHandLeft->SetVirtualHandDebuggingSettings(MoveTemp(RealHandLeftDebugSettings)); LeftThumbFingertipGrabCollider = ObjectInitializer.CreateDefaultSubobject( this, TEXT("LeftThumbFingertipGrabCollider")); @@ -348,7 +351,8 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer) ControllerVisualizerRight->SetupAttachment(WristTrackerRight); ControllerVisualizerRight->SetDisplayModelSource(FName("OpenXR")); - HandRight = ObjectInitializer.CreateDefaultSubobject(this, TEXT("HandRight")); + HandRight = ObjectInitializer.CreateDefaultSubobject( + this, TEXT("HandRight")); HandRight->SetupAttachment(GetRootComponent()); HandRight->SetCanEverAffectNavigation(false); HandRight->SetGenerateOverlapEvents(true); @@ -365,13 +369,14 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer) HandRight->SetCollisionResponseToChannel(ECC_Destructible, ECR_Block); HandRight->SetRight(true); HandRight->SetVisibleWhenHandDataUnavailable(false); - HandRight->SetRelativeRotation(FImpl::GetVirtualHandSettings().RootBoneRotationCorrection, + HandRight->SetRelativeRotation(FImpl::GetVirtualHandSettings().MeshSettings.RootBoneRotationCorrection, false, nullptr, ETeleportType::None); HandRight->SetRelativeLocation(FVector{30.0f, 20.0f, -10.0f}, false, nullptr, ETeleportType::None); HandRight->SetWristTracker(WristTrackerRight); - RealHandRight = ObjectInitializer.CreateDefaultSubobject(this, TEXT("RealHandRight")); + RealHandRight = ObjectInitializer.CreateDefaultSubobject( + this, TEXT("RealHandRight")); RealHandRight->SetupAttachment(GetRootComponent()); RealHandRight->SetCanEverAffectNavigation(false); RealHandRight->SetGenerateOverlapEvents(true); @@ -389,16 +394,17 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer) RealHandRight->SetRight(true); Pimpl->SetVisibility(RealHandRight, false); RealHandRight->SetVisibleWhenHandDataUnavailable(false); - RealHandRight->SetRelativeRotation(FImpl::GetVirtualHandSettings().RootBoneRotationCorrection, + RealHandRight->SetRelativeRotation(FImpl::GetVirtualHandSettings().MeshSettings.RootBoneRotationCorrection, false, nullptr, ETeleportType::None); RealHandRight->SetRelativeLocation(FVector{30.0f, 20.0f, -10.0f}, false, nullptr, ETeleportType::None); RealHandRight->SetWristTracker(WristTrackerRight); - FSGDebugVirtualHandSettings RealHandRightDebugSettings; - RealHandRightDebugSettings.bDrawDebugVirtualHand = true; - RealHandRightDebugSettings.DrawingMode = ESGDebugVirtualHandDrawingMode::GizmoJoints; - RealHandRight->SetDebugVirtualHandSettings(MoveTemp(RealHandRightDebugSettings)); + /// FIXME - REFACTOR + // FSGVirtualHandDebuggingSettings RealHandRightDebugSettings; + // RealHandRightDebugSettings.bDrawDebugVirtualHand = true; + // RealHandRightDebugSettings.DrawingMode = ESGDebugVirtualHandDrawingMode::GizmoJoints; + // RealHandRight->SetVirtualHandDebuggingSettings(MoveTemp(RealHandRightDebugSettings)); RightThumbFingertipGrabCollider = ObjectInitializer.CreateDefaultSubobject( this, TEXT("RightThumbFingertipGrabCollider")); @@ -498,11 +504,19 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer) MaxNumberOfHandVelocitySamples = 10; - LeftHandGrabState = FSGGrabState(HandLeft, FVector::Zero(), {}, nullptr, nullptr, nullptr, nullptr); - LeftHandTouchState = FSGTouchState(HandLeft, nullptr, nullptr, nullptr, nullptr, nullptr); + LeftHandGrabState = FSGGrabState{ + HandLeft, FVector::Zero(), {}, nullptr, nullptr, nullptr, nullptr + }; + LeftHandTouchState = FSGTouchState{ + HandLeft, nullptr, nullptr, nullptr, nullptr, nullptr + }; - RightHandGrabState = FSGGrabState(HandRight, FVector::Zero(), {}, nullptr, nullptr, nullptr, nullptr); - RightHandTouchState = FSGTouchState(HandRight, nullptr, nullptr, nullptr, nullptr, nullptr); + RightHandGrabState = FSGGrabState{ + HandRight, FVector::Zero(), {}, nullptr, nullptr, nullptr, nullptr + }; + RightHandTouchState = FSGTouchState{ + HandRight, nullptr, nullptr, nullptr, nullptr, nullptr + }; } void ASGPawn::OnGrabStateUpdated_Implementation(const FSGGrabState& GrabState) @@ -1702,7 +1716,7 @@ void ASGPawn::FImpl::UpdateHandRotation(const bool bRight, const FRotator& Rotat void ASGPawn::FImpl::UpdateLeftHandRotation(const FRotator& Rotation, const bool bUpdateVirtualHand) { const FQuat NewRotation{ - Rotation.Quaternion() * GetVirtualHandSettings().RootBoneRotationCorrection.Quaternion() + Rotation.Quaternion() * GetVirtualHandSettings().MeshSettings.RootBoneRotationCorrection.Quaternion() }; if (bUpdateVirtualHand) { @@ -1714,7 +1728,7 @@ void ASGPawn::FImpl::UpdateLeftHandRotation(const FRotator& Rotation, const bool void ASGPawn::FImpl::UpdateRightHandRotation(const FRotator& Rotation, const bool bUpdateVirtualHand) { const FQuat NewRotation{ - Rotation.Quaternion() * GetVirtualHandSettings().RootBoneRotationCorrection.Quaternion() + Rotation.Quaternion() * GetVirtualHandSettings().MeshSettings.RootBoneRotationCorrection.Quaternion() }; if (bUpdateVirtualHand) { diff --git a/Source/SenseGlove/Public/SenseGlove/Components/SGVirtualHandComponent.h b/Source/SenseGlove/Public/SenseGlove/Components/SGVirtualHandComponent.h index 8451c36c..9e0c96c4 100644 --- a/Source/SenseGlove/Public/SenseGlove/Components/SGVirtualHandComponent.h +++ b/Source/SenseGlove/Public/SenseGlove/Components/SGVirtualHandComponent.h @@ -42,11 +42,12 @@ #include "HeadMountedDisplayTypes.h" #include "Math/Rotator.h" #include "Math/Transform.h" +#include "Misc/AssertionMacros.h" #include "ReferenceSkeleton.h" #include "Templates/UniquePtr.h" #include "UObject/NameTypes.h" -#include "SGSettings/SGDebugVirtualHandSettings.h" +#include "SGSettings/SGSettings.h" #include "SGVirtualHandComponent.generated.h" @@ -62,6 +63,14 @@ class SENSEGLOVE_API USGVirtualHandComponent : public USkeletalMeshComponent { GENERATED_UCLASS_BODY() +public: + static const FSGVirtualHandSettings& GetVirtualHandSettings() + { + const USGSettings* Settings{USGSettings::GetInstance()}; + ensureAlwaysMsgf(Settings, TEXT("The settings subsystem has not been initialized!")); + return Settings->GetVirtualHandSettings(); + } + public: DECLARE_EVENT_OneParam(USGVirtualHandComponent, FHandVisibilityChangedEvent, bool bNewVisibiliy); @@ -98,51 +107,6 @@ private: UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false")) uint8 bVisibleWhenHandDataUnavailable : 1; - UPROPERTY(EditAnywhere, Category="SenseGlove | Animation", meta=(AllowPrivateAccess="false")) - FRotator AnimationBoneRotationCorrectionOffset; - - UPROPERTY(EditAnywhere, Category="SenseGlove | Animation", meta=(AllowPrivateAccess="false")) - uint8 bShouldAnimationApplyBoneLocation : 1; - - UPROPERTY(EditAnywhere, Category="SenseGlove | Haptics", meta=(AllowPrivateAccess="false")) - uint8 bAutoStopAllHapticsOnEndPlay : 1; - - UPROPERTY(EditAnywhere, Category="SenseGlove | Grab", meta=(AllowPrivateAccess="false")) - FName GrabSocketName; - - UPROPERTY(EditAnywhere, Category="SenseGlove | Grab", meta=(AllowPrivateAccess="false")) - FVector DefaultFingertipsGrabColliderSize; - - UPROPERTY(EditAnywhere, Category="SenseGlove | Grab", meta=(AllowPrivateAccess="false")) - FName ThumbFingertipGrabSocketName; - - UPROPERTY(EditAnywhere, Category="SenseGlove | Grab", meta=(AllowPrivateAccess="false")) - FName IndexFingertipGrabSocketName; - - UPROPERTY(EditAnywhere, Category="SenseGlove | Grab", meta=(AllowPrivateAccess="false")) - FName MiddleFingertipGrabSocketName; - - UPROPERTY(EditAnywhere, Category="SenseGlove | Touch", meta=(AllowPrivateAccess="false")) - FVector DefaultFingertipsTouchColliderSize; - - UPROPERTY(EditAnywhere, Category="SenseGlove | Touch", meta=(AllowPrivateAccess="false")) - FName ThumbFingertipTouchSocketName; - - UPROPERTY(EditAnywhere, Category="SenseGlove | Touch", meta=(AllowPrivateAccess="false")) - FName IndexFingertipTouchSocketName; - - UPROPERTY(EditAnywhere, Category="SenseGlove | Touch", meta=(AllowPrivateAccess="false")) - FName MiddleFingertipTouchSocketName; - - UPROPERTY(EditAnywhere, Category="SenseGlove | Touch", meta=(AllowPrivateAccess="false")) - FName RingFingertipTouchSocketName; - - UPROPERTY(EditAnywhere, Category="SenseGlove | Touch", meta=(AllowPrivateAccess="false")) - FName PinkyFingertipTouchSocketName; - - UPROPERTY(EditAnywhere, Category="SenseGlove | Debugging", meta=(AllowPrivateAccess="false")) - FSGDebugVirtualHandSettings DebugVirtualHandSettings; - private: UPROPERTY(Transient) USGWristTrackerComponent* WristTracker; @@ -164,145 +128,79 @@ public: void SetRight(const bool bInRight); - FORCEINLINE const FName& GetMiddleFingertipTouchSocketName() const - { - return MiddleFingertipTouchSocketName; - } - - FORCEINLINE void SetMiddleFingertipTouchSocketName(const FName& SocketName) - { - MiddleFingertipTouchSocketName = SocketName; - } - FORCEINLINE const FRotator& GetAnimationBoneRotationCorrectionOffset() const { - return AnimationBoneRotationCorrectionOffset; - } - - FORCEINLINE void SetAnimationBoneRotationCorrectionOffset( - const FRotator& InAnimationBoneRotationCorrectionOffset) - { - AnimationBoneRotationCorrectionOffset = InAnimationBoneRotationCorrectionOffset; + return GetVirtualHandSettings().AnimationSettings.AnimationBoneRotationCorrectionOffset; } FORCEINLINE bool ShouldAnimationApplyBoneLocation() const { - return !!bShouldAnimationApplyBoneLocation; - } - - FORCEINLINE void SetShouldAnimationApplyBoneLocation(const bool bInShouldAnimationApplyBoneLocation) - { - bShouldAnimationApplyBoneLocation = bInShouldAnimationApplyBoneLocation; + return !!GetVirtualHandSettings().AnimationSettings.bShouldAnimationApplyBoneLocation; } FORCEINLINE bool AutoStopsAllHapticsOnEndPlay() const { - return !!bAutoStopAllHapticsOnEndPlay; - } - - FORCEINLINE void SetAutoStopAllHapticsOnEndPlay(const bool bInAutoStopAllHapticsOnEndPlay) - { - bAutoStopAllHapticsOnEndPlay = bInAutoStopAllHapticsOnEndPlay; + return !!GetVirtualHandSettings().HapticsSettings.bAutoStopAllHapticsOnEndPlay; } FORCEINLINE const FName& GetGrabSocketName() const { - return GrabSocketName; + return GetVirtualHandSettings().GrabSettings.PalmAttachPointSocketName; } FORCEINLINE const FVector& GetDefaultFingertipsGrabColliderSize() const { - return DefaultFingertipsGrabColliderSize; + return GetVirtualHandSettings().GrabSettings.DefaultColliderSize; } FORCEINLINE const FName& GetThumbFingertipGrabSocketName() const { - return ThumbFingertipGrabSocketName; - } - - FORCEINLINE void SetThumbFingertipGrabSocketName(const FName& SocketName) - { - ThumbFingertipGrabSocketName = SocketName; + return GetVirtualHandSettings().GrabSettings.ThumbColliderSocketName; } FORCEINLINE const FName& GetIndexFingertipGrabSocketName() const { - return IndexFingertipGrabSocketName; - } - - FORCEINLINE void SetIndexFingertipGrabSocketName(const FName& SocketName) - { - IndexFingertipGrabSocketName = SocketName; + return GetVirtualHandSettings().GrabSettings.IndexColliderSocketName; } FORCEINLINE const FName& GetMiddleFingertipGrabSocketName() const { - return MiddleFingertipGrabSocketName; - } - - FORCEINLINE void SetMiddleFingertipGrabSocketName(const FName& SocketName) - { - MiddleFingertipGrabSocketName = SocketName; + return GetVirtualHandSettings().GrabSettings.MiddleColliderSocketName; } FORCEINLINE const FVector& GetDefaultFingertipsTouchColliderSize() const { - return DefaultFingertipsTouchColliderSize; + return GetVirtualHandSettings().TouchSettings.DefaultColliderSize; } FORCEINLINE const FName& GetThumbFingertipTouchSocketName() const { - return ThumbFingertipTouchSocketName; - } - - FORCEINLINE void SetThumbFingertipTouchSocketName(const FName& SocketName) - { - ThumbFingertipTouchSocketName = SocketName; + return GetVirtualHandSettings().TouchSettings.ThumbColliderSocketName; } FORCEINLINE const FName& GetIndexFingertipTouchSocketName() const { - return IndexFingertipTouchSocketName; + return GetVirtualHandSettings().TouchSettings.IndexColliderSocketName; } - FORCEINLINE void SetIndexFingertipTouchSocketName(const FName& SocketName) + FORCEINLINE const FName& GetMiddleFingertipTouchSocketName() const { - IndexFingertipTouchSocketName = SocketName; + return GetVirtualHandSettings().TouchSettings.MiddleColliderSocketName; } FORCEINLINE const FName& GetRingFingertipTouchSocketName() const { - return RingFingertipTouchSocketName; - } - - FORCEINLINE void SetRingFingertipTouchSocketName(const FName& SocketName) - { - RingFingertipTouchSocketName = SocketName; + return GetVirtualHandSettings().TouchSettings.RingColliderSocketName; } FORCEINLINE const FName& GetPinkyFingertipTouchSocketName() const { - return PinkyFingertipTouchSocketName; + return GetVirtualHandSettings().TouchSettings.PinkyColliderSocketName; } - FORCEINLINE void SetPinkyFingertipTouchSocketName(const FName& SocketName) + FORCEINLINE const FSGVirtualHandDebuggingSettings& GetVirtualHandDebuggingSettings() const { - PinkyFingertipTouchSocketName = SocketName; - } - - FORCEINLINE const FSGDebugVirtualHandSettings& GetDebugVirtualHandSettings() const - { - return DebugVirtualHandSettings; - } - - FORCEINLINE FSGDebugVirtualHandSettings& GetDebugVirtualHandSettings() - { - return DebugVirtualHandSettings; - } - - FORCEINLINE void SetDebugVirtualHandSettings(const FSGDebugVirtualHandSettings& InDebugVirtualHandSettings) - { - DebugVirtualHandSettings = InDebugVirtualHandSettings; + return GetVirtualHandSettings().DebuggingSettings; } FORCEINLINE bool IsVisibleWhenHandDataUnavailable() const diff --git a/Source/SenseGloveDebug/Private/SGDebug/SGDebugVirtualHand.cpp b/Source/SenseGloveDebug/Private/SGDebug/SGDebugVirtualHand.cpp index ab29776e..d0cfe21b 100644 --- a/Source/SenseGloveDebug/Private/SGDebug/SGDebugVirtualHand.cpp +++ b/Source/SenseGloveDebug/Private/SGDebug/SGDebugVirtualHand.cpp @@ -45,7 +45,7 @@ void FSGDebugVirtualHand::Draw(const UWorld* World, const FXRMotionControllerData& MotionControllerData, - const FSGDebugVirtualHandSettings& Settings) + const FSGVirtualHandDebuggingSettings& Settings) { ensureAlwaysMsgf(Settings.DrawingMode != ESGDebugVirtualHandDrawingMode::None, TEXT("Invalid virtual hand drawing mode!")); diff --git a/Source/SenseGloveDebug/Public/SGDebug/SGDebugVirtualHand.h b/Source/SenseGloveDebug/Public/SGDebug/SGDebugVirtualHand.h index 5dc13af5..56abdfad 100644 --- a/Source/SenseGloveDebug/Public/SGDebug/SGDebugVirtualHand.h +++ b/Source/SenseGloveDebug/Public/SGDebug/SGDebugVirtualHand.h @@ -40,7 +40,7 @@ #include "Math/Rotator.h" #include "Math/Vector.h" -#include "SGSettings/SGDebugVirtualHandSettings.h" +#include "SGSettings/SGVirtualHandDebuggingSettings.h" class UWorld; @@ -50,7 +50,7 @@ public: static void Draw( const UWorld* World, const FXRMotionControllerData& MotionControllerData, - const FSGDebugVirtualHandSettings& Settings); + const FSGVirtualHandDebuggingSettings& Settings); public: FSGDebugVirtualHand() = delete; diff --git a/Source/SenseGloveDebugKismet/Private/SGDebugKismet/SGDebugVirtualHandKismetLibrary.cpp b/Source/SenseGloveDebugKismet/Private/SGDebugKismet/SGDebugVirtualHandKismetLibrary.cpp index a8dc180b..2f2cb344 100644 --- a/Source/SenseGloveDebugKismet/Private/SGDebugKismet/SGDebugVirtualHandKismetLibrary.cpp +++ b/Source/SenseGloveDebugKismet/Private/SGDebugKismet/SGDebugVirtualHandKismetLibrary.cpp @@ -39,7 +39,7 @@ void USGDebugVirtualHandKismetLibrary::Draw( UObject* WorldContextObject, - const FXRMotionControllerData& MotionControllerData, const FSGDebugVirtualHandSettings& Settings) + const FXRMotionControllerData& MotionControllerData, const FSGVirtualHandDebuggingSettings& Settings) { ensureAlwaysMsgf(WorldContextObject, TEXT("Invalid world context object!")); diff --git a/Source/SenseGloveDebugKismet/Public/SGDebugKismet/SGDebugVirtualHandKismetLibrary.h b/Source/SenseGloveDebugKismet/Public/SGDebugKismet/SGDebugVirtualHandKismetLibrary.h index c2b485e6..03da3f45 100644 --- a/Source/SenseGloveDebugKismet/Public/SGDebugKismet/SGDebugVirtualHandKismetLibrary.h +++ b/Source/SenseGloveDebugKismet/Public/SGDebugKismet/SGDebugVirtualHandKismetLibrary.h @@ -53,5 +53,5 @@ public: static void Draw( UObject* WorldContextObject, const FXRMotionControllerData& MotionControllerData, - const FSGDebugVirtualHandSettings& Settings); + const FSGVirtualHandDebuggingSettings& Settings); }; \ No newline at end of file diff --git a/Source/SenseGloveKismet/Private/SGKismet/SGVirtualHandComponentKismetLibrary.cpp b/Source/SenseGloveKismet/Private/SGKismet/SGVirtualHandComponentKismetLibrary.cpp index adfd24ed..ddf86e5f 100644 --- a/Source/SenseGloveKismet/Private/SGKismet/SGVirtualHandComponentKismetLibrary.cpp +++ b/Source/SenseGloveKismet/Private/SGKismet/SGVirtualHandComponentKismetLibrary.cpp @@ -92,36 +92,18 @@ const FRotator& UVirtualHandComponentKismetLibrary::GetAnimationBoneRotationCorr return VirtualHandComponent->GetAnimationBoneRotationCorrectionOffset(); } -void UVirtualHandComponentKismetLibrary::SetAnimationBoneRotationCorrectionOffset( - USGVirtualHandComponent* VirtualHandComponent, const FRotator& InAnimationBoneRotationCorrectionOffset) -{ - VirtualHandComponent->SetAnimationBoneRotationCorrectionOffset(InAnimationBoneRotationCorrectionOffset); -} - bool UVirtualHandComponentKismetLibrary::ShouldAnimationApplyBoneLocation( const USGVirtualHandComponent* VirtualHandComponent) { return VirtualHandComponent->ShouldAnimationApplyBoneLocation(); } -void UVirtualHandComponentKismetLibrary::SetShouldAnimationApplyBoneLocation( - USGVirtualHandComponent* VirtualHandComponent, const bool bInShouldAnimationApplyBoneLocation) -{ - VirtualHandComponent->SetShouldAnimationApplyBoneLocation(bInShouldAnimationApplyBoneLocation); -} - bool UVirtualHandComponentKismetLibrary::AutoStopsAllHapticsOnEndPlay( const USGVirtualHandComponent* VirtualHandComponent) { return VirtualHandComponent->AutoStopsAllHapticsOnEndPlay(); } -void UVirtualHandComponentKismetLibrary::SetAutoStopAllHapticsOnEndPlay( - USGVirtualHandComponent* VirtualHandComponent, const bool bInAutoStopAllHapticsOnEndPlay) -{ - VirtualHandComponent->SetAutoStopAllHapticsOnEndPlay(bInAutoStopAllHapticsOnEndPlay); -} - const FName& UVirtualHandComponentKismetLibrary::GetGrabSocketName(const USGVirtualHandComponent* VirtualHandComponent) { return VirtualHandComponent->GetGrabSocketName(); @@ -139,36 +121,18 @@ const FName& UVirtualHandComponentKismetLibrary::GetThumbFingertipGrabSocketName return VirtualHandComponent->GetThumbFingertipGrabSocketName(); } -void UVirtualHandComponentKismetLibrary::SetThumbFingertipGrabSocketName( - USGVirtualHandComponent* VirtualHandComponent, const FName& SocketName) -{ - VirtualHandComponent->SetThumbFingertipGrabSocketName(SocketName); -} - const FName& UVirtualHandComponentKismetLibrary::GetIndexFingertipGrabSocketName( const USGVirtualHandComponent* VirtualHandComponent) { return VirtualHandComponent->GetIndexFingertipGrabSocketName(); } -void UVirtualHandComponentKismetLibrary::SetIndexFingertipGrabSocketName( - USGVirtualHandComponent* VirtualHandComponent, const FName& SocketName) -{ - VirtualHandComponent->SetIndexFingertipGrabSocketName(SocketName); -} - const FName& UVirtualHandComponentKismetLibrary::GetMiddleFingertipGrabSocketName( const USGVirtualHandComponent* VirtualHandComponent) { return VirtualHandComponent->GetMiddleFingertipGrabSocketName(); } -void UVirtualHandComponentKismetLibrary::SetMiddleFingertipGrabSocketName( - USGVirtualHandComponent* VirtualHandComponent, const FName& SocketName) -{ - VirtualHandComponent->SetMiddleFingertipGrabSocketName(SocketName); -} - const FVector& UVirtualHandComponentKismetLibrary::GetDefaultFingertipsTouchColliderSize( const USGVirtualHandComponent* VirtualHandComponent) { @@ -181,77 +145,34 @@ const FName& UVirtualHandComponentKismetLibrary::GetThumbFingertipTouchSocketNam return VirtualHandComponent->GetThumbFingertipTouchSocketName(); } -void UVirtualHandComponentKismetLibrary::SetThumbFingertipTouchSocketName( - USGVirtualHandComponent* VirtualHandComponent, const FName& SocketName) -{ - VirtualHandComponent->SetThumbFingertipTouchSocketName(SocketName); -} - const FName& UVirtualHandComponentKismetLibrary::GetIndexFingertipTouchSocketName( const USGVirtualHandComponent* VirtualHandComponent) { return VirtualHandComponent->GetIndexFingertipTouchSocketName(); } -void UVirtualHandComponentKismetLibrary::SetIndexFingertipTouchSocketName( - USGVirtualHandComponent* VirtualHandComponent, const FName& SocketName) -{ - VirtualHandComponent->SetIndexFingertipTouchSocketName(SocketName); -} - const FName& UVirtualHandComponentKismetLibrary::GetMiddleFingertipTouchSocketName( const USGVirtualHandComponent* VirtualHandComponent) { return VirtualHandComponent->GetMiddleFingertipTouchSocketName(); } -void UVirtualHandComponentKismetLibrary::SetMiddleFingertipTouchSocketName( - USGVirtualHandComponent* VirtualHandComponent, - const FName& SocketName) -{ - VirtualHandComponent->SetMiddleFingertipTouchSocketName(SocketName); -} - const FName& UVirtualHandComponentKismetLibrary::GetRingFingertipTouchSocketName( const USGVirtualHandComponent* VirtualHandComponent) { return VirtualHandComponent->GetRingFingertipTouchSocketName(); } -void UVirtualHandComponentKismetLibrary::SetRingFingertipTouchSocketName( - USGVirtualHandComponent* VirtualHandComponent, const FName& SocketName) -{ - VirtualHandComponent->SetRingFingertipTouchSocketName(SocketName); -} - const FName& UVirtualHandComponentKismetLibrary::GetPinkyFingertipTouchSocketName( const USGVirtualHandComponent* VirtualHandComponent) { return VirtualHandComponent->GetPinkyFingertipTouchSocketName(); } -void UVirtualHandComponentKismetLibrary::SetPinkyFingertipTouchSocketName( - USGVirtualHandComponent* VirtualHandComponent, const FName& SocketName) -{ - VirtualHandComponent->SetPinkyFingertipTouchSocketName(SocketName); -} - -const FSGDebugVirtualHandSettings& UVirtualHandComponentKismetLibrary::GetDebugVirtualHandSettings( +const FSGVirtualHandDebuggingSettings& UVirtualHandComponentKismetLibrary::GetVirtualHandDebuggingSettings( const USGVirtualHandComponent* VirtualHandComponent) { - return VirtualHandComponent->GetDebugVirtualHandSettings(); -} - -void UVirtualHandComponentKismetLibrary::SetDebugVirtualHandSettings( - USGVirtualHandComponent* VirtualHandComponent, - const FSGDebugVirtualHandSettings& InDebugVirtualHandSettings) -{ - VirtualHandComponent->SetDebugVirtualHandSettings(InDebugVirtualHandSettings); -} - -bool UVirtualHandComponentKismetLibrary::IsGloveConnected(const USGVirtualHandComponent* VirtualHandComponent) -{ - return VirtualHandComponent->IsGloveConnected(); + return VirtualHandComponent->GetVirtualHandDebuggingSettings(); } USGHapticGlove* UVirtualHandComponentKismetLibrary::GetConnectedGlove( diff --git a/Source/SenseGloveKismet/Public/SGKismet/SGVirtualHandComponentKismetLibrary.h b/Source/SenseGloveKismet/Public/SGKismet/SGVirtualHandComponentKismetLibrary.h index 5fcd7718..7e5c4a20 100644 --- a/Source/SenseGloveKismet/Public/SGKismet/SGVirtualHandComponentKismetLibrary.h +++ b/Source/SenseGloveKismet/Public/SGKismet/SGVirtualHandComponentKismetLibrary.h @@ -43,7 +43,7 @@ #include "UObject/NameTypes.h" #include "SGKismet/SGBlueprintFunctionLibrary.h" -#include "SGSettings/SGDebugVirtualHandSettings.h" +#include "SGSettings/SGVirtualHandDebuggingSettings.h" #include "SGVirtualHandComponentKismetLibrary.generated.h" @@ -91,27 +91,13 @@ public: static const FRotator& GetAnimationBoneRotationCorrectionOffset( const USGVirtualHandComponent* VirtualHandComponent); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Virtual Hand Component") - static void SetAnimationBoneRotationCorrectionOffset( - UPARAM(ref) USGVirtualHandComponent* VirtualHandComponent, - const FRotator& InAnimationBoneRotationCorrectionOffset); - UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Virtual Hand Component") static bool ShouldAnimationApplyBoneLocation( const USGVirtualHandComponent* VirtualHandComponent); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Virtual Hand Component") - static void SetShouldAnimationApplyBoneLocation( - UPARAM(ref) USGVirtualHandComponent* VirtualHandComponent, - bool bInShouldAnimationApplyBoneLocation); - UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Virtual Hand Component") static bool AutoStopsAllHapticsOnEndPlay(const USGVirtualHandComponent* VirtualHandComponent); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Virtual Hand Component") - static void SetAutoStopAllHapticsOnEndPlay(UPARAM(ref) USGVirtualHandComponent* VirtualHandComponent, - const bool bInAutoStopAllHapticsOnEndPlay); - UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Virtual Hand Component") static const FName& GetGrabSocketName(const USGVirtualHandComponent* VirtualHandComponent); @@ -121,73 +107,34 @@ public: UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Virtual Hand Component") static const FName& GetThumbFingertipGrabSocketName(const USGVirtualHandComponent* VirtualHandComponent); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Virtual Hand Component") - static void SetThumbFingertipGrabSocketName(UPARAM(ref) USGVirtualHandComponent* VirtualHandComponent, - const FName& SocketName); - UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Virtual Hand Component") static const FName& GetIndexFingertipGrabSocketName(const USGVirtualHandComponent* VirtualHandComponent); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Virtual Hand Component") - static void SetIndexFingertipGrabSocketName(UPARAM(ref) USGVirtualHandComponent* VirtualHandComponent, - const FName& SocketName); - UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Virtual Hand Component") static const FName& GetMiddleFingertipGrabSocketName(const USGVirtualHandComponent* VirtualHandComponent); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Virtual Hand Component") - static void SetMiddleFingertipGrabSocketName(UPARAM(ref) USGVirtualHandComponent* VirtualHandComponent, - const FName& SocketName); - UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Virtual Hand Component") static const FVector& GetDefaultFingertipsTouchColliderSize(const USGVirtualHandComponent* VirtualHandComponent); UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Virtual Hand Component") static const FName& GetThumbFingertipTouchSocketName(const USGVirtualHandComponent* VirtualHandComponent); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Virtual Hand Component") - static void SetThumbFingertipTouchSocketName(UPARAM(ref) USGVirtualHandComponent* VirtualHandComponent, - const FName& SocketName); - UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Virtual Hand Component") static const FName& GetIndexFingertipTouchSocketName(const USGVirtualHandComponent* VirtualHandComponent); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Virtual Hand Component") - static void SetIndexFingertipTouchSocketName(UPARAM(ref) USGVirtualHandComponent* VirtualHandComponent, - const FName& SocketName); - UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Virtual Hand Component") static const FName& GetMiddleFingertipTouchSocketName(const USGVirtualHandComponent* VirtualHandComponent); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Virtual Hand Component") - static void SetMiddleFingertipTouchSocketName(UPARAM(ref) USGVirtualHandComponent* VirtualHandComponent, - const FName& SocketName); - UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Virtual Hand Component") static const FName& GetRingFingertipTouchSocketName(const USGVirtualHandComponent* VirtualHandComponent); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Virtual Hand Component") - static void SetRingFingertipTouchSocketName(UPARAM(ref) USGVirtualHandComponent* VirtualHandComponent, - const FName& SocketName); - UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Virtual Hand Component") static const FName& GetPinkyFingertipTouchSocketName(const USGVirtualHandComponent* VirtualHandComponent); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Virtual Hand Component") - static void SetPinkyFingertipTouchSocketName(UPARAM(ref) USGVirtualHandComponent* VirtualHandComponent, - const FName& SocketName); - UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Virtual Hand Component") - static const FSGDebugVirtualHandSettings& GetDebugVirtualHandSettings( + static const FSGVirtualHandDebuggingSettings& GetVirtualHandDebuggingSettings( const USGVirtualHandComponent* VirtualHandComponent); - UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Virtual Hand Component") - static void SetDebugVirtualHandSettings(UPARAM(ref) USGVirtualHandComponent* VirtualHandComponent, - const FSGDebugVirtualHandSettings& InDebugVirtualHandSettings); - - UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Virtual Hand Component") - static bool IsGloveConnected(const USGVirtualHandComponent* VirtualHandComponent); - UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Virtual Hand Component") static USGHapticGlove* GetConnectedGlove(const USGVirtualHandComponent* VirtualHandComponent); diff --git a/Source/SenseGloveSettings/Private/SGSettings/SGDebugGizmoSettings.cpp b/Source/SenseGloveSettings/Private/SGSettings/SGDebugGizmoSettings.cpp index 662ac61a..e34e6992 100644 --- a/Source/SenseGloveSettings/Private/SGSettings/SGDebugGizmoSettings.cpp +++ b/Source/SenseGloveSettings/Private/SGSettings/SGDebugGizmoSettings.cpp @@ -36,7 +36,7 @@ #include "SGSettings/SGDebugGizmoSettings.h" FSGDebugGizmoSettings::FSGDebugGizmoSettings() - : FSGDebugGizmoSettings( + : FSGDebugGizmoSettings{ 4.0f, 0.4f, FColor(255, 0, 0, 255), @@ -44,7 +44,8 @@ FSGDebugGizmoSettings::FSGDebugGizmoSettings() FColor(0, 0, 255, 255), false, 1.1f, - 0) + 0 + } { } @@ -59,9 +60,9 @@ FSGDebugGizmoSettings::FSGDebugGizmoSettings( const uint8 InDepthPriority) : Length(InLength), Thickness(InThickness), - XAxisColor(InXAxisColor), - YAxisColor(InYAxisColor), - ZAxisColor(InZAxisColor), + XAxisColor{InXAxisColor}, + YAxisColor{InYAxisColor}, + ZAxisColor{InZAxisColor}, bPersistentLines(bInPersistentLines), LifeTimeModifier(InLifeTimeModifier), DepthPriority(InDepthPriority) diff --git a/Source/SenseGloveSettings/Private/SGSettings/SGGameUserSettingSettings.cpp b/Source/SenseGloveSettings/Private/SGSettings/SGGameUserSettingSettings.cpp index 79e1e33d..f12b7996 100644 --- a/Source/SenseGloveSettings/Private/SGSettings/SGGameUserSettingSettings.cpp +++ b/Source/SenseGloveSettings/Private/SGSettings/SGGameUserSettingSettings.cpp @@ -36,12 +36,12 @@ #include "SGSettings/SGGameUserSettingSettings.h" FSGGameUserSettingSettings::FSGGameUserSettingSettings() - : HardwareBenchmarkSettings{} + : HardwareBenchmarkSettings{FSGHardwareBenchmarkSettings{}} { } FSGGameUserSettingSettings::FSGGameUserSettingSettings( const FSGHardwareBenchmarkSettings& InHardwareBenchmarkSettings) - : HardwareBenchmarkSettings(InHardwareBenchmarkSettings) + : HardwareBenchmarkSettings{InHardwareBenchmarkSettings} { } \ No newline at end of file diff --git a/Source/SenseGloveSettings/Private/SGSettings/SGGloveTrackingSettings.cpp b/Source/SenseGloveSettings/Private/SGSettings/SGGloveTrackingSettings.cpp index 0fe010f7..9a90247f 100644 --- a/Source/SenseGloveSettings/Private/SGSettings/SGGloveTrackingSettings.cpp +++ b/Source/SenseGloveSettings/Private/SGSettings/SGGloveTrackingSettings.cpp @@ -36,8 +36,9 @@ #include "SGSettings/SGGloveTrackingSettings.h" FSGGloveTrackingSettings::FSGGloveTrackingSettings() - : FSGGloveTrackingSettings( - 0.125f) + : FSGGloveTrackingSettings{ + 1000.0f / 60.0f + } { } diff --git a/Source/SenseGloveSettings/Private/SGSettings/SGHMDTrackingSettings.cpp b/Source/SenseGloveSettings/Private/SGSettings/SGHMDTrackingSettings.cpp index ffb145cc..58a8c982 100644 --- a/Source/SenseGloveSettings/Private/SGSettings/SGHMDTrackingSettings.cpp +++ b/Source/SenseGloveSettings/Private/SGSettings/SGHMDTrackingSettings.cpp @@ -36,13 +36,14 @@ #include "SGSettings/SGHMDTrackingSettings.h" FSGHMDTrackingSettings::FSGHMDTrackingSettings() - : FSGHMDTrackingSettings( - ESGViveHMDDetectionPriority::HtcViveFocus3First) + : FSGHMDTrackingSettings{ + ESGViveHMDDetectionPriority::HtcViveFocus3First + } { } FSGHMDTrackingSettings::FSGHMDTrackingSettings( const ESGViveHMDDetectionPriority InViveHmdDetectionPriority) - : ViveHMDDetectionPriority(InViveHmdDetectionPriority) + : ViveHMDDetectionPriority(InViveHmdDetectionPriority) { } \ No newline at end of file diff --git a/Source/SenseGloveSettings/Private/SGSettings/SGHandTrackingSettings.cpp b/Source/SenseGloveSettings/Private/SGSettings/SGHandTrackingSettings.cpp index 7bc23e92..a6512016 100644 --- a/Source/SenseGloveSettings/Private/SGSettings/SGHandTrackingSettings.cpp +++ b/Source/SenseGloveSettings/Private/SGSettings/SGHandTrackingSettings.cpp @@ -36,9 +36,10 @@ #include "SGSettings/SGHandTrackingSettings.h" FSGHandTrackingSettings::FSGHandTrackingSettings() - : FSGHandTrackingSettings( + : FSGHandTrackingSettings{ false, - true) + true + } { } diff --git a/Source/SenseGloveSettings/Private/SGSettings/SGHardwareBenchmarkSettings.cpp b/Source/SenseGloveSettings/Private/SGSettings/SGHardwareBenchmarkSettings.cpp index c16df7d0..48538edf 100644 --- a/Source/SenseGloveSettings/Private/SGSettings/SGHardwareBenchmarkSettings.cpp +++ b/Source/SenseGloveSettings/Private/SGSettings/SGHardwareBenchmarkSettings.cpp @@ -36,10 +36,11 @@ #include "SGSettings/SGHardwareBenchmarkSettings.h" FSGHardwareBenchmarkSettings::FSGHardwareBenchmarkSettings() - : FSGHardwareBenchmarkSettings( + : FSGHardwareBenchmarkSettings{ 10.0f, 1.0f, - 1.0f) + 1.0f + } { } diff --git a/Source/SenseGloveSettings/Private/SGSettings/SGInitializationSettings.cpp b/Source/SenseGloveSettings/Private/SGSettings/SGInitializationSettings.cpp index 49ff38a5..e615b8cd 100644 --- a/Source/SenseGloveSettings/Private/SGSettings/SGInitializationSettings.cpp +++ b/Source/SenseGloveSettings/Private/SGSettings/SGInitializationSettings.cpp @@ -36,8 +36,9 @@ #include "SGSettings/SGInitializationSettings.h" FSGInitializationSettings::FSGInitializationSettings() - : FSGInitializationSettings( - true) + : FSGInitializationSettings{ + true + } { } diff --git a/Source/SenseGloveSettings/Private/SGSettings/SGTrackingSettings.cpp b/Source/SenseGloveSettings/Private/SGSettings/SGTrackingSettings.cpp index e8f77d8a..2a14945b 100644 --- a/Source/SenseGloveSettings/Private/SGSettings/SGTrackingSettings.cpp +++ b/Source/SenseGloveSettings/Private/SGSettings/SGTrackingSettings.cpp @@ -36,12 +36,13 @@ #include "SGSettings/SGTrackingSettings.h" FSGTrackingSettings::FSGTrackingSettings() - : FSGTrackingSettings( + : FSGTrackingSettings{ false, FSGGloveTrackingSettings{}, FSGHandTrackingSettings{}, FSGHMDTrackingSettings{}, - FSGWristTrackingSettings{}) + FSGWristTrackingSettings{} + } { } diff --git a/Source/SenseGloveSettings/Private/SGSettings/SGVirtualHandAnimationSettings.cpp b/Source/SenseGloveSettings/Private/SGSettings/SGVirtualHandAnimationSettings.cpp new file mode 100644 index 00000000..99bb8e0b --- /dev/null +++ b/Source/SenseGloveSettings/Private/SGSettings/SGVirtualHandAnimationSettings.cpp @@ -0,0 +1,52 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2024 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 "SGSettings/SGVirtualHandAnimationSettings.h" + +FSGVirtualHandAnimationSettings::FSGVirtualHandAnimationSettings() + : FSGVirtualHandAnimationSettings{ + FRotator{0.0f, 90.0f, 90.0f}, + true + } +{ +} + +FSGVirtualHandAnimationSettings::FSGVirtualHandAnimationSettings( + const FRotator& InAnimationBoneRotationCorrectionOffset, + const bool bInShouldAnimationApplyBoneLocation) + : AnimationBoneRotationCorrectionOffset{InAnimationBoneRotationCorrectionOffset}, + bShouldAnimationApplyBoneLocation(bInShouldAnimationApplyBoneLocation) +{ +} \ No newline at end of file diff --git a/Source/SenseGloveSettings/Private/SGSettings/SGDebugVirtualHandSettings.cpp b/Source/SenseGloveSettings/Private/SGSettings/SGVirtualHandDebuggingSettings.cpp similarity index 87% rename from Source/SenseGloveSettings/Private/SGSettings/SGDebugVirtualHandSettings.cpp rename to Source/SenseGloveSettings/Private/SGSettings/SGVirtualHandDebuggingSettings.cpp index 95355b20..66435f6b 100644 --- a/Source/SenseGloveSettings/Private/SGSettings/SGDebugVirtualHandSettings.cpp +++ b/Source/SenseGloveSettings/Private/SGSettings/SGVirtualHandDebuggingSettings.cpp @@ -33,10 +33,10 @@ */ -#include "SGSettings/SGDebugVirtualHandSettings.h" +#include "SGSettings/SGVirtualHandDebuggingSettings.h" -FSGDebugVirtualHandSettings::FSGDebugVirtualHandSettings() - : FSGDebugVirtualHandSettings( +FSGVirtualHandDebuggingSettings::FSGVirtualHandDebuggingSettings() + : FSGVirtualHandDebuggingSettings{ false, ESGDebugVirtualHandDrawingMode::None, FVector(0.5f, 0.5f, 0.5f), @@ -49,12 +49,13 @@ FSGDebugVirtualHandSettings::FSGDebugVirtualHandSettings() FColor(0, 0, 255, 255), false, 1.1f, - 0) + 0 + } { } -FSGDebugVirtualHandSettings::FSGDebugVirtualHandSettings( - const bool bInDrawDebugVirtualHand, +FSGVirtualHandDebuggingSettings::FSGVirtualHandDebuggingSettings( + const bool bInDrawVirtualHandDebugging, const ESGDebugVirtualHandDrawingMode InDrawingMode, const FVector& InCubeExtent, const FColor& InCubeColor, @@ -67,7 +68,7 @@ FSGDebugVirtualHandSettings::FSGDebugVirtualHandSettings( const bool bInPersistentLines, const float InLifeTimeModifier, const uint8 InDepthPriority) - : bDrawDebugVirtualHand(bInDrawDebugVirtualHand), + : bDrawVirtualHandDebugging(bInDrawVirtualHandDebugging), DrawingMode(InDrawingMode), CubeExtent(InCubeExtent), CubeColor(InCubeColor), diff --git a/Source/SenseGloveSettings/Private/SGSettings/SGVirtualHandGrabSettings.cpp b/Source/SenseGloveSettings/Private/SGSettings/SGVirtualHandGrabSettings.cpp new file mode 100644 index 00000000..090d99c0 --- /dev/null +++ b/Source/SenseGloveSettings/Private/SGSettings/SGVirtualHandGrabSettings.cpp @@ -0,0 +1,61 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2024 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 "SGSettings/SGVirtualHandGrabSettings.h" + +FSGVirtualHandGrabSettings::FSGVirtualHandGrabSettings() + : FSGVirtualHandGrabSettings{ + FName{TEXT("GrabPalmAttachPoint")}, + FVector{0.04f, 0.04f, 0.04f}, + FName{TEXT("GrabThumbCollider")}, + FName{TEXT("GrabIndexCollider")}, + FName{TEXT("GrabMiddleCollider")} + } +{ +} + +FSGVirtualHandGrabSettings::FSGVirtualHandGrabSettings( + const FName& InPalmAttachPointSocketName, + const FVector& InDefaultColliderSize, + const FName& InThumbColliderSocketName, + const FName& InIndexColliderSocketName, + const FName& InMiddleColliderSocketName) + : PalmAttachPointSocketName{InPalmAttachPointSocketName}, + DefaultColliderSize{InDefaultColliderSize}, + ThumbColliderSocketName{InThumbColliderSocketName}, + IndexColliderSocketName{InIndexColliderSocketName}, + MiddleColliderSocketName{InMiddleColliderSocketName} +{ +} \ No newline at end of file diff --git a/Source/SenseGloveSettings/Private/SGSettings/SGVirtualHandHapticsSettings.cpp b/Source/SenseGloveSettings/Private/SGSettings/SGVirtualHandHapticsSettings.cpp new file mode 100644 index 00000000..db1ff243 --- /dev/null +++ b/Source/SenseGloveSettings/Private/SGSettings/SGVirtualHandHapticsSettings.cpp @@ -0,0 +1,49 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2024 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 "SGSettings/SGVirtualHandHapticsSettings.h" + +FSGVirtualHandHapticsSettings::FSGVirtualHandHapticsSettings() + : FSGVirtualHandHapticsSettings{ + true + } +{ +} + +FSGVirtualHandHapticsSettings::FSGVirtualHandHapticsSettings( + bool bInAutoStopAllHapticsOnEndPlay) + : bAutoStopAllHapticsOnEndPlay(bInAutoStopAllHapticsOnEndPlay) +{ +} \ No newline at end of file diff --git a/Source/SenseGloveSettings/Private/SGSettings/SGVirtualHandMeshSettings.cpp b/Source/SenseGloveSettings/Private/SGSettings/SGVirtualHandMeshSettings.cpp new file mode 100644 index 00000000..b0b214dc --- /dev/null +++ b/Source/SenseGloveSettings/Private/SGSettings/SGVirtualHandMeshSettings.cpp @@ -0,0 +1,416 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2024 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 "SGSettings/SGVirtualHandMeshSettings.h" + +#include "Engine/SkeletalMesh.h" + +FSGVirtualHandMeshSettings::FSGVirtualHandMeshSettings() + : FSGVirtualHandMeshSettings{ + nullptr, + nullptr, + FSGVirtualHandPhalangesLengthSettings{}, + FRotator{0.0f, -90.0f, 0.0f} + } +{ +} + +FSGVirtualHandMeshSettings::FSGVirtualHandMeshSettings( + const TSoftObjectPtr& InLeftHandReferenceMesh, + const TSoftObjectPtr& InRightHandReferenceMesh, + const FSGVirtualHandPhalangesLengthSettings& InDistalPhalangesLengthSettings, + const FRotator& InRootBoneRotationCorrection) + : LeftHandReferenceMesh{InLeftHandReferenceMesh}, + RightHandReferenceMesh{InRightHandReferenceMesh}, + DistalPhalangesLengthSettings{InDistalPhalangesLengthSettings}, + RootBoneRotationCorrection{InRootBoneRotationCorrection}, + LeftHandDefaultReferenceBoneTransforms{ + TPair{ + FName{TEXT("hand_l")}, + FTransform{ + FRotator{0.0f, -180.0f, 90.0f}, + FVector{0.0f, 0.0f, 0.0f} + } + }, + TPair{ + FName{TEXT("palm_l")}, + FTransform{ + FRotator{0.0f, 0.0f, 0.0f}, + FVector{0.0f, 0.0f, -6.61557f} + } + }, + TPair{ + FName{TEXT("thumb_01_l")}, + FTransform{ + FRotator{30.400068f, 75.42522f, 33.588919f}, + FVector{2.581536f, 1.356605f, -1.992447f} + } + }, + TPair{ + FName{TEXT("thumb_02_l")}, + FTransform{ + FRotator{-0.379136f, 4.00635f, -23.318826f}, + FVector{0.0f, 0.0f, -4.378f} + } + }, + TPair{ + FName{TEXT("thumb_03_l")}, + FTransform{ + FRotator{0.0f, 0.0f, -10.0f}, + FVector{0.0f, 0.0f, -3.086f} + } + }, + TPair{ + FName{TEXT("index_metacarpal_l")}, + FTransform{ + FRotator{7.277920f, 3.392215f, 1.032481f}, + FVector{2.379324f, -0.384681f, -3.444506f} + } + }, + TPair{ + FName{TEXT("index_01_l")}, + FTransform{ + FRotator{0.0f, 0.0f, -23.373f}, + FVector{-0.240876f, 0.043182f, -5.877098f} + } + }, + TPair{ + FName{TEXT("index_02_l")}, + FTransform{ + FRotator{0.0f, 0.0f, -14.892568f}, + FVector{0.0f, 0.0f, -4.08f} + } + }, + TPair{ + FName{TEXT("index_03_l")}, + FTransform{ + FRotator{0.0f, 0.0f, -12.516401f}, + FVector{0.0f, 0.0f, -2.595f} + } + }, + TPair{ + FName{TEXT("middle_metacarpal_l")}, + FTransform{ + FRotator{0.042392f, -4.274287f, 2.321687f}, + FVector{0.182864f, -0.753571f, -3.375834f} + } + }, + TPair{ + FName{TEXT("middle_01_l")}, + FTransform{ + FRotator{0.0f, 0.0f, -31.572682f}, + FVector{0.0f, 0.0f, -6.098209f} + } + }, + TPair{ + FName{TEXT("middle_02_l")}, + FTransform{ + FRotator{0.0f, 0.0f, -20.76921f}, + FVector{0.0f, 0.0f, -5.169f} + } + }, + TPair{ + FName{TEXT("middle_03_l")}, + FTransform{ + FRotator{0.0f, 0.0f, -10.0f}, + FVector{0.0f, 0.0f, -2.474f} + } + }, + TPair{ + FName{TEXT("ring_metacarpal_l")}, + FTransform{ + FRotator{-11.109678f, -13.886395f, 4.333313f}, + FVector{-1.091757f, -0.542517f, -3.374304f} + } + }, + TPair{ + FName{TEXT("ring_01_l")}, + FTransform{ + FRotator{3.034822f, 5.633827f, -29.271656f}, + FVector{0.020689f, -0.041625f, -5.645517f} + } + }, + TPair{ + FName{TEXT("ring_02_l")}, + FTransform{ + FRotator{0.0f, 0.0f, -18.964f}, + FVector{0.0f, 0.0f, -4.977f} + } + }, + TPair{ + FName{TEXT("ring_03_l")}, + FTransform{ + FRotator{0.0f, 0.0f, -9.167999f}, + FVector{0.0f, 0.0f, -2.265f} + } + }, + TPair{ + FName{TEXT("pinky_metacarpal_l")}, + FTransform{ + FRotator{-22.65256f, -25.358337f, -1.818999f}, + FVector{-2.391111f, -0.305917f, -3.314378f} + } + }, + TPair{ + FName{TEXT("pinky_01_l")}, + FTransform{ + FRotator{3.247850f, 9.999765f, -14.49391f}, + FVector{0.19884f, -0.14312f, -4.957568f} + } + }, + TPair{ + FName{TEXT("pinky_02_l")}, + FTransform{ + FRotator{0.0f, 0.0f, -21.286999f}, + FVector{0.0f, 0.0f, -3.816f} + } + }, + TPair{ + FName{TEXT("pinky_03_l")}, + FTransform{ + FRotator{0.0f, 0.0f, -4.917f}, + FVector{0.0f, 0.0f, -2.04f} + } + }, + }, + RightHandDefaultReferenceBoneTransforms{ + TPair{ + FName{TEXT("hand_r")}, + FTransform{ + FRotator{0.0f, -180.0f, 90.0f}, + FVector{0.0f, 0.0f, 0.0f} + } + }, + TPair{ + FName{TEXT("palm_r")}, + FTransform{ + FRotator{0.0f, 0.0f, 0.0f}, + FVector{0.000052f, -0.000629f, -6.615405f} + } + }, + TPair{ + FName{TEXT("thumb_01_r")}, + FTransform{ + FRotator{-30.400068f, -75.42522f, 33.588919f}, + FVector{-2.581326f, 1.356657f, -1.992833f} + } + }, + TPair{ + FName{TEXT("thumb_02_r")}, + FTransform{ + FRotator{0.379136f, -4.00635f, -23.318826f}, + FVector{0.000136f, -0.000427f, -4.377825f} + } + }, + TPair{ + FName{TEXT("thumb_03_r")}, + FTransform{ + FRotator{0.0f, 0.0f, -10.0f}, + FVector{-0.000046f, 0.000015f, -3.085952f} + } + }, + TPair{ + FName{TEXT("index_metacarpal_r")}, + FTransform{ + FRotator{-7.277920f, -3.392215f, 1.032481f}, + FVector{-2.379309f, -0.385167f, -3.444514f} + } + }, + TPair{ + FName{TEXT("index_01_r")}, + FTransform{ + FRotator{0.0f, 0.0f, -23.373f}, + FVector{0.240952f, 0.043412f, -5.877205f} + } + }, + TPair{ + FName{TEXT("index_02_r")}, + FTransform{ + FRotator{0.0f, 0.0f, -14.892568f}, + FVector{-0.000032f, -0.000005f, -4.079933f} + } + }, + TPair{ + FName{TEXT("index_03_r")}, + FTransform{ + FRotator{0.0f, 0.0f, -12.516401f}, + FVector{0.000004f, -0.00004f, -2.595076f} + } + }, + TPair{ + FName{TEXT("middle_metacarpal_r")}, + FTransform{ + FRotator{-0.042392f, 4.274287f, 2.321687f}, + FVector{-0.182806f, -0.754004f, -3.3758f} + } + }, + TPair{ + FName{TEXT("middle_01_r")}, + FTransform{ + FRotator{0.0f, 0.0f, -31.572682f}, + FVector{-0.000001f, 0.000124f, -6.098366f} + } + }, + TPair{ + FName{TEXT("middle_02_r")}, + FTransform{ + FRotator{0.0f, 0.0f, -20.76921f}, + FVector{0.000037f, 0.000077f, -5.168992f} + } + }, + TPair{ + FName{TEXT("middle_03_r")}, + FTransform{ + FRotator{0.0f, 0.0f, -10.0f}, + FVector{-0.000034f, -0.000046f, -2.474047f} + } + }, + TPair{ + FName{TEXT("ring_metacarpal_r")}, + FTransform{ + FRotator{11.109678f, 13.886395f, 4.333313f}, + FVector{1.091782f, -0.542992f, -3.374208f} + } + }, + TPair{ + FName{TEXT("ring_01_r")}, + FTransform{ + FRotator{-3.034822f, -5.633827f, -29.271656f}, + FVector{-0.020675f, -0.041443f, -5.645712f} + } + }, + TPair{ + FName{TEXT("ring_02_r")}, + FTransform{ + FRotator{0.0f, 0.0f, -18.964f}, + FVector{0.000024f, 0.000021f, -4.977067f} + } + }, + TPair{ + FName{TEXT("ring_03_r")}, + FTransform{ + FRotator{0.0f, 0.0f, -9.167999f}, + FVector{0.000011f, -0.00005f, -2.264975f} + } + }, + TPair{ + FName{TEXT("pinky_metacarpal_r")}, + FTransform{ + FRotator{22.65256f, 25.358337f, -1.818999f}, + FVector{2.391287f, -0.305935f, -3.314677f} + } + }, + TPair{ + FName{TEXT("pinky_01_r")}, + FTransform{ + FRotator{-3.24785f, -9.999765f, -14.49391f}, + FVector{-0.19892f, -0.143261f, -4.957301f} + } + }, + TPair{ + FName{TEXT("pinky_02_r")}, + FTransform{ + FRotator{0.0f, 0.0f, -21.286999f}, + FVector{-0.000033f, -0.00003f, -3.816036f} + } + }, + TPair{ + FName{TEXT("pinky_03_r")}, + FTransform{ + FRotator{0.0f, -0.000002f, -4.917f}, + FVector{0.000031f, 0.000018f, -2.04f} + } + }, + }, + LeftHandBoneNames + { + FName{TEXT("palm_l")},// Palm + FName{TEXT("hand_l")},// Wrist + FName{TEXT("thumb_01_l")},// ThumbMetacarpal + FName{TEXT("thumb_02_l")},// ThumbProximal + FName{TEXT("thumb_03_l")},// ThumbDistal + NAME_None,// ThumbTip + FName{TEXT("index_metacarpal_l")},// IndexMetacarpal + FName{TEXT("index_01_l")},// IndexProximal + FName{TEXT("index_02_l")},// IndexIntermediate + FName{TEXT("index_03_l")},// IndexDistal + NAME_None,// IndexTip + FName{TEXT("middle_metacarpal_l")},// MiddleMetacarpal + FName{TEXT("middle_01_l")},// MiddleProximal + FName{TEXT("middle_02_l")},// MiddleIntermediate + FName{TEXT("middle_03_l")},// MiddleDistal + NAME_None,// MiddleTip + FName{TEXT("ring_metacarpal_l")},// RingMetacarpal + FName{TEXT("ring_01_l")},// RingProximal + FName{TEXT("ring_02_l")},// RingIntermediate + FName{TEXT("ring_03_l")},// RingDistal + NAME_None,// RingTip + FName{TEXT("pinky_metacarpal_l")},// LittleMetacarpal + FName{TEXT("pinky_01_l")},// LittleProximal + FName{TEXT("pinky_02_l")},// LittleIntermediate + FName{TEXT("pinky_03_l")},// LittleDistal + NAME_None,// LittleTip + }, + RightHandBoneNames + { + FName{TEXT("palm_r")},// Palm + FName{TEXT("hand_r")},// Wrist + FName{TEXT("thumb_01_r")},// ThumbMetacarpal + FName{TEXT("thumb_02_r")},// ThumbProximal + FName{TEXT("thumb_03_r")},// ThumbDistal + NAME_None,// ThumbTip + FName{TEXT("index_metacarpal_r")},// IndexMetacarpal + FName{TEXT("index_01_r")},// IndexProximal + FName{TEXT("index_02_r")},// IndexIntermediate + FName{TEXT("index_03_r")},// IndexDistal + NAME_None,// IndexTip + FName{TEXT("middle_metacarpal_r")},// MiddleMetacarpal + FName{TEXT("middle_01_r")},// MiddleProximal + FName{TEXT("middle_02_r")},// MiddleIntermediate + FName{TEXT("middle_03_r")},// MiddleDistal + NAME_None,// MiddleTip + FName{TEXT("ring_metacarpal_r")},// RingMetacarpal + FName{TEXT("ring_01_r")},// RingProximal + FName{TEXT("ring_02_r")},// RingIntermediate + FName{TEXT("ring_03_r")},// RingDistal + NAME_None,// RingTip + FName{TEXT("pinky_metacarpal_r")},// LittleMetacarpal + FName{TEXT("pinky_01_r")},// LittleProximal + FName{TEXT("pinky_02_r")},// LittleIntermediate + FName{TEXT("pinky_03_r")},// LittleDistal + NAME_None// LittleTip + } +{ +} \ No newline at end of file diff --git a/Source/SenseGloveSettings/Private/SGSettings/SGVirtualHandPhalangesLengthSettings.cpp b/Source/SenseGloveSettings/Private/SGSettings/SGVirtualHandPhalangesLengthSettings.cpp new file mode 100644 index 00000000..4f9f4c60 --- /dev/null +++ b/Source/SenseGloveSettings/Private/SGSettings/SGVirtualHandPhalangesLengthSettings.cpp @@ -0,0 +1,63 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2024 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 "SGSettings/SGVirtualHandPhalangesLengthSettings.h" + +#include "Engine/SkeletalMesh.h" + +FSGVirtualHandPhalangesLengthSettings::FSGVirtualHandPhalangesLengthSettings() + : FSGVirtualHandPhalangesLengthSettings{ + 2.4f, + 2.4f, + 2.4f, + 2.4f, + 2.4f, + } +{ +} + +FSGVirtualHandPhalangesLengthSettings::FSGVirtualHandPhalangesLengthSettings( + const float InThumb, + const float InIndex, + const float InMiddle, + const float InRing, + const float InLittle) + : Thumb(InThumb), + Index(InIndex), + Middle(InMiddle), + Ring(InRing), + Little(InLittle) +{ +} \ No newline at end of file diff --git a/Source/SenseGloveSettings/Private/SGSettings/SGVirtualHandSettings.cpp b/Source/SenseGloveSettings/Private/SGSettings/SGVirtualHandSettings.cpp index 521e9521..d0120d22 100644 --- a/Source/SenseGloveSettings/Private/SGSettings/SGVirtualHandSettings.cpp +++ b/Source/SenseGloveSettings/Private/SGSettings/SGVirtualHandSettings.cpp @@ -38,390 +38,29 @@ #include "Engine/SkeletalMesh.h" FSGVirtualHandSettings::FSGVirtualHandSettings() - : FSGVirtualHandSettings( - nullptr, - nullptr, - 2.4f, - 2.4f, - 2.4f, - 2.4f, - 2.4f, - FRotator{0.0f, -90.0f, 0.0f}) + : FSGVirtualHandSettings{ + FSGVirtualHandAnimationSettings{}, + FSGVirtualHandDebuggingSettings{}, + FSGVirtualHandGrabSettings{}, + FSGVirtualHandHapticsSettings{}, + FSGVirtualHandMeshSettings{}, + FSGVirtualHandTouchSettings{} + } { } FSGVirtualHandSettings::FSGVirtualHandSettings( - const TSoftObjectPtr& InLeftHandReferenceMesh, - const TSoftObjectPtr& InRightHandReferenceMesh, - const float InThumbDistalPhalanxLength, - const float InIndexDistalPhalanxLength, - const float InMiddleDistalPhalanxLength, - const float InRingDistalPhalanxLength, - const float InLittleDistalPhalanxLength, - const FRotator& InRootBoneRotationCorrection) - : LeftHandReferenceMesh(InLeftHandReferenceMesh), - RightHandReferenceMesh(InRightHandReferenceMesh), - ThumbDistalPhalanxLength(InThumbDistalPhalanxLength), - IndexDistalPhalanxLength(InIndexDistalPhalanxLength), - MiddleDistalPhalanxLength(InMiddleDistalPhalanxLength), - RingDistalPhalanxLength(InRingDistalPhalanxLength), - LittleDistalPhalanxLength(InLittleDistalPhalanxLength), - RootBoneRotationCorrection(InRootBoneRotationCorrection), - LeftHandDefaultReferenceBoneTransforms{ - TPair{ - FName{TEXT("hand_l")}, - FTransform{ - FRotator{0.0f, -180.0f, 90.0f}, - FVector{0.0f, 0.0f, 0.0f} - } - }, - TPair{ - FName{TEXT("palm_l")}, - FTransform{ - FRotator{0.0f, 0.0f, 0.0f}, - FVector{0.0f, 0.0f, -6.61557f} - } - }, - TPair{ - FName{TEXT("thumb_01_l")}, - FTransform{ - FRotator{30.400068f, 75.42522f, 33.588919f}, - FVector{2.581536f, 1.356605f, -1.992447f} - } - }, - TPair{ - FName{TEXT("thumb_02_l")}, - FTransform{ - FRotator{-0.379136f, 4.00635f, -23.318826f}, - FVector{0.0f, 0.0f, -4.378f} - } - }, - TPair{ - FName{TEXT("thumb_03_l")}, - FTransform{ - FRotator{0.0f, 0.0f, -10.0f}, - FVector{0.0f, 0.0f, -3.086f} - } - }, - TPair{ - FName{TEXT("index_metacarpal_l")}, - FTransform{ - FRotator{7.277920f, 3.392215f, 1.032481f}, - FVector{2.379324f, -0.384681f, -3.444506f} - } - }, - TPair{ - FName{TEXT("index_01_l")}, - FTransform{ - FRotator{0.0f, 0.0f, -23.373f}, - FVector{-0.240876f, 0.043182f, -5.877098f} - } - }, - TPair{ - FName{TEXT("index_02_l")}, - FTransform{ - FRotator{0.0f, 0.0f, -14.892568f}, - FVector{0.0f, 0.0f, -4.08f} - } - }, - TPair{ - FName{TEXT("index_03_l")}, - FTransform{ - FRotator{0.0f, 0.0f, -12.516401f}, - FVector{0.0f, 0.0f, -2.595f} - } - }, - TPair{ - FName{TEXT("middle_metacarpal_l")}, - FTransform{ - FRotator{0.042392f, -4.274287f, 2.321687f}, - FVector{0.182864f, -0.753571f, -3.375834f} - } - }, - TPair{ - FName{TEXT("middle_01_l")}, - FTransform{ - FRotator{0.0f, 0.0f, -31.572682f}, - FVector{0.0f, 0.0f, -6.098209f} - } - }, - TPair{ - FName{TEXT("middle_02_l")}, - FTransform{ - FRotator{0.0f, 0.0f, -20.76921f}, - FVector{0.0f, 0.0f, -5.169f} - } - }, - TPair{ - FName{TEXT("middle_03_l")}, - FTransform{ - FRotator{0.0f, 0.0f, -10.0f}, - FVector{0.0f, 0.0f, -2.474f} - } - }, - TPair{ - FName{TEXT("ring_metacarpal_l")}, - FTransform{ - FRotator{-11.109678f, -13.886395f, 4.333313f}, - FVector{-1.091757f, -0.542517f, -3.374304f} - } - }, - TPair{ - FName{TEXT("ring_01_l")}, - FTransform{ - FRotator{3.034822f, 5.633827f, -29.271656f}, - FVector{0.020689f, -0.041625f, -5.645517f} - } - }, - TPair{ - FName{TEXT("ring_02_l")}, - FTransform{ - FRotator{0.0f, 0.0f, -18.964f}, - FVector{0.0f, 0.0f, -4.977f} - } - }, - TPair{ - FName{TEXT("ring_03_l")}, - FTransform{ - FRotator{0.0f, 0.0f, -9.167999f}, - FVector{0.0f, 0.0f, -2.265f} - } - }, - TPair{ - FName{TEXT("pinky_metacarpal_l")}, - FTransform{ - FRotator{-22.65256f, -25.358337f, -1.818999f}, - FVector{-2.391111f, -0.305917f, -3.314378f} - } - }, - TPair{ - FName{TEXT("pinky_01_l")}, - FTransform{ - FRotator{3.247850f, 9.999765f, -14.49391f}, - FVector{0.19884f, -0.14312f, -4.957568f} - } - }, - TPair{ - FName{TEXT("pinky_02_l")}, - FTransform{ - FRotator{0.0f, 0.0f, -21.286999f}, - FVector{0.0f, 0.0f, -3.816f} - } - }, - TPair{ - FName{TEXT("pinky_03_l")}, - FTransform{ - FRotator{0.0f, 0.0f, -4.917f}, - FVector{0.0f, 0.0f, -2.04f} - } - }, - }, - RightHandDefaultReferenceBoneTransforms{ - TPair{ - FName{TEXT("hand_r")}, - FTransform{ - FRotator{0.0f, -180.0f, 90.0f}, - FVector{0.0f, 0.0f, 0.0f} - } - }, - TPair{ - FName{TEXT("palm_r")}, - FTransform{ - FRotator{0.0f, 0.0f, 0.0f}, - FVector{0.000052f, -0.000629f, -6.615405f} - } - }, - TPair{ - FName{TEXT("thumb_01_r")}, - FTransform{ - FRotator{-30.400068f, -75.42522f, 33.588919f}, - FVector{-2.581326f, 1.356657f, -1.992833f} - } - }, - TPair{ - FName{TEXT("thumb_02_r")}, - FTransform{ - FRotator{0.379136f, -4.00635f, -23.318826f}, - FVector{0.000136f, -0.000427f, -4.377825f} - } - }, - TPair{ - FName{TEXT("thumb_03_r")}, - FTransform{ - FRotator{0.0f, 0.0f, -10.0f}, - FVector{-0.000046f, 0.000015f, -3.085952f} - } - }, - TPair{ - FName{TEXT("index_metacarpal_r")}, - FTransform{ - FRotator{-7.277920f, -3.392215f, 1.032481f}, - FVector{-2.379309f, -0.385167f, -3.444514f} - } - }, - TPair{ - FName{TEXT("index_01_r")}, - FTransform{ - FRotator{0.0f, 0.0f, -23.373f}, - FVector{0.240952f, 0.043412f, -5.877205f} - } - }, - TPair{ - FName{TEXT("index_02_r")}, - FTransform{ - FRotator{0.0f, 0.0f, -14.892568f}, - FVector{-0.000032f, -0.000005f, -4.079933f} - } - }, - TPair{ - FName{TEXT("index_03_r")}, - FTransform{ - FRotator{0.0f, 0.0f, -12.516401f}, - FVector{0.000004f, -0.00004f, -2.595076f} - } - }, - TPair{ - FName{TEXT("middle_metacarpal_r")}, - FTransform{ - FRotator{-0.042392f, 4.274287f, 2.321687f}, - FVector{-0.182806f, -0.754004f, -3.3758f} - } - }, - TPair{ - FName{TEXT("middle_01_r")}, - FTransform{ - FRotator{0.0f, 0.0f, -31.572682f}, - FVector{-0.000001f, 0.000124f, -6.098366f} - } - }, - TPair{ - FName{TEXT("middle_02_r")}, - FTransform{ - FRotator{0.0f, 0.0f, -20.76921f}, - FVector{0.000037f, 0.000077f, -5.168992f} - } - }, - TPair{ - FName{TEXT("middle_03_r")}, - FTransform{ - FRotator{0.0f, 0.0f, -10.0f}, - FVector{-0.000034f, -0.000046f, -2.474047f} - } - }, - TPair{ - FName{TEXT("ring_metacarpal_r")}, - FTransform{ - FRotator{11.109678f, 13.886395f, 4.333313f}, - FVector{1.091782f, -0.542992f, -3.374208f} - } - }, - TPair{ - FName{TEXT("ring_01_r")}, - FTransform{ - FRotator{-3.034822f, -5.633827f, -29.271656f}, - FVector{-0.020675f, -0.041443f, -5.645712f} - } - }, - TPair{ - FName{TEXT("ring_02_r")}, - FTransform{ - FRotator{0.0f, 0.0f, -18.964f}, - FVector{0.000024f, 0.000021f, -4.977067f} - } - }, - TPair{ - FName{TEXT("ring_03_r")}, - FTransform{ - FRotator{0.0f, 0.0f, -9.167999f}, - FVector{0.000011f, -0.00005f, -2.264975f} - } - }, - TPair{ - FName{TEXT("pinky_metacarpal_r")}, - FTransform{ - FRotator{22.65256f, 25.358337f, -1.818999f}, - FVector{2.391287f, -0.305935f, -3.314677f} - } - }, - TPair{ - FName{TEXT("pinky_01_r")}, - FTransform{ - FRotator{-3.24785f, -9.999765f, -14.49391f}, - FVector{-0.19892f, -0.143261f, -4.957301f} - } - }, - TPair{ - FName{TEXT("pinky_02_r")}, - FTransform{ - FRotator{0.0f, 0.0f, -21.286999f}, - FVector{-0.000033f, -0.00003f, -3.816036f} - } - }, - TPair{ - FName{TEXT("pinky_03_r")}, - FTransform{ - FRotator{0.0f, -0.000002f, -4.917f}, - FVector{0.000031f, 0.000018f, -2.04f} - } - }, - }, - LeftHandBoneNames - { - FName{TEXT("palm_l")},// Palm - FName{TEXT("hand_l")},// Wrist - FName{TEXT("thumb_01_l")},// ThumbMetacarpal - FName{TEXT("thumb_02_l")},// ThumbProximal - FName{TEXT("thumb_03_l")},// ThumbDistal - NAME_None,// ThumbTip - FName{TEXT("index_metacarpal_l")},// IndexMetacarpal - FName{TEXT("index_01_l")},// IndexProximal - FName{TEXT("index_02_l")},// IndexIntermediate - FName{TEXT("index_03_l")},// IndexDistal - NAME_None,// IndexTip - FName{TEXT("middle_metacarpal_l")},// MiddleMetacarpal - FName{TEXT("middle_01_l")},// MiddleProximal - FName{TEXT("middle_02_l")},// MiddleIntermediate - FName{TEXT("middle_03_l")},// MiddleDistal - NAME_None,// MiddleTip - FName{TEXT("ring_metacarpal_l")},// RingMetacarpal - FName{TEXT("ring_01_l")},// RingProximal - FName{TEXT("ring_02_l")},// RingIntermediate - FName{TEXT("ring_03_l")},// RingDistal - NAME_None,// RingTip - FName{TEXT("pinky_metacarpal_l")},// LittleMetacarpal - FName{TEXT("pinky_01_l")},// LittleProximal - FName{TEXT("pinky_02_l")},// LittleIntermediate - FName{TEXT("pinky_03_l")},// LittleDistal - NAME_None,// LittleTip - }, - RightHandBoneNames - { - FName{TEXT("palm_r")},// Palm - FName{TEXT("hand_r")},// Wrist - FName{TEXT("thumb_01_r")},// ThumbMetacarpal - FName{TEXT("thumb_02_r")},// ThumbProximal - FName{TEXT("thumb_03_r")},// ThumbDistal - NAME_None,// ThumbTip - FName{TEXT("index_metacarpal_r")},// IndexMetacarpal - FName{TEXT("index_01_r")},// IndexProximal - FName{TEXT("index_02_r")},// IndexIntermediate - FName{TEXT("index_03_r")},// IndexDistal - NAME_None,// IndexTip - FName{TEXT("middle_metacarpal_r")},// MiddleMetacarpal - FName{TEXT("middle_01_r")},// MiddleProximal - FName{TEXT("middle_02_r")},// MiddleIntermediate - FName{TEXT("middle_03_r")},// MiddleDistal - NAME_None,// MiddleTip - FName{TEXT("ring_metacarpal_r")},// RingMetacarpal - FName{TEXT("ring_01_r")},// RingProximal - FName{TEXT("ring_02_r")},// RingIntermediate - FName{TEXT("ring_03_r")},// RingDistal - NAME_None,// RingTip - FName{TEXT("pinky_metacarpal_r")},// LittleMetacarpal - FName{TEXT("pinky_01_r")},// LittleProximal - FName{TEXT("pinky_02_r")},// LittleIntermediate - FName{TEXT("pinky_03_r")},// LittleDistal - NAME_None// LittleTip - } + const FSGVirtualHandAnimationSettings& InAnimationSettings, + const FSGVirtualHandDebuggingSettings& InDebuggingSettings, + const FSGVirtualHandGrabSettings& InGrabSettings, + const FSGVirtualHandHapticsSettings& InHapticsSettings, + const FSGVirtualHandMeshSettings& InMeshSettings, + const FSGVirtualHandTouchSettings& InTouchSettings) + : AnimationSettings{InAnimationSettings}, + DebuggingSettings{InDebuggingSettings}, + GrabSettings{InGrabSettings}, + HapticsSettings{InHapticsSettings}, + MeshSettings{InMeshSettings}, + TouchSettings{InTouchSettings} { } \ No newline at end of file diff --git a/Source/SenseGloveSettings/Private/SGSettings/SGVirtualHandTouchSettings.cpp b/Source/SenseGloveSettings/Private/SGSettings/SGVirtualHandTouchSettings.cpp new file mode 100644 index 00000000..8e51eddb --- /dev/null +++ b/Source/SenseGloveSettings/Private/SGSettings/SGVirtualHandTouchSettings.cpp @@ -0,0 +1,64 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2024 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 "SGSettings/SGVirtualHandTouchSettings.h" + +FSGVirtualHandTouchSettings::FSGVirtualHandTouchSettings() + : FSGVirtualHandTouchSettings{ + FVector{0.04f, 0.04f, 0.04f}, + FName{TEXT("TouchThumbCollider")}, + FName{TEXT("TouchIndexCollider")}, + FName{TEXT("TouchMiddleCollider")}, + FName{TEXT("TouchRingCollider")}, + FName{TEXT("TouchPinkyCollider")} + } +{ +} + +FSGVirtualHandTouchSettings::FSGVirtualHandTouchSettings( + const FVector& InDefaultColliderSize, + const FName& InThumbColliderSocketName, + const FName& InIndexColliderSocketName, + const FName& InMiddleColliderSocketName, + const FName& InRingColliderSocketName, + const FName& InPinkyColliderSocketName) + : DefaultColliderSize{InDefaultColliderSize}, + ThumbColliderSocketName{InThumbColliderSocketName}, + IndexColliderSocketName{InIndexColliderSocketName}, + MiddleColliderSocketName{InMiddleColliderSocketName}, + RingColliderSocketName{InRingColliderSocketName}, + PinkyColliderSocketName{InPinkyColliderSocketName} +{ +} \ No newline at end of file diff --git a/Source/SenseGloveSettings/Private/SGSettings/SGWristTrackingSettings.cpp b/Source/SenseGloveSettings/Private/SGSettings/SGWristTrackingSettings.cpp index 517f6fc6..ed1d7170 100644 --- a/Source/SenseGloveSettings/Private/SGSettings/SGWristTrackingSettings.cpp +++ b/Source/SenseGloveSettings/Private/SGSettings/SGWristTrackingSettings.cpp @@ -36,7 +36,7 @@ #include "SGSettings/SGWristTrackingSettings.h" FSGWristTrackingSettings::FSGWristTrackingSettings() - : FSGWristTrackingSettings( + : FSGWristTrackingSettings{ ESGPositionalTrackingHardware::None, FVector::ZeroVector, FVector::ZeroVector, @@ -45,7 +45,8 @@ FSGWristTrackingSettings::FSGWristTrackingSettings() EControllerHand::Left, EControllerHand::Right, false, - FSGDebugGizmoSettings{}) + FSGDebugGizmoSettings{} + } { } @@ -60,13 +61,13 @@ FSGWristTrackingSettings::FSGWristTrackingSettings( const bool bInDrawDebugGizmo, const FSGDebugGizmoSettings& InDebugGizmoSettings) : TrackingHardware(InTrackingHardware), - TrackingHardwareLocationOffsetLeftHand(InTrackingHardwareLocationOffsetLeftHand), - TrackingHardwareLocationOffsetRightHand(InTrackingHardwareLocationOffsetRightHand), - TrackingHardwareRotationOffsetLeftHand(InTrackingHardwareRotationOffsetLeftHand), - TrackingHardwareRotationOffsetRightHand(InTrackingHardwareRotationOffsetRightHand), + TrackingHardwareLocationOffsetLeftHand{InTrackingHardwareLocationOffsetLeftHand}, + TrackingHardwareLocationOffsetRightHand{InTrackingHardwareLocationOffsetRightHand}, + TrackingHardwareRotationOffsetLeftHand{InTrackingHardwareRotationOffsetLeftHand}, + TrackingHardwareRotationOffsetRightHand{InTrackingHardwareRotationOffsetRightHand}, LeftHandMotionSource(InLeftHandMotionSource), RightHandMotionSource(InRightHandMotionSource), bDrawDebugGizmo(bInDrawDebugGizmo), - DebugGizmoSettings(InDebugGizmoSettings) + DebugGizmoSettings{InDebugGizmoSettings} { } \ No newline at end of file diff --git a/Source/SenseGloveSettings/Public/SGSettings/SGInitializationSettings.h b/Source/SenseGloveSettings/Public/SGSettings/SGInitializationSettings.h index 66fad342..6257b076 100644 --- a/Source/SenseGloveSettings/Public/SGSettings/SGInitializationSettings.h +++ b/Source/SenseGloveSettings/Public/SGSettings/SGInitializationSettings.h @@ -53,7 +53,7 @@ public: * etc. are indeed SenseGlove classes or SenseGlove-derived classes. If not, it attempts to set them. If you don't * like this behavior for whatever reason, consider disabling this option. */ - UPROPERTY(Config, EditDefaultsOnly, Category="Glove Tracking") + UPROPERTY(Config, EditDefaultsOnly, Category="Initialization") uint8 bValidateIfDefaultClassesAreSGCompliant : 1; public: diff --git a/Source/SenseGloveSettings/Public/SGSettings/SGVirtualHandAnimationSettings.h b/Source/SenseGloveSettings/Public/SGSettings/SGVirtualHandAnimationSettings.h new file mode 100644 index 00000000..87f5ec25 --- /dev/null +++ b/Source/SenseGloveSettings/Public/SGSettings/SGVirtualHandAnimationSettings.h @@ -0,0 +1,66 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2024 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 "UObject/ObjectMacros.h" +#include "UObject/SoftObjectPtr.h" + +#include "SGVirtualHandAnimationSettings.generated.h" + +class USkeletalMesh; + +/** +* Implements the hand tracking settings for the SenseGlove module. +*/ +USTRUCT(BlueprintType) +struct SENSEGLOVESETTINGS_API FSGVirtualHandAnimationSettings +{ + GENERATED_USTRUCT_BODY() + +public: + UPROPERTY(Config, EditDefaultsOnly, Category="Animation") + FRotator AnimationBoneRotationCorrectionOffset; + + UPROPERTY(Config, EditDefaultsOnly, Category="Animation") + uint8 bShouldAnimationApplyBoneLocation : 1; + +public: + FSGVirtualHandAnimationSettings(); + + FSGVirtualHandAnimationSettings( + const FRotator& InAnimationBoneRotationCorrectionOffset, + bool bInShouldAnimationApplyBoneLocation); +}; \ No newline at end of file diff --git a/Source/SenseGloveSettings/Public/SGSettings/SGDebugVirtualHandSettings.h b/Source/SenseGloveSettings/Public/SGSettings/SGVirtualHandDebuggingSettings.h similarity index 50% rename from Source/SenseGloveSettings/Public/SGSettings/SGDebugVirtualHandSettings.h rename to Source/SenseGloveSettings/Public/SGSettings/SGVirtualHandDebuggingSettings.h index e3c6cba0..b9d55d04 100644 --- a/Source/SenseGloveSettings/Public/SGSettings/SGDebugVirtualHandSettings.h +++ b/Source/SenseGloveSettings/Public/SGSettings/SGVirtualHandDebuggingSettings.h @@ -39,81 +39,81 @@ #include "SGTypes/SGDebugTypes.h" -#include "SGDebugVirtualHandSettings.generated.h" +#include "SGVirtualHandDebuggingSettings.generated.h" USTRUCT(BlueprintType) -struct SENSEGLOVESETTINGS_API FSGDebugVirtualHandSettings +struct SENSEGLOVESETTINGS_API FSGVirtualHandDebuggingSettings { GENERATED_USTRUCT_BODY() public: - UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Virtual Handg") - uint8 bDrawDebugVirtualHand : 1; + UPROPERTY(Config, EditDefaultsOnly, Category = "Debugging") + uint8 bDrawVirtualHandDebugging : 1; - UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Virtual Handg", - meta=(EditCondition="bDrawDebugVirtualHand", EditConditionHides)) + UPROPERTY(Config, EditDefaultsOnly, Category = "Debugging", + meta=(EditCondition="bDrawVirtualHandDebugging", EditConditionHides)) ESGDebugVirtualHandDrawingMode DrawingMode; - UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Virtual Handg", - meta=(EditCondition="bDrawDebugVirtualHand && DrawingMode == ESGDebugVirtualHandDrawingMode::CubicJoints", + UPROPERTY(Config, EditDefaultsOnly, Category = "Debugging", + meta=(EditCondition="bDrawVirtualHandDebugging && DrawingMode == ESGDebugVirtualHandDrawingMode::CubicJoints", EditConditionHides)) FVector CubeExtent; - UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Virtual Handg", - meta=(EditCondition="bDrawDebugVirtualHand && DrawingMode == ESGDebugVirtualHandDrawingMode::CubicJoints", + UPROPERTY(Config, EditDefaultsOnly, Category = "Debugging", + meta=(EditCondition="bDrawVirtualHandDebugging && DrawingMode == ESGDebugVirtualHandDrawingMode::CubicJoints", EditConditionHides)) FColor CubeColor; - UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Virtual Handg", - meta=(EditCondition="bDrawDebugVirtualHand && DrawingMode == ESGDebugVirtualHandDrawingMode::CubicJoints", + UPROPERTY(Config, EditDefaultsOnly, Category = "Debugging", + meta=(EditCondition="bDrawVirtualHandDebugging && DrawingMode == ESGDebugVirtualHandDrawingMode::CubicJoints", EditConditionHides)) float CubeThickness; - UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Virtual Handg", - meta=(EditCondition="bDrawDebugVirtualHand && DrawingMode == ESGDebugVirtualHandDrawingMode::GizmoJoints", + UPROPERTY(Config, EditDefaultsOnly, Category = "Debugging", + meta=(EditCondition="bDrawVirtualHandDebugging && DrawingMode == ESGDebugVirtualHandDrawingMode::GizmoJoints", EditConditionHides)) float GizmoLength; - UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Virtual Handg", - meta=(EditCondition="bDrawDebugVirtualHand && DrawingMode == ESGDebugVirtualHandDrawingMode::GizmoJoints", + UPROPERTY(Config, EditDefaultsOnly, Category = "Debugging", + meta=(EditCondition="bDrawVirtualHandDebugging && DrawingMode == ESGDebugVirtualHandDrawingMode::GizmoJoints", EditConditionHides)) float GizmoThickness; - UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Virtual Handg", - meta=(EditCondition="bDrawDebugVirtualHand && DrawingMode == ESGDebugVirtualHandDrawingMode::GizmoJoints", + UPROPERTY(Config, EditDefaultsOnly, Category = "Debugging", + meta=(EditCondition="bDrawVirtualHandDebugging && DrawingMode == ESGDebugVirtualHandDrawingMode::GizmoJoints", EditConditionHides)) FColor GizmoXAxisColor; - UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Virtual Handg", - meta=(EditCondition="bDrawDebugVirtualHand && DrawingMode == ESGDebugVirtualHandDrawingMode::GizmoJoints", + UPROPERTY(Config, EditDefaultsOnly, Category = "Debugging", + meta=(EditCondition="bDrawVirtualHandDebugging && DrawingMode == ESGDebugVirtualHandDrawingMode::GizmoJoints", EditConditionHides)) FColor GizmoYAxisColor; - UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Virtual Handg", - meta=(EditCondition="bDrawDebugVirtualHand && DrawingMode == ESGDebugVirtualHandDrawingMode::GizmoJoints", + UPROPERTY(Config, EditDefaultsOnly, Category = "Debugging", + meta=(EditCondition="bDrawVirtualHandDebugging && DrawingMode == ESGDebugVirtualHandDrawingMode::GizmoJoints", EditConditionHides)) FColor GizmoZAxisColor; - UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Virtual Handg", - meta=(EditCondition="bDrawDebugVirtualHand && DrawingMode == ESGDebugVirtualHandDrawingMode::GizmoJoints", + UPROPERTY(Config, EditDefaultsOnly, Category = "Debugging", + meta=(EditCondition="bDrawVirtualHandDebugging && DrawingMode == ESGDebugVirtualHandDrawingMode::GizmoJoints", EditConditionHides)) uint8 bPersistentLines : 1; - UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Virtual Handg", - meta=(EditCondition="bDrawDebugVirtualHand && DrawingMode == ESGDebugVirtualHandDrawingMode::GizmoJoints", + UPROPERTY(Config, EditDefaultsOnly, Category = "Debugging", + meta=(EditCondition="bDrawVirtualHandDebugging && DrawingMode == ESGDebugVirtualHandDrawingMode::GizmoJoints", EditConditionHides)) float LifeTimeModifier; - UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Virtual Handg", - meta=(EditCondition="bDrawDebugVirtualHand && DrawingMode == ESGDebugVirtualHandDrawingMode::GizmoJoints", + UPROPERTY(Config, EditDefaultsOnly, Category = "Debugging", + meta=(EditCondition="bDrawVirtualHandDebugging && DrawingMode == ESGDebugVirtualHandDrawingMode::GizmoJoints", EditConditionHides)) uint8 DepthPriority; public: - FSGDebugVirtualHandSettings(); + FSGVirtualHandDebuggingSettings(); - FSGDebugVirtualHandSettings( - bool bInDrawDebugVirtualHand, + FSGVirtualHandDebuggingSettings( + bool bInDrawVirtualHandDebugging, ESGDebugVirtualHandDrawingMode InDrawingMode, const FVector& InCubeExtent, const FColor& InCubeColor, diff --git a/Source/SenseGloveSettings/Public/SGSettings/SGVirtualHandGrabSettings.h b/Source/SenseGloveSettings/Public/SGSettings/SGVirtualHandGrabSettings.h new file mode 100644 index 00000000..eaa981da --- /dev/null +++ b/Source/SenseGloveSettings/Public/SGSettings/SGVirtualHandGrabSettings.h @@ -0,0 +1,78 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2024 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 "UObject/ObjectMacros.h" +#include "UObject/SoftObjectPtr.h" + +#include "SGVirtualHandGrabSettings.generated.h" + +class USkeletalMesh; + +/** +* Implements the hand tracking settings for the SenseGlove module. +*/ +USTRUCT(BlueprintType) +struct SENSEGLOVESETTINGS_API FSGVirtualHandGrabSettings +{ + GENERATED_USTRUCT_BODY() + +public: + UPROPERTY(Config, EditDefaultsOnly, Category="Grab") + FName PalmAttachPointSocketName; + + UPROPERTY(Config, EditDefaultsOnly, Category="Grab") + FVector DefaultColliderSize; + + UPROPERTY(Config, EditDefaultsOnly, Category="Grab") + FName ThumbColliderSocketName; + + UPROPERTY(Config, EditDefaultsOnly, Category="Grab") + FName IndexColliderSocketName; + + UPROPERTY(Config, EditDefaultsOnly, Category="Grab") + FName MiddleColliderSocketName; + +public: + FSGVirtualHandGrabSettings(); + + FSGVirtualHandGrabSettings( + const FName& InPalmAttachPointSocketName, + const FVector& InDefaultColliderSize, + const FName& InThumbColliderSocketName, + const FName& InIndexColliderSocketName, + const FName& InMiddleColliderSocketName); +}; \ No newline at end of file diff --git a/Source/SenseGloveSettings/Public/SGSettings/SGVirtualHandHapticsSettings.h b/Source/SenseGloveSettings/Public/SGSettings/SGVirtualHandHapticsSettings.h new file mode 100644 index 00000000..d3b03c16 --- /dev/null +++ b/Source/SenseGloveSettings/Public/SGSettings/SGVirtualHandHapticsSettings.h @@ -0,0 +1,62 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2024 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 "UObject/ObjectMacros.h" +#include "UObject/SoftObjectPtr.h" + +#include "SGVirtualHandHapticsSettings.generated.h" + +class USkeletalMesh; + +/** +* Implements the hand tracking settings for the SenseGlove module. +*/ +USTRUCT(BlueprintType) +struct SENSEGLOVESETTINGS_API FSGVirtualHandHapticsSettings +{ + GENERATED_USTRUCT_BODY() + +public: + UPROPERTY(Config, EditDefaultsOnly, Category="Haptics") + uint8 bAutoStopAllHapticsOnEndPlay : 1; + +public: + FSGVirtualHandHapticsSettings(); + + FSGVirtualHandHapticsSettings( + bool bInAutoStopAllHapticsOnEndPlay); +}; \ No newline at end of file diff --git a/Source/SenseGloveSettings/Public/SGSettings/SGVirtualHandMeshSettings.h b/Source/SenseGloveSettings/Public/SGSettings/SGVirtualHandMeshSettings.h new file mode 100644 index 00000000..ee27336d --- /dev/null +++ b/Source/SenseGloveSettings/Public/SGSettings/SGVirtualHandMeshSettings.h @@ -0,0 +1,88 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2024 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 "UObject/ObjectMacros.h" +#include "UObject/SoftObjectPtr.h" + +#include "SGSettings/SGVirtualHandPhalangesLengthSettings.h" + +#include "SGVirtualHandMeshSettings.generated.h" + +class USkeletalMesh; + +/** +* Implements the hand tracking settings for the SenseGlove module. +*/ +USTRUCT(BlueprintType) +struct SENSEGLOVESETTINGS_API FSGVirtualHandMeshSettings +{ + GENERATED_USTRUCT_BODY() + +public: + UPROPERTY(Config, EditDefaultsOnly, Category="Mesh") + TSoftObjectPtr LeftHandReferenceMesh; + + UPROPERTY(Config, EditDefaultsOnly, Category="Mesh") + TSoftObjectPtr RightHandReferenceMesh; + + UPROPERTY(Config, EditDefaultsOnly, Category="Mesh") + FSGVirtualHandPhalangesLengthSettings DistalPhalangesLengthSettings; + + UPROPERTY(Config, EditDefaultsOnly, Category="Mesh") + FRotator RootBoneRotationCorrection; + + UPROPERTY(Config, VisibleDefaultsOnly, Category="Mesh") + TMap LeftHandDefaultReferenceBoneTransforms; + + UPROPERTY(Config, VisibleDefaultsOnly, Category="Mesh") + TMap RightHandDefaultReferenceBoneTransforms; + + UPROPERTY(Config, VisibleDefaultsOnly, Category="Mesh") + TArray LeftHandBoneNames; + + UPROPERTY(Config, VisibleDefaultsOnly, Category="Mesh") + TArray RightHandBoneNames; + +public: + FSGVirtualHandMeshSettings(); + + FSGVirtualHandMeshSettings( + const TSoftObjectPtr& InLeftHandReferenceMesh, + const TSoftObjectPtr& InRightHandReferenceMesh, + const FSGVirtualHandPhalangesLengthSettings& InDistalPhalangesLengthSettings, + const FRotator& InRootBoneRotationCorrection); +}; \ No newline at end of file diff --git a/Source/SenseGloveSettings/Public/SGSettings/SGVirtualHandPhalangesLengthSettings.h b/Source/SenseGloveSettings/Public/SGSettings/SGVirtualHandPhalangesLengthSettings.h new file mode 100644 index 00000000..39f6d6c7 --- /dev/null +++ b/Source/SenseGloveSettings/Public/SGSettings/SGVirtualHandPhalangesLengthSettings.h @@ -0,0 +1,78 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2024 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 "UObject/ObjectMacros.h" +#include "UObject/SoftObjectPtr.h" + +#include "SGVirtualHandPhalangesLengthSettings.generated.h" + +class USkeletalMesh; + +/** +* Implements the hand tracking settings for the SenseGlove module. +*/ +USTRUCT(BlueprintType) +struct SENSEGLOVESETTINGS_API FSGVirtualHandPhalangesLengthSettings +{ + GENERATED_USTRUCT_BODY() + +public: + UPROPERTY(Config, EditDefaultsOnly, Category="Phalanges Length") + float Thumb; + + UPROPERTY(Config, EditDefaultsOnly, Category="Phalanges Length") + float Index; + + UPROPERTY(Config, EditDefaultsOnly, Category="Phalanges Length") + float Middle; + + UPROPERTY(Config, EditDefaultsOnly, Category="Phalanges Length") + float Ring; + + UPROPERTY(Config, EditDefaultsOnly, Category="Phalanges Length") + float Little; + +public: + FSGVirtualHandPhalangesLengthSettings(); + + FSGVirtualHandPhalangesLengthSettings( + float InThumb, + float InIndex, + float InMiddle, + float InRing, + float InLittle); +}; \ No newline at end of file diff --git a/Source/SenseGloveSettings/Public/SGSettings/SGVirtualHandSettings.h b/Source/SenseGloveSettings/Public/SGSettings/SGVirtualHandSettings.h index 5210d7e7..e5737d3f 100644 --- a/Source/SenseGloveSettings/Public/SGSettings/SGVirtualHandSettings.h +++ b/Source/SenseGloveSettings/Public/SGSettings/SGVirtualHandSettings.h @@ -38,6 +38,13 @@ #include "UObject/ObjectMacros.h" #include "UObject/SoftObjectPtr.h" +#include "SGSettings/SGVirtualHandAnimationSettings.h" +#include "SGSettings/SGVirtualHandDebuggingSettings.h" +#include "SGSettings/SGVirtualHandGrabSettings.h" +#include "SGSettings/SGVirtualHandHapticsSettings.h" +#include "SGSettings/SGVirtualHandMeshSettings.h" +#include "SGSettings/SGVirtualHandTouchSettings.h" + #include "SGVirtualHandSettings.generated.h" class USkeletalMesh; @@ -52,51 +59,31 @@ struct SENSEGLOVESETTINGS_API FSGVirtualHandSettings public: UPROPERTY(Config, EditDefaultsOnly, Category="Virtual Hand") - TSoftObjectPtr LeftHandReferenceMesh; + FSGVirtualHandAnimationSettings AnimationSettings; UPROPERTY(Config, EditDefaultsOnly, Category="Virtual Hand") - TSoftObjectPtr RightHandReferenceMesh; + FSGVirtualHandDebuggingSettings DebuggingSettings; UPROPERTY(Config, EditDefaultsOnly, Category="Virtual Hand") - float ThumbDistalPhalanxLength; + FSGVirtualHandGrabSettings GrabSettings; UPROPERTY(Config, EditDefaultsOnly, Category="Virtual Hand") - float IndexDistalPhalanxLength; + FSGVirtualHandHapticsSettings HapticsSettings; UPROPERTY(Config, EditDefaultsOnly, Category="Virtual Hand") - float MiddleDistalPhalanxLength; + FSGVirtualHandMeshSettings MeshSettings; UPROPERTY(Config, EditDefaultsOnly, Category="Virtual Hand") - float RingDistalPhalanxLength; - - UPROPERTY(Config, EditDefaultsOnly, Category="Virtual Hand") - float LittleDistalPhalanxLength; - - UPROPERTY(Config, EditDefaultsOnly, Category="Virtual Hand") - FRotator RootBoneRotationCorrection; - - UPROPERTY(Config, VisibleDefaultsOnly, Category="Virtual Hand") - TMap LeftHandDefaultReferenceBoneTransforms; - - UPROPERTY(Config, VisibleDefaultsOnly, Category="Virtual Hand") - TMap RightHandDefaultReferenceBoneTransforms; - - UPROPERTY(Config, VisibleDefaultsOnly, Category="Virtual Hand") - TArray LeftHandBoneNames; - - UPROPERTY(Config, VisibleDefaultsOnly, Category="Virtual Hand") - TArray RightHandBoneNames; + FSGVirtualHandTouchSettings TouchSettings; public: FSGVirtualHandSettings(); FSGVirtualHandSettings( - const TSoftObjectPtr& InLeftHandReferenceMesh, - const TSoftObjectPtr& InRightHandReferenceMesh, - float InThumbDistalPhalanxLength, - float InIndexDistalPhalanxLength, - float InMiddleDistalPhalanxLength, - float InRingDistalPhalanxLength, - float InLittleDistalPhalanxLength, - const FRotator& InRootBoneRotationCorrection); + const FSGVirtualHandAnimationSettings& InAnimationSettings, + const FSGVirtualHandDebuggingSettings& InDebuggingSettings, + const FSGVirtualHandGrabSettings& InGrabSettings, + const FSGVirtualHandHapticsSettings& InHapticsSettings, + const FSGVirtualHandMeshSettings& InMeshSettings, + const FSGVirtualHandTouchSettings& InTouchSettings); }; \ No newline at end of file diff --git a/Source/SenseGloveSettings/Public/SGSettings/SGVirtualHandTouchSettings.h b/Source/SenseGloveSettings/Public/SGSettings/SGVirtualHandTouchSettings.h new file mode 100644 index 00000000..f7e42210 --- /dev/null +++ b/Source/SenseGloveSettings/Public/SGSettings/SGVirtualHandTouchSettings.h @@ -0,0 +1,82 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2024 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 "UObject/ObjectMacros.h" +#include "UObject/SoftObjectPtr.h" + +#include "SGVirtualHandTouchSettings.generated.h" + +class USkeletalMesh; + +/** +* Implements the hand tracking settings for the SenseGlove module. +*/ +USTRUCT(BlueprintType) +struct SENSEGLOVESETTINGS_API FSGVirtualHandTouchSettings +{ + GENERATED_USTRUCT_BODY() + +public: + UPROPERTY(Config, EditDefaultsOnly, Category="Touch") + FVector DefaultColliderSize; + + UPROPERTY(Config, EditDefaultsOnly, Category="Touch") + FName ThumbColliderSocketName; + + UPROPERTY(Config, EditDefaultsOnly, Category="Touch") + FName IndexColliderSocketName; + + UPROPERTY(Config, EditDefaultsOnly, Category="Touch") + FName MiddleColliderSocketName; + + UPROPERTY(Config, EditDefaultsOnly, Category="Touch") + FName RingColliderSocketName; + + UPROPERTY(Config, EditDefaultsOnly, Category="Touch") + FName PinkyColliderSocketName; + +public: + FSGVirtualHandTouchSettings(); + + FSGVirtualHandTouchSettings( + const FVector& InDefaultColliderSize, + const FName& InThumbColliderSocketName, + const FName& InIndexColliderSocketName, + const FName& InMiddleColliderSocketName, + const FName& InRingColliderSocketName, + const FName& InPinkyColliderSocketName); +}; \ No newline at end of file diff --git a/Source/SenseGloveTracking/Private/SGTracking/SGXRTracker.cpp b/Source/SenseGloveTracking/Private/SGTracking/SGXRTracker.cpp index 5a23f0f0..73009128 100644 --- a/Source/SenseGloveTracking/Private/SGTracking/SGXRTracker.cpp +++ b/Source/SenseGloveTracking/Private/SGTracking/SGXRTracker.cpp @@ -403,7 +403,7 @@ struct FSGXRTracker::FImpl FORCEINLINE static const FName& GetLeftMeshBoneName(const int32 JointIndex) { - const FName& Name{GetVirtualHandSettings().LeftHandBoneNames[JointIndex]}; + const FName& Name{GetVirtualHandSettings().MeshSettings.LeftHandBoneNames[JointIndex]}; return Name; } @@ -416,7 +416,7 @@ struct FSGXRTracker::FImpl FORCEINLINE static const FName& GetRightMeshBoneName(const int32 JointIndex) { - const FName& Name{GetVirtualHandSettings().RightHandBoneNames[JointIndex]}; + const FName& Name{GetVirtualHandSettings().MeshSettings.RightHandBoneNames[JointIndex]}; return Name; } @@ -771,27 +771,27 @@ TArray> FSGXRTracker::FImpl::GetFingerLengths(const bool bRight) GetFingerLengths(bRight, EHandKeypoint::ThumbProximal, EHandKeypoint::ThumbDistal, - Settings.ThumbDistalPhalanxLength + Settings.MeshSettings.DistalPhalangesLengthSettings.Thumb ), GetFingerLengths(bRight, EHandKeypoint::IndexIntermediate, EHandKeypoint::IndexDistal, - Settings.IndexDistalPhalanxLength + Settings.MeshSettings.DistalPhalangesLengthSettings.Index ), GetFingerLengths(bRight, EHandKeypoint::MiddleIntermediate, EHandKeypoint::MiddleDistal, - Settings.MiddleDistalPhalanxLength + Settings.MeshSettings.DistalPhalangesLengthSettings.Middle ), GetFingerLengths(bRight, EHandKeypoint::RingIntermediate, EHandKeypoint::RingDistal, - Settings.RingDistalPhalanxLength + Settings.MeshSettings.DistalPhalangesLengthSettings.Ring ), GetFingerLengths(bRight, EHandKeypoint::LittleIntermediate, EHandKeypoint::LittleDistal, - Settings.LittleDistalPhalanxLength + Settings.MeshSettings.DistalPhalangesLengthSettings.Little ), }; @@ -901,8 +901,8 @@ FTransform FSGXRTracker::FImpl::GetMeshRawBoneRefTransform(const bool bRight, co { const TSoftObjectPtr& HandMesh{ bRight - ? GetVirtualHandSettings().LeftHandReferenceMesh - : GetVirtualHandSettings().RightHandReferenceMesh + ? GetVirtualHandSettings().MeshSettings.LeftHandReferenceMesh + : GetVirtualHandSettings().MeshSettings.RightHandReferenceMesh }; if (HandMesh.IsValid()) @@ -924,7 +924,7 @@ FTransform FSGXRTracker::FImpl::GetMeshRawBoneRefTransform(const bool bRight, co return Transform; } - const FSGVirtualHandSettings& Settings{GetVirtualHandSettings()}; + const FSGVirtualHandMeshSettings& Settings{GetVirtualHandSettings().MeshSettings}; ensureAlwaysMsgf( bRight ? Settings.RightHandDefaultReferenceBoneTransforms.Contains(BoneName) @@ -942,7 +942,7 @@ FTransform FSGXRTracker::FImpl::GetMeshRawBoneRefTransform(const bool bRight, co FTransform FSGXRTracker::FImpl::GetMeshWristChildBoneRefTransform(const bool bRight, const FName& BoneName) { FQuat RootRotationCorrection{ - GetVirtualHandSettings().RootBoneRotationCorrection + GetVirtualHandSettings().MeshSettings.RootBoneRotationCorrection }; const FTransform& RootBoneRefTransform{GetMeshRawBoneRefTransform(bRight, EHandKeypoint::Wrist)}; const FTransform& RawTransform{GetMeshRawBoneRefTransform(bRight, BoneName)}; @@ -957,7 +957,7 @@ FTransform FSGXRTracker::FImpl::GetMeshFingerStartBoneRefTransform( const bool bRight, const EHandKeypoint Parent, const FName& BoneName) { FQuat RootRotationCorrection{ - GetVirtualHandSettings().RootBoneRotationCorrection + GetVirtualHandSettings().MeshSettings.RootBoneRotationCorrection }; const FTransform& RootBoneRefTransform{GetMeshRawBoneRefTransform(bRight, EHandKeypoint::Wrist)}; FQuat CorrectedRootBoneRefRotation{MoveTemp(RootRotationCorrection) * RootBoneRefTransform.GetRotation()};