From 003e1cf34ee4eb09d0b8402778fcc9a3146aa42d Mon Sep 17 00:00:00 2001 From: Mamadou Babaei Date: Fri, 14 Jun 2024 09:37:53 +0200 Subject: [PATCH] remove the experimental bHandTrackingVisualizationAllowed feature --- .../Components/SGWristTrackerComponent.cpp | 17 ------- .../SenseGlove/GameFramework/SGPawn.cpp | 48 ------------------- .../Components/SGWristTrackerComponent.h | 16 ------- .../SGWristTrackerComponentKismetLibrary.cpp | 6 --- .../SGWristTrackerComponentKismetLibrary.h | 3 -- .../SGSettings/SGWristTrackingSettings.cpp | 5 +- .../SGSettings/SGWristTrackingSettings.h | 4 -- 7 files changed, 1 insertion(+), 98 deletions(-) diff --git a/Source/SenseGlove/Private/SenseGlove/Components/SGWristTrackerComponent.cpp b/Source/SenseGlove/Private/SenseGlove/Components/SGWristTrackerComponent.cpp index 763f9a72..8fae43ca 100644 --- a/Source/SenseGlove/Private/SenseGlove/Components/SGWristTrackerComponent.cpp +++ b/Source/SenseGlove/Private/SenseGlove/Components/SGWristTrackerComponent.cpp @@ -97,7 +97,6 @@ USGWristTrackerComponent::USGWristTrackerComponent(const FObjectInitializer& Obj bRight = true; - DeviceVisualType = EXRVisualType::Controller; WristLocation = FVector::ZeroVector; WristRotation = FRotator::ZeroRotator; } @@ -228,22 +227,6 @@ void USGWristTrackerComponent::FImpl::UpdateMotionSource() const void USGWristTrackerComponent::FImpl::UpdateWristTrackingData() const { - FXRMotionControllerData MotionControllerData; - const bool bGotMotionControllerData = Owner->GetMotionControllerData(MotionControllerData); - if (bGotMotionControllerData && MotionControllerData.bValid) - { - const bool bDeviceVisualTypeUpdated = Owner->DeviceVisualType != MotionControllerData.DeviceVisualType; - if (bDeviceVisualTypeUpdated) - { - Owner->DeviceVisualType = MotionControllerData.DeviceVisualType; - - if (Owner->WristDeviceVisualTypeChangedEvent.IsBound()) - { - Owner->WristDeviceVisualTypeChangedEvent.Broadcast(Owner->DeviceVisualType); - } - } - } - FVector NewWristLocation{Owner->GetComponentLocation()}; FRotator NewWristRotation{Owner->GetComponentRotation()}; diff --git a/Source/SenseGlove/Private/SenseGlove/GameFramework/SGPawn.cpp b/Source/SenseGlove/Private/SenseGlove/GameFramework/SGPawn.cpp index 1449d7f7..15156756 100644 --- a/Source/SenseGlove/Private/SenseGlove/GameFramework/SGPawn.cpp +++ b/Source/SenseGlove/Private/SenseGlove/GameFramework/SGPawn.cpp @@ -91,18 +91,6 @@ struct ASGPawn::FImpl void SetVisibility(USceneComponent* SceneComponent, const bool bVisibility) const; - void UpdateWristTrackerVisualization(const bool bRight, const EXRVisualType VisualType) const; - - FORCEINLINE void UpdateLeftWristTrackerVisualization(const EXRVisualType VisualType) const - { - UpdateWristTrackerVisualization(false, VisualType); - } - - FORCEINLINE void UpdateRightWristTrackerVisualization(const EXRVisualType VisualType) const - { - UpdateWristTrackerVisualization(true, VisualType); - } - void UpdateHandLocation(const bool bRight, const FVector& Location, const bool bUpdateVirtualHand) const; void UpdateLeftHandLocation(const FVector& Location, const bool bUpdateVirtualHand) const; void UpdateRightHandLocation(const FVector& Location, const bool bUpdateVirtualHand) const; @@ -546,18 +534,6 @@ void ASGPawn::BeginPlay() WristTrackerRight->IsRight() && HandRight->IsRight(), TEXT("The right hand and the right wrist do not track the right hand!")); - WristTrackerLeft->OnWristDeviceVisualTypeChanged().AddWeakLambda( - this, [&](const EXRVisualType VisualType) -> void - { - Pimpl->UpdateLeftWristTrackerVisualization(VisualType); - }); - - WristTrackerLeft->OnWristDeviceVisualTypeChanged().AddWeakLambda( - this, [&](const EXRVisualType VisualType) -> void - { - Pimpl->UpdateRightWristTrackerVisualization(VisualType); - }); - WristTrackerLeft->OnWristLocationChanged().AddWeakLambda(this, [&](const FVector& Location)-> void { Pimpl->UpdateLeftHandLocation(Location, !Pimpl->IsLeftHandOverlappingWithAnyActor()); @@ -1675,30 +1651,6 @@ void ASGPawn::FImpl::SetVisibility(USceneComponent* SceneComponent, const bool b SceneComponent->SetVisibility(bVisibility); } -void ASGPawn::FImpl::UpdateWristTrackerVisualization(const bool bRight, const EXRVisualType VisualType) const -{ - const USGWristTrackerComponent* WristTracker{bRight ? Owner->WristTrackerRight : Owner->WristTrackerLeft}; - if (!IsValid(WristTracker)) - { - return; - } - - const FSGWristTrackingSettings& Settings{WristTracker->GetWristTrackingSettings()}; - const bool bIsVisualizationActive = VisualType == EXRVisualType::Controller - || !!Settings.bHandTrackingVisualizationAllowed; - - UXRDeviceVisualizationComponent* ControllerVisualizer{ - bRight ? Owner->ControllerVisualizerLeft : Owner->ControllerVisualizerRight - }; - - if (!IsValid(ControllerVisualizer)) - { - return; - } - - ControllerVisualizer->SetIsVisualizationActive(bIsVisualizationActive); -} - void ASGPawn::FImpl::UpdateHandLocation(const bool bRight, const FVector& Location, const bool bUpdateVirtualHand) const { if (bRight) diff --git a/Source/SenseGlove/Public/SenseGlove/Components/SGWristTrackerComponent.h b/Source/SenseGlove/Public/SenseGlove/Components/SGWristTrackerComponent.h index 85acfdb0..6c7846a7 100644 --- a/Source/SenseGlove/Public/SenseGlove/Components/SGWristTrackerComponent.h +++ b/Source/SenseGlove/Public/SenseGlove/Components/SGWristTrackerComponent.h @@ -52,13 +52,6 @@ class SENSEGLOVE_API USGWristTrackerComponent : public UMotionControllerComponen GENERATED_UCLASS_BODY() public: - DECLARE_EVENT_OneParam(USGWristTrackerComponent, FWristDeviceVisualTypeChangedEvent, EXRVisualType) - - FWristDeviceVisualTypeChangedEvent& OnWristDeviceVisualTypeChanged() - { - return WristDeviceVisualTypeChangedEvent; - }; - DECLARE_EVENT_OneParam(USGWristTrackerComponent, FWristLocationChangedEvent, const FVector&) FWristLocationChangedEvent& OnWristLocationChanged() @@ -82,7 +75,6 @@ public: }; private: - FWristDeviceVisualTypeChangedEvent WristDeviceVisualTypeChangedEvent; FWristLocationChangedEvent WristLocationChangedEvent; FWristRotationChangedEvent WristRotationChangedEvent; FWristLocationAndRotationChangedEvent WristLocationAndRotationChangedEvent; @@ -103,9 +95,6 @@ private: uint8 bRight : 1; private: - UPROPERTY(Transient) - EXRVisualType DeviceVisualType; - UPROPERTY(Transient) FVector WristLocation; @@ -127,11 +116,6 @@ public: const FSGWristTrackingSettings& GetWristTrackingSettings() const; - FORCEINLINE EXRVisualType GetDeviceVisualType() const - { - return DeviceVisualType; - } - FORCEINLINE const FVector& GetWristLocation() const { return WristLocation; diff --git a/Source/SenseGloveKismet/Private/SGKismet/SGWristTrackerComponentKismetLibrary.cpp b/Source/SenseGloveKismet/Private/SGKismet/SGWristTrackerComponentKismetLibrary.cpp index e60a830d..ec07e46e 100644 --- a/Source/SenseGloveKismet/Private/SGKismet/SGWristTrackerComponentKismetLibrary.cpp +++ b/Source/SenseGloveKismet/Private/SGKismet/SGWristTrackerComponentKismetLibrary.cpp @@ -59,12 +59,6 @@ void UWristTrackerComponentKismetLibrary::SetRight( WristTrackerComponent->SetRight(bInRight); } -EXRVisualType UWristTrackerComponentKismetLibrary::GetDeviceVisualType( - const USGWristTrackerComponent* WristTrackerComponent) -{ - return WristTrackerComponent->GetDeviceVisualType(); -} - const FVector& UWristTrackerComponentKismetLibrary::GetWristLocation( const USGWristTrackerComponent* WristTrackerComponent) { diff --git a/Source/SenseGloveKismet/Public/SGKismet/SGWristTrackerComponentKismetLibrary.h b/Source/SenseGloveKismet/Public/SGKismet/SGWristTrackerComponentKismetLibrary.h index 7714a036..e8e1deaa 100644 --- a/Source/SenseGloveKismet/Public/SGKismet/SGWristTrackerComponentKismetLibrary.h +++ b/Source/SenseGloveKismet/Public/SGKismet/SGWristTrackerComponentKismetLibrary.h @@ -65,9 +65,6 @@ public: UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Wrist Tracker Component") static void SetRight(UPARAM(ref) USGWristTrackerComponent* WristTrackerComponent, bool bInRight); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Wrist Tracker Component") - static EXRVisualType GetDeviceVisualType(const USGWristTrackerComponent* WristTrackerComponent); - UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Wrist Tracker Component") static const FVector& GetWristLocation(const USGWristTrackerComponent* WristTrackerComponent); diff --git a/Source/SenseGloveSettings/Private/SGSettings/SGWristTrackingSettings.cpp b/Source/SenseGloveSettings/Private/SGSettings/SGWristTrackingSettings.cpp index 5434e416..517f6fc6 100644 --- a/Source/SenseGloveSettings/Private/SGSettings/SGWristTrackingSettings.cpp +++ b/Source/SenseGloveSettings/Private/SGSettings/SGWristTrackingSettings.cpp @@ -37,7 +37,6 @@ FSGWristTrackingSettings::FSGWristTrackingSettings() : FSGWristTrackingSettings( - false, ESGPositionalTrackingHardware::None, FVector::ZeroVector, FVector::ZeroVector, @@ -51,7 +50,6 @@ FSGWristTrackingSettings::FSGWristTrackingSettings() } FSGWristTrackingSettings::FSGWristTrackingSettings( - const bool bInHandTrackingVisualizationAllowed, const ESGPositionalTrackingHardware InTrackingHardware, const FVector& InTrackingHardwareLocationOffsetLeftHand, const FVector& InTrackingHardwareLocationOffsetRightHand, @@ -61,8 +59,7 @@ FSGWristTrackingSettings::FSGWristTrackingSettings( const EControllerHand InRightHandMotionSource, const bool bInDrawDebugGizmo, const FSGDebugGizmoSettings& InDebugGizmoSettings) - : bHandTrackingVisualizationAllowed(bInHandTrackingVisualizationAllowed), - TrackingHardware(InTrackingHardware), + : TrackingHardware(InTrackingHardware), TrackingHardwareLocationOffsetLeftHand(InTrackingHardwareLocationOffsetLeftHand), TrackingHardwareLocationOffsetRightHand(InTrackingHardwareLocationOffsetRightHand), TrackingHardwareRotationOffsetLeftHand(InTrackingHardwareRotationOffsetLeftHand), diff --git a/Source/SenseGloveSettings/Public/SGSettings/SGWristTrackingSettings.h b/Source/SenseGloveSettings/Public/SGSettings/SGWristTrackingSettings.h index a3037507..af9aa0d5 100644 --- a/Source/SenseGloveSettings/Public/SGSettings/SGWristTrackingSettings.h +++ b/Source/SenseGloveSettings/Public/SGSettings/SGWristTrackingSettings.h @@ -49,9 +49,6 @@ struct SENSEGLOVESETTINGS_API FSGWristTrackingSettings GENERATED_USTRUCT_BODY() public: - UPROPERTY(Config, EditDefaultsOnly, Category = "Wrist Tracking") - uint8 bHandTrackingVisualizationAllowed : 1; - /** * If set to Custom, any desired location and rotation can be specified. */ @@ -117,7 +114,6 @@ public: FSGWristTrackingSettings(); FSGWristTrackingSettings( - bool bInHandTrackingVisualizationAllowed, ESGPositionalTrackingHardware InTrackingHardware, const FVector& InTrackingHardwareLocationOffsetLeftHand, const FVector& InTrackingHardwareLocationOffsetRightHand,