remove the motion source wrist tracking overrides from the wrist tracker component due to the fact that it's utilized only inside the underlying tracking module and overriding it has no effects

This commit is contained in:
Mamadou Babaei
2024-08-16 18:02:09 +02:00
parent 87519b9fa1
commit 4f69156d77
3 changed files with 4 additions and 107 deletions
@@ -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)
@@ -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}
{
@@ -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);
};