diff --git a/Source/SenseGlove/Private/SenseGlove/Components/SGWristTrackerComponent.cpp b/Source/SenseGlove/Private/SenseGlove/Components/SGWristTrackerComponent.cpp index c77ee808..4cf8bb1c 100644 --- a/Source/SenseGlove/Private/SenseGlove/Components/SGWristTrackerComponent.cpp +++ b/Source/SenseGlove/Private/SenseGlove/Components/SGWristTrackerComponent.cpp @@ -47,14 +47,10 @@ struct USGWristTrackerComponent::FImpl * Static methods ************************/ - static FName ParseWristTrackingSettingsOverridesPropertyName(const FName& PropertyName); - /************************ * Member variables ************************/ - bool bMotionSourcePropertyModified; - /************************ * Owner object ************************/ @@ -81,9 +77,6 @@ struct USGWristTrackerComponent::FImpl bool IsEditor() const; - void OverridePluginSettingsPropertyChanged(); - void MotionSourcePropertyChanged(); - void UpdateMotionSource() const; void UpdateWristTrackingData() const; void DrawDebugGizmo() const; @@ -113,25 +106,6 @@ USGWristTrackerComponent::USGWristTrackerComponent(const FObjectInitializer& Obj WristRotation = FRotator::ZeroRotator; } -FName USGWristTrackerComponent::FImpl::ParseWristTrackingSettingsOverridesPropertyName(const FName& PropertyName) -{ - static const UStruct* Struct{FSGWristTrackingSettingsOverrides::StaticStruct()}; - if (!ensureAlwaysMsgf(Struct, TEXT("Invalid Struct!"))) - { - return NAME_None; - } - - // +3 because of :: - static const int32 StructNameLength = Struct->GetFName().ToString().Len() + 3; - - const FString PropertyString{PropertyName.ToString()}; - const int32 PropertyStringLength = PropertyString.Len(); - const int32 PropertyNameLength = PropertyStringLength - StructNameLength; - - const FName ParsedName{*PropertyString.Right(PropertyNameLength)}; - return ParsedName; -} - void USGWristTrackerComponent::SetRight(const bool bInRight) { bRight = bInRight; @@ -158,23 +132,14 @@ FSGWristTrackingSettings USGWristTrackerComponent::GetWristTrackingSettings() co return PluginWristTrackingSettings; } - const EControllerHand LeftMotionSource = - IsLeft() - ? WristTrackingSettingsOverrides.MotionSource - : PluginWristTrackingSettings.LeftHandMotionSource; - const EControllerHand RightMotionSource = - IsRight() - ? WristTrackingSettingsOverrides.MotionSource - : PluginWristTrackingSettings.RightHandMotionSource; - const FSGWristTrackingSettings WristTrackingSettings{ PluginWristTrackingSettings.TrackingHardware, PluginWristTrackingSettings.TrackingHardwareLocationOffsetLeftHand, PluginWristTrackingSettings.TrackingHardwareLocationOffsetRightHand, PluginWristTrackingSettings.TrackingHardwareRotationOffsetLeftHand, PluginWristTrackingSettings.TrackingHardwareRotationOffsetRightHand, - LeftMotionSource, - RightMotionSource, + PluginWristTrackingSettings.LeftHandMotionSource, + PluginWristTrackingSettings.RightHandMotionSource, !!WristTrackingSettingsOverrides.bDrawDebugGizmo, WristTrackingSettingsOverrides.DebugGizmoSettings, }; @@ -192,28 +157,7 @@ void USGWristTrackerComponent::PostEditChangeProperty(FPropertyChangedEvent& Pro : NAME_None }; - static const FName OverridePluginSettingsName{ - FImpl::ParseWristTrackingSettingsOverridesPropertyName( - GET_MEMBER_NAME_CHECKED(FSGWristTrackingSettingsOverrides, - FSGWristTrackingSettingsOverrides::bOverridePluginSettings)) - }; - static const FName MotionSourceUPropertyName{ - FImpl::ParseWristTrackingSettingsOverridesPropertyName( - GET_MEMBER_NAME_CHECKED(FSGWristTrackingSettingsOverrides, - FSGWristTrackingSettingsOverrides::MotionSource)) - }; - - if (PropertyName == OverridePluginSettingsName) - { - Pimpl->OverridePluginSettingsPropertyChanged(); - return; - } - - if (PropertyName == MotionSourceUPropertyName) - { - Pimpl->MotionSourcePropertyChanged(); - return; - } + (void) PropertyName; } #endif /* WITH_EDITOR */ @@ -279,8 +223,7 @@ bool USGWristTrackerComponent::GetMotionControllerData(FXRMotionControllerData& } USGWristTrackerComponent::FImpl::FImpl(USGWristTrackerComponent* InOwner) - : bMotionSourcePropertyModified(false), - Owner(InOwner) + : Owner(InOwner) { } @@ -297,40 +240,6 @@ bool USGWristTrackerComponent::FImpl::IsEditor() const return false; } -void USGWristTrackerComponent::FImpl::OverridePluginSettingsPropertyChanged() -{ - if (bMotionSourcePropertyModified) - { - return; - } - - const USGSettings* Settings{USGSettings::GetInstance()}; - if (IsValid(Settings)) - { - const FSGWristTrackingSettings& PluginWristTrackingSettings{ - Settings->GetTrackingSettings().WristTrackingSettings - }; - Owner->WristTrackingSettingsOverrides.MotionSource = - Owner->IsRight() - ? PluginWristTrackingSettings.RightHandMotionSource - : PluginWristTrackingSettings.LeftHandMotionSource; - } - else - { - Owner->WristTrackingSettingsOverrides.MotionSource = - Owner->IsRight() ? EControllerHand::Right : EControllerHand::Left; - } -} - -void USGWristTrackerComponent::FImpl::MotionSourcePropertyChanged() -{ - if (bMotionSourcePropertyModified) - { - return; - } - bMotionSourcePropertyModified = true; -} - void USGWristTrackerComponent::FImpl::UpdateMotionSource() const { if (GEngine) diff --git a/Source/SenseGloveSettings/Private/SGSettings/SGWristTrackingSettingsOverrides.cpp b/Source/SenseGloveSettings/Private/SGSettings/SGWristTrackingSettingsOverrides.cpp index bb554de4..0d5d819f 100644 --- a/Source/SenseGloveSettings/Private/SGSettings/SGWristTrackingSettingsOverrides.cpp +++ b/Source/SenseGloveSettings/Private/SGSettings/SGWristTrackingSettingsOverrides.cpp @@ -38,7 +38,6 @@ FSGWristTrackingSettingsOverrides::FSGWristTrackingSettingsOverrides() : FSGWristTrackingSettingsOverrides{ false, - EControllerHand::AnyHand, false, FSGDebugGizmoSettings{} } @@ -47,11 +46,9 @@ FSGWristTrackingSettingsOverrides::FSGWristTrackingSettingsOverrides() FSGWristTrackingSettingsOverrides::FSGWristTrackingSettingsOverrides( const bool bInOverridePluginSettings, - const EControllerHand InMotionSource, const bool bInDrawDebugGizmo, const FSGDebugGizmoSettings& InDebugGizmoSettings) : bOverridePluginSettings(bInOverridePluginSettings), - MotionSource(InMotionSource), bDrawDebugGizmo(bInDrawDebugGizmo), DebugGizmoSettings{InDebugGizmoSettings} { diff --git a/Source/SenseGloveSettings/Public/SGSettings/SGWristTrackingSettingsOverrides.h b/Source/SenseGloveSettings/Public/SGSettings/SGWristTrackingSettingsOverrides.h index c3814f03..6ad8a397 100644 --- a/Source/SenseGloveSettings/Public/SGSettings/SGWristTrackingSettingsOverrides.h +++ b/Source/SenseGloveSettings/Public/SGSettings/SGWristTrackingSettingsOverrides.h @@ -55,14 +55,6 @@ public: UPROPERTY(EditAnywhere, Category = "SenseGlove") uint8 bOverridePluginSettings : 1; - /** - * Determines which motion source to use. - * For Oculus this is usually Left/Right, and for VIVE usually LeftFoot/RightFoot. - */ - UPROPERTY(EditAnywhere, Category = "SenseGlove", - meta=(EditCondition="bOverridePluginSettings", EditConditionHides)) - EControllerHand MotionSource; - /** * If enabled, draws debug Wrist trackers where possible. */ @@ -82,7 +74,6 @@ public: FSGWristTrackingSettingsOverrides( bool bInOverridePluginSettings, - EControllerHand InMotionSource, bool bInDrawDebugGizmo, const FSGDebugGizmoSettings& InDebugGizmoSettings); }; \ No newline at end of file