allow setting custom hardware offset through the plugin settings
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#include "Engine/Engine.h"
|
||||
|
||||
#include "SGLog/SGLog.h"
|
||||
#include "SGCore/SGTracking.h"
|
||||
|
||||
struct USGSettings::FImpl
|
||||
{
|
||||
@@ -68,6 +69,8 @@ struct USGSettings::FImpl
|
||||
/************************
|
||||
* Methods
|
||||
************************/
|
||||
|
||||
void ResetHardwareOffsetValuesToZero();
|
||||
};
|
||||
|
||||
USGSettings* USGSettings::GetInstance()
|
||||
@@ -76,17 +79,12 @@ USGSettings* USGSettings::GetInstance()
|
||||
return Instance;
|
||||
}
|
||||
|
||||
void USGSettings::FImplDeleter::operator()(const FImpl* P) const
|
||||
{
|
||||
delete P;
|
||||
}
|
||||
|
||||
USGSettings::USGSettings()
|
||||
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
|
||||
{
|
||||
HardwareOffset = ESGPositionalTrackingHardware::None;
|
||||
HardwareLocationOffset = FVector::ZeroVector;
|
||||
HardwareRotationOffset = FRotator::ZeroRotator;
|
||||
|
||||
Pimpl->ResetHardwareOffsetValuesToZero();
|
||||
}
|
||||
|
||||
bool USGSettings::ShouldCreateSubsystem(UObject* Outer) const
|
||||
@@ -116,9 +114,57 @@ void USGSettings::Deinitialize()
|
||||
SGLOG("The SenseGlove settings singleton has been successfully de-initialized!");
|
||||
}
|
||||
|
||||
#if WITH_EDITOR
|
||||
bool USGSettings::CanEditChange(const FProperty* InProperty) const
|
||||
{
|
||||
bool bCanEditChange = Super::CanEditChange(InProperty);
|
||||
|
||||
/*const FName PropertyName{InProperty ? InProperty->GetFName() : NAME_None};
|
||||
|
||||
if (PropertyName == GET_MEMBER_NAME_CHECKED(USGSettings, HardwareOffset))
|
||||
{
|
||||
return HardwareOffset == ESGPositionalTrackingHardware::Custom;
|
||||
}*/
|
||||
|
||||
return bCanEditChange;
|
||||
}
|
||||
#endif /* WITH_EDITOR */
|
||||
|
||||
#if WITH_EDITOR
|
||||
void USGSettings::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
|
||||
{
|
||||
Super::PostEditChangeProperty(PropertyChangedEvent);
|
||||
|
||||
const FName PropertyName{
|
||||
PropertyChangedEvent.Property
|
||||
? PropertyChangedEvent.Property->GetFName()
|
||||
: NAME_None
|
||||
};
|
||||
|
||||
if (PropertyName == GET_MEMBER_NAME_CHECKED(USGSettings, HardwareOffset))
|
||||
{
|
||||
Pimpl->ResetHardwareOffsetValuesToZero();
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif /* WITH_EDITOR */
|
||||
|
||||
USGSettings::FImpl::FImpl(USGSettings* InOwner)
|
||||
: Owner(InOwner)
|
||||
{
|
||||
}
|
||||
|
||||
USGSettings::FImpl::~FImpl() = default;
|
||||
USGSettings::FImpl::~FImpl() = default;
|
||||
|
||||
void USGSettings::FImpl::ResetHardwareOffsetValuesToZero()
|
||||
{
|
||||
Owner->HardwareLocationOffsetLeftHand = FVector::ZeroVector;
|
||||
Owner->HardwareLocationOffsetRightHand = FVector::ZeroVector;
|
||||
Owner->HardwareRotationOffsetLeftHand = FRotator::ZeroRotator;
|
||||
Owner->HardwareRotationOffsetRightHand = FRotator::ZeroRotator;
|
||||
}
|
||||
|
||||
void USGSettings::FImplDeleter::operator()(const FImpl* P) const
|
||||
{
|
||||
delete P;
|
||||
}
|
||||
Reference in New Issue
Block a user