move reusable code to its own pimpl method

This commit is contained in:
Mamadou Babaei
2026-02-24 11:43:59 +01:00
parent 04b4aa7659
commit 5ac8d67192
@@ -165,6 +165,8 @@ struct USGVirtualHandComponent::FImpl
void DrawDebugVirtualHand() const;
void TriggerHandVisibilityChangedEvent(bool bNewVisibility) const;
void AutoStopAllHaptics() const;
};
FName USGVirtualHandComponent::FImpl::ParseVirtualHandSettingsOverridesPropertyName(const FName& PropertyName)
@@ -385,12 +387,10 @@ void USGVirtualHandComponent::UninitializeComponent()
{
Super::UninitializeComponent();
const USGGloveTracker* GloveTracker{USGGloveTracker::GetInstance(GetOuter())};
USGHapticGlove* Glove{IsValid(GloveTracker) ? GloveTracker->GetGlove(IsRight()) : nullptr};
const bool bAutoStopHaptics = GetVirtualHandSettings().HapticsSettings.bAutoStopAllHapticsOnEndPlay;
if (IsValid(Glove) && Glove->IsConnected() && bAutoStopHaptics)
if (bAutoStopHaptics)
{
Glove->StopHaptics();
Pimpl->AutoStopAllHaptics();
}
}
@@ -405,12 +405,10 @@ void USGVirtualHandComponent::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
Super::EndPlay(EndPlayReason);
const USGGloveTracker* GloveTracker{USGGloveTracker::GetInstance(GetOuter())};
USGHapticGlove* Glove{IsValid(GloveTracker) ? GloveTracker->GetGlove(IsRight()) : nullptr};
const bool bAutoStopHaptics = GetVirtualHandSettings().HapticsSettings.bAutoStopAllHapticsOnEndPlay;
if (IsValid(Glove) && Glove->IsConnected() && bAutoStopHaptics)
if (bAutoStopHaptics)
{
Glove->StopHaptics();
Pimpl->AutoStopAllHaptics();
}
}
@@ -889,6 +887,17 @@ void USGVirtualHandComponent::FImpl::TriggerHandVisibilityChangedEvent(const boo
Owner->OnHandVisibilityChanged(bNewVisibility);
}
void USGVirtualHandComponent::FImpl::AutoStopAllHaptics() const
{
const USGGloveTracker* GloveTracker{USGGloveTracker::GetInstance(Owner->GetOuter())};
USGHapticGlove* Glove{IsValid(GloveTracker) ? GloveTracker->GetGlove(Owner->IsRight()) : nullptr};
const bool bAutoStopHaptics = Owner->GetVirtualHandSettings().HapticsSettings.bAutoStopAllHapticsOnEndPlay;
if (IsValid(Glove) && Glove->IsConnected() && bAutoStopHaptics)
{
Glove->StopHaptics();
}
}
void USGVirtualHandComponent::FImplDeleter::operator()(const FImpl* P) const
{
delete P;