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 methods
************************/ ************************/
static FName ParseWristTrackingSettingsOverridesPropertyName(const FName& PropertyName);
/************************ /************************
* Member variables * Member variables
************************/ ************************/
bool bMotionSourcePropertyModified;
/************************ /************************
* Owner object * Owner object
************************/ ************************/
@@ -81,9 +77,6 @@ struct USGWristTrackerComponent::FImpl
bool IsEditor() const; bool IsEditor() const;
void OverridePluginSettingsPropertyChanged();
void MotionSourcePropertyChanged();
void UpdateMotionSource() const; void UpdateMotionSource() const;
void UpdateWristTrackingData() const; void UpdateWristTrackingData() const;
void DrawDebugGizmo() const; void DrawDebugGizmo() const;
@@ -113,25 +106,6 @@ USGWristTrackerComponent::USGWristTrackerComponent(const FObjectInitializer& Obj
WristRotation = FRotator::ZeroRotator; 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) void USGWristTrackerComponent::SetRight(const bool bInRight)
{ {
bRight = bInRight; bRight = bInRight;
@@ -158,23 +132,14 @@ FSGWristTrackingSettings USGWristTrackerComponent::GetWristTrackingSettings() co
return PluginWristTrackingSettings; return PluginWristTrackingSettings;
} }
const EControllerHand LeftMotionSource =
IsLeft()
? WristTrackingSettingsOverrides.MotionSource
: PluginWristTrackingSettings.LeftHandMotionSource;
const EControllerHand RightMotionSource =
IsRight()
? WristTrackingSettingsOverrides.MotionSource
: PluginWristTrackingSettings.RightHandMotionSource;
const FSGWristTrackingSettings WristTrackingSettings{ const FSGWristTrackingSettings WristTrackingSettings{
PluginWristTrackingSettings.TrackingHardware, PluginWristTrackingSettings.TrackingHardware,
PluginWristTrackingSettings.TrackingHardwareLocationOffsetLeftHand, PluginWristTrackingSettings.TrackingHardwareLocationOffsetLeftHand,
PluginWristTrackingSettings.TrackingHardwareLocationOffsetRightHand, PluginWristTrackingSettings.TrackingHardwareLocationOffsetRightHand,
PluginWristTrackingSettings.TrackingHardwareRotationOffsetLeftHand, PluginWristTrackingSettings.TrackingHardwareRotationOffsetLeftHand,
PluginWristTrackingSettings.TrackingHardwareRotationOffsetRightHand, PluginWristTrackingSettings.TrackingHardwareRotationOffsetRightHand,
LeftMotionSource, PluginWristTrackingSettings.LeftHandMotionSource,
RightMotionSource, PluginWristTrackingSettings.RightHandMotionSource,
!!WristTrackingSettingsOverrides.bDrawDebugGizmo, !!WristTrackingSettingsOverrides.bDrawDebugGizmo,
WristTrackingSettingsOverrides.DebugGizmoSettings, WristTrackingSettingsOverrides.DebugGizmoSettings,
}; };
@@ -192,28 +157,7 @@ void USGWristTrackerComponent::PostEditChangeProperty(FPropertyChangedEvent& Pro
: NAME_None : NAME_None
}; };
static const FName OverridePluginSettingsName{ (void) PropertyName;
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;
}
} }
#endif /* WITH_EDITOR */ #endif /* WITH_EDITOR */
@@ -279,8 +223,7 @@ bool USGWristTrackerComponent::GetMotionControllerData(FXRMotionControllerData&
} }
USGWristTrackerComponent::FImpl::FImpl(USGWristTrackerComponent* InOwner) USGWristTrackerComponent::FImpl::FImpl(USGWristTrackerComponent* InOwner)
: bMotionSourcePropertyModified(false), : Owner(InOwner)
Owner(InOwner)
{ {
} }
@@ -297,40 +240,6 @@ bool USGWristTrackerComponent::FImpl::IsEditor() const
return false; 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 void USGWristTrackerComponent::FImpl::UpdateMotionSource() const
{ {
if (GEngine) if (GEngine)
@@ -38,7 +38,6 @@
FSGWristTrackingSettingsOverrides::FSGWristTrackingSettingsOverrides() FSGWristTrackingSettingsOverrides::FSGWristTrackingSettingsOverrides()
: FSGWristTrackingSettingsOverrides{ : FSGWristTrackingSettingsOverrides{
false, false,
EControllerHand::AnyHand,
false, false,
FSGDebugGizmoSettings{} FSGDebugGizmoSettings{}
} }
@@ -47,11 +46,9 @@ FSGWristTrackingSettingsOverrides::FSGWristTrackingSettingsOverrides()
FSGWristTrackingSettingsOverrides::FSGWristTrackingSettingsOverrides( FSGWristTrackingSettingsOverrides::FSGWristTrackingSettingsOverrides(
const bool bInOverridePluginSettings, const bool bInOverridePluginSettings,
const EControllerHand InMotionSource,
const bool bInDrawDebugGizmo, const bool bInDrawDebugGizmo,
const FSGDebugGizmoSettings& InDebugGizmoSettings) const FSGDebugGizmoSettings& InDebugGizmoSettings)
: bOverridePluginSettings(bInOverridePluginSettings), : bOverridePluginSettings(bInOverridePluginSettings),
MotionSource(InMotionSource),
bDrawDebugGizmo(bInDrawDebugGizmo), bDrawDebugGizmo(bInDrawDebugGizmo),
DebugGizmoSettings{InDebugGizmoSettings} DebugGizmoSettings{InDebugGizmoSettings}
{ {
@@ -55,14 +55,6 @@ public:
UPROPERTY(EditAnywhere, Category = "SenseGlove") UPROPERTY(EditAnywhere, Category = "SenseGlove")
uint8 bOverridePluginSettings : 1; 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. * If enabled, draws debug Wrist trackers where possible.
*/ */
@@ -82,7 +74,6 @@ public:
FSGWristTrackingSettingsOverrides( FSGWristTrackingSettingsOverrides(
bool bInOverridePluginSettings, bool bInOverridePluginSettings,
EControllerHand InMotionSource,
bool bInDrawDebugGizmo, bool bInDrawDebugGizmo,
const FSGDebugGizmoSettings& InDebugGizmoSettings); const FSGDebugGizmoSettings& InDebugGizmoSettings);
}; };