fully refactor the top-level configurations in the settings system into ustructs

This commit is contained in:
Mamadou Babaei
2023-06-02 19:38:21 +02:00
parent 83c9a8b95d
commit 16176149e8
16 changed files with 331 additions and 721 deletions
@@ -210,6 +210,7 @@ USGVirtualHandComponent::USGVirtualHandComponent(const FObjectInitializer& Objec
Super::SetAnimClass(USGVirtualHandAnimInstance::StaticClass());
bRight = true;
bHiddenInGameIfNoGloveDetected = false;
bAutoStopAllHapticsOnEndPlay = true;
@@ -229,9 +230,8 @@ USGVirtualHandComponent::USGVirtualHandComponent(const FObjectInitializer& Objec
RingFingertipTouchSocketName = FName{TEXT("TouchRingFingertip")};
PinkyFingertipTouchSocketName = FName{TEXT("TouchPinkyFingertip")};
bHiddenInGameIfNoGloveDetected = false;
DebugVirtualHandSettings = FSGDebugVirtualHandSettings{
false,
ESGDebugVirtualHandDrawingMode::None,
FVector(0.5f, 0.5f, 0.5f),
FColor(255, 0, 0, 255),
@@ -109,21 +109,21 @@ USGWristTrackerComponent::USGWristTrackerComponent(const FObjectInitializer& Obj
SetRight(true);
bOverridePluginWristTrackingSettings = false;
bDrawWristTrackerDebugGizmo = false;
TrackingHardware = ESGPositionalTrackingHardware::None;
TrackingHardwareLocationOffset = FVector::ZeroVector;
TrackingHardwareLocationOffset = FVector::ZeroVector;
bOverridePluginWristTrackingDebugSettings = false;
bDrawWristTrackerDebugGizmo = false;
WristTrackerDebugGizmoSettings = FSGDebugGizmoSettings(
4.0f, 1.0f,
FColor(255, 0, 0, 255),
FColor(0, 255, 0, 255),
FColor(0, 0, 255, 255),
false, 1.1f, 0
WristTrackingSettings = FSGWristTrackingSettings(
ESGPositionalTrackingHardware::None,
FVector::ZeroVector,
FVector::ZeroVector,
FRotator::ZeroRotator,
FRotator::ZeroRotator,
false,
FSGDebugGizmoSettings(
4.0f, 1.0f,
FColor(255, 0, 0, 255),
FColor(0, 255, 0, 255),
FColor(0, 0, 255, 255),
false, 1.1f, 0
)
);
bDrawWristTrackerDebugGizmo = false;
bBackendInitialized = false;
Glove = nullptr;
@@ -131,142 +131,30 @@ USGWristTrackerComponent::USGWristTrackerComponent(const FObjectInitializer& Obj
WristRotation = FRotator::ZeroRotator;
}
const FSGWristTrackingSettings& USGWristTrackerComponent::GetWristTrackingSettings() const
{
if (OverridesPluginWristTrackingSettings())
{
return WristTrackingSettings;
}
return USGSettings::GetInstance()->GetWristTrackingSettings();
}
void USGWristTrackerComponent::SetWristTrackingSettings(const FSGWristTrackingSettings& InWristTrackingSettings)
{
ensureAlwaysMsgf(
OverridesPluginWristTrackingSettings(),
TEXT( "Setting WristTrackingSettings is only permitted when bOverridePluginWristTrackingSettings is enabled!"));
WristTrackingSettings = InWristTrackingSettings;
}
void USGWristTrackerComponent::SetRight(const bool bRight)
{
SetTrackingSource(bRight ? EControllerHand::Right : EControllerHand::Left);
}
ESGPositionalTrackingHardware USGWristTrackerComponent::GetTrackingHardware() const
{
if (OverridesPluginWristTrackingSettings())
{
return TrackingHardware;
}
return USGSettings::GetInstance()->GetTrackingHardware();
}
void USGWristTrackerComponent::SetTrackingHardware(const ESGPositionalTrackingHardware InTrackingHardware)
{
ensureAlwaysMsgf(
OverridesPluginWristTrackingSettings(),
TEXT( "Setting TrackingHardware is only permitted when bOverridePluginWristTrackingSettings is enabled!"));
TrackingHardware = InTrackingHardware;
}
const FVector& USGWristTrackerComponent::GetTrackingHardwareLocationOffset() const
{
ensureAlwaysMsgf(
GetTrackingHardware() == ESGPositionalTrackingHardware::Custom,
TEXT( "Getting TrackingHardwareLocationOffset is only permitted when TrackingHardware is set to Custom!"));
if (OverridesPluginWristTrackingSettings())
{
return TrackingHardwareLocationOffset;
}
return IsRight()
? USGSettings::GetInstance()->GetTrackingHardwareLocationOffsetRightHand()
: USGSettings::GetInstance()->GetTrackingHardwareLocationOffsetLeftHand();
}
void USGWristTrackerComponent::SetTrackingHardwareLocationOffset(const FVector& InTrackingHardwareLocationOffset)
{
ensureAlwaysMsgf(
OverridesPluginWristTrackingSettings(),
TEXT(
"Setting TrackingHardwareLocationOffset is only permitted when bOverridePluginWristTrackingSettings is enabled!"
));
ensureAlwaysMsgf(
GetTrackingHardware() == ESGPositionalTrackingHardware::Custom,
TEXT( "Setting TrackingHardwareLocationOffset is only permitted when TrackingHardware is set to Custom!"));
TrackingHardwareLocationOffset = InTrackingHardwareLocationOffset;
}
const FRotator& USGWristTrackerComponent::GetTrackingHardwareRotationOffset() const
{
ensureAlwaysMsgf(
GetTrackingHardware() == ESGPositionalTrackingHardware::Custom,
TEXT( "Getting TrackingHardwareRotationOffset is only permitted when TrackingHardware is set to Custom!"));
if (OverridesPluginWristTrackingSettings())
{
return TrackingHardwareRotationOffset;
}
return IsRight()
? USGSettings::GetInstance()->GetTrackingHardwareRotationOffsetRightHand()
: USGSettings::GetInstance()->GetTrackingHardwareRotationOffsetLeftHand();
}
void USGWristTrackerComponent::SetTrackingHardwareRotationOffset(const FRotator& InTrackingHardwareRotationOffset)
{
ensureAlwaysMsgf(
OverridesPluginWristTrackingSettings(),
TEXT(
"Setting TrackingHardwareRotationOffset is only permitted when bOverridePluginWristTrackingSettings is enabled!"
));
ensureAlwaysMsgf(
GetTrackingHardware() == ESGPositionalTrackingHardware::Custom,
TEXT("Setting TrackingHardwareRotationOffsetRightHand is only permitted when TrackingHardware is set to Custom!"
));
TrackingHardwareRotationOffset = InTrackingHardwareRotationOffset;
}
bool USGWristTrackerComponent::GetDrawWristTrackerDebugGizmo() const
{
if (OverridesPluginWristTrackingDebugSettings())
{
return !!bDrawWristTrackerDebugGizmo;
}
return USGSettings::GetInstance()->GetDrawWristTrackerDebugGizmo();
}
void USGWristTrackerComponent::SetDrawWristTrackerDebugGizmo(const bool bInDrawWristTrackerDebugGizmo)
{
ensureAlwaysMsgf(
OverridesPluginWristTrackingDebugSettings(),
TEXT( "Setting bDrawWristTrackerDebugGizmo is only permitted when bOverridePluginWristTrackingDebugSettings is"
" enabled!"));
bDrawWristTrackerDebugGizmo = bInDrawWristTrackerDebugGizmo;
}
const FSGDebugGizmoSettings& USGWristTrackerComponent::GetWristTrackerDebugGizmoSettings() const
{
ensureAlwaysMsgf(
GetDrawWristTrackerDebugGizmo(),
TEXT("Getting WristTrackerDebugGizmoLength is only permitted when bDrawWristTrackerDebugGizmo is enabled!"));
if (OverridesPluginWristTrackingDebugSettings())
{
return WristTrackerDebugGizmoSettings;
}
return USGSettings::GetInstance()->GetWristTrackerDebugGizmoSettings();
}
void USGWristTrackerComponent::SetWristTrackerDebugGizmoSettings(
const FSGDebugGizmoSettings& InWristTrackerDebugGizmoSettings)
{
ensureAlwaysMsgf(
OverridesPluginWristTrackingDebugSettings(),
TEXT("Setting WristTrackerDebugGizmoLength is only permitted when bOverridePluginWristTrackingDebugSettings is"
" enabled!"));
ensureAlwaysMsgf(
GetDrawWristTrackerDebugGizmo(),
TEXT("Setting WristTrackerDebugGizmoLength is only permitted when bDrawWristTrackerDebugGizmo is enabled!"));
WristTrackerDebugGizmoSettings = InWristTrackerDebugGizmoSettings;
}
#if WITH_EDITOR
void USGWristTrackerComponent::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
{
@@ -329,7 +217,7 @@ void USGWristTrackerComponent::TickComponent(
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
if (GetDrawWristTrackerDebugGizmo())
if (!!WristTrackingSettings.bDrawWristTrackerDebugGizmo)
{
Pimpl->DrawDebugGizmo();
}
@@ -487,15 +375,23 @@ void USGWristTrackerComponent::FImpl::UpdateWristTrackingData() const
FVector TrackerLocation{Owner->GetComponentLocation()};
FRotator TrackerRotation{Owner->GetComponentRotation()};
ESGPositionalTrackingHardware TrackerHardware = Owner->GetTrackingHardware();
ESGPositionalTrackingHardware TrackerHardware = Owner->GetWristTrackingSettings().TrackingHardware;
if (TrackerHardware == ESGPositionalTrackingHardware::None)
{
TrackerHardware = ESGPositionalTrackingHardware::Custom;
}
else if (TrackerHardware == ESGPositionalTrackingHardware::Custom)
{
TrackerLocation += Owner->GetTrackingHardwareLocationOffset();
TrackerRotation += Owner->GetTrackingHardwareRotationOffset();
if (Owner->IsRight())
{
TrackerLocation += Owner->GetWristTrackingSettings().TrackingHardwareLocationOffsetRightHand;
TrackerRotation += Owner->GetWristTrackingSettings().TrackingHardwareRotationOffsetRightHand;
}
else
{
TrackerLocation += Owner->GetWristTrackingSettings().TrackingHardwareLocationOffsetLeftHand;
TrackerRotation += Owner->GetWristTrackingSettings().TrackingHardwareRotationOffsetLeftHand;
}
}
FVector NewWristLocation;
@@ -537,7 +433,7 @@ void USGWristTrackerComponent::FImpl::DrawDebugGizmo()
const UWorld* World{Owner->GetWorld()};
const FVector& Location{Owner->GetComponentLocation()};
const FRotator& Rotation{Owner->GetComponentRotation()};
const FSGDebugGizmoSettings& DebugGizmoSettings{Owner->GetWristTrackerDebugGizmoSettings()};
const FSGDebugGizmoSettings& DebugGizmoSettings{Owner->GetWristTrackingSettings().WristTrackerDebugGizmoSettings};
FSGDebugGizmo::Draw(World, Location, Rotation, DebugGizmoSettings);
}
@@ -84,6 +84,9 @@ private:
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
uint8 bRight : 1;
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
uint8 bHiddenInGameIfNoGloveDetected : 1;
UPROPERTY(EditAnywhere, Category="SenseGlove | Haptics", meta=(AllowPrivateAccess="false"))
uint8 bAutoStopAllHapticsOnEndPlay : 1;
@@ -121,10 +124,6 @@ private:
FName PinkyFingertipTouchSocketName;
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
uint8 bHiddenInGameIfNoGloveDetected : 1;
UPROPERTY(EditAnywhere, Category="SenseGlove",
meta=(AllowPrivateAccess="false", EditCondition="bDrawDebugVirtualHand", EditConditionHides))
FSGDebugVirtualHandSettings DebugVirtualHandSettings;
private:
@@ -150,6 +149,16 @@ public:
void SetRight(const bool bInRight);
FORCEINLINE const FName& GetMiddleFingertipTouchSocketName() const
{
return MiddleFingertipTouchSocketName;
}
FORCEINLINE void SetMiddleFingertipTouchSocketName(const FName& SocketName)
{
MiddleFingertipTouchSocketName = SocketName;
}
FORCEINLINE bool AutoStopsAllHapticsOnEndPlay() const
{
return !!bAutoStopAllHapticsOnEndPlay;
@@ -157,7 +166,7 @@ public:
FORCEINLINE void SetAutoStopAllHapticsOnEndPlay(const bool bInAutoStopAllHapticsOnEndPlay)
{
bAutoStopAllHapticsOnEndPlay = bInAutoStopAllHapticsOnEndPlay;
bAutoStopAllHapticsOnEndPlay = bInAutoStopAllHapticsOnEndPlay;
}
FORCEINLINE const FName& GetGrabSocketName() const
@@ -225,16 +234,6 @@ public:
IndexFingertipTouchSocketName = SocketName;
}
FORCEINLINE const FName& GetMiddleFingertipTouchSocketName() const
{
return MiddleFingertipTouchSocketName;
}
FORCEINLINE void SetMiddleFingertipTouchSocketName(const FName& SocketName)
{
MiddleFingertipTouchSocketName = SocketName;
}
FORCEINLINE const FName& GetRingFingertipTouchSocketName() const
{
return RingFingertipTouchSocketName;
@@ -41,7 +41,7 @@
#include "MotionControllerComponent.h"
#include "Templates/UniquePtr.h"
#include "SGSettings/SGDebugGizmoSettings.h"
#include "SGSettings/SGWristTrackingSettings.h"
#include "SGTypes/SGCoreTypes.h"
#include "SGWristTrackerComponent.generated.h"
@@ -94,51 +94,18 @@ private:
FImplDeleter PimplDeleter;
private:
UPROPERTY(Config, EditAnywhere, Category = "Override Plugin Settings")
/**
* Determines whether to override the plugin's wrist tracking settings or not.
*/
UPROPERTY(Config, EditAnywhere, Category = "SenseGlove")
uint8 bOverridePluginWristTrackingSettings : 1;
/**
* If set to Custom, any desired location and rotation can be specified.
* Overrides the plugin's wrist tracking settings.
*/
UPROPERTY(Config, EditAnywhere, Category = "Override Plugin Settings",
UPROPERTY(Config, EditAnywhere, Category = "SenseGlove",
meta=(EditCondition="bOverridePluginWristTrackingSettings", EditConditionHides))
ESGPositionalTrackingHardware TrackingHardware;
/**
* Valid only if TrackingHardware is set to Custom.
*/
UPROPERTY(Config, EditAnywhere, Category = "Override Plugin Settings",
meta=(EditCondition=
"bOverridePluginWristTrackingSettings && TrackingHardware == ESGPositionalTrackingHardware::Custom",
EditConditionHides))
FVector TrackingHardwareLocationOffset;
/**
* Valid only if TrackingHardware is set to Custom.
*/
UPROPERTY(Config, EditAnywhere, Category = "Override Plugin Settings",
meta=(EditCondition=
"bOverridePluginWristTrackingSettings && TrackingHardware == ESGPositionalTrackingHardware::Custom",
EditConditionHides))
FRotator TrackingHardwareRotationOffset;
UPROPERTY(Config, EditAnywhere, Category = "Override Plugin Settings")
uint8 bOverridePluginWristTrackingDebugSettings : 1;
/**
* If enabled, draws debug Wrist trackers where possible.
*/
UPROPERTY(Config, EditAnywhere, Category = "Override Plugin Settings",
meta=(EditCondition="bOverridePluginWristTrackingDebugSettings", EditConditionHides))
uint8 bDrawWristTrackerDebugGizmo : 1;
/**
* Valid only if bDrawWristTrackerDebugGizmo is enabled.
*/
UPROPERTY(Config, EditAnywhere, Category = "Override Plugin Settings",
meta=(EditCondition="bOverridePluginWristTrackingDebugSettings && bDrawWristTrackerDebugGizmo",
EditConditionHides))
FSGDebugGizmoSettings WristTrackerDebugGizmoSettings;
FSGWristTrackingSettings WristTrackingSettings;
private:
UPROPERTY(Transient)
@@ -164,30 +131,8 @@ public:
bOverridePluginWristTrackingSettings = bInOverridePluginWristTrackingSettings;
}
ESGPositionalTrackingHardware GetTrackingHardware() const;
void SetTrackingHardware(ESGPositionalTrackingHardware InTrackingHardware);
const FVector& GetTrackingHardwareLocationOffset() const;
void SetTrackingHardwareLocationOffset(const FVector& InTrackingHardwareLocationOffset);
const FRotator& GetTrackingHardwareRotationOffset() const;
void SetTrackingHardwareRotationOffset(const FRotator& InTrackingHardwareRotationOffset);
FORCEINLINE bool OverridesPluginWristTrackingDebugSettings() const
{
return !!bOverridePluginWristTrackingDebugSettings;
}
FORCEINLINE void OverridePluginWristTrackingDebugSettings(const bool bInOverridePluginWristTrackingDebugSettings)
{
bOverridePluginWristTrackingDebugSettings = bInOverridePluginWristTrackingDebugSettings;
}
bool GetDrawWristTrackerDebugGizmo() const;
void SetDrawWristTrackerDebugGizmo(bool bInDrawWristTrackerDebugGizmo);
const FSGDebugGizmoSettings& GetWristTrackerDebugGizmoSettings() const;
void SetWristTrackerDebugGizmoSettings(const FSGDebugGizmoSettings& InWristTrackerDebugGizmoSettings);
const FSGWristTrackingSettings& GetWristTrackingSettings() const;
void SetWristTrackingSettings(const FSGWristTrackingSettings& InWristTrackingSettings);
FORCEINLINE bool IsLeft() const
{
@@ -78,6 +78,18 @@ void UVirtualHandComponentKismetLibrary::SetRight(USGVirtualHandComponent* Virtu
VirtualHandComponent->SetRight(bInRight);
}
bool UVirtualHandComponentKismetLibrary::IsHiddenInGameIfNoGloveDetected(
const USGVirtualHandComponent* VirtualHandComponent)
{
return VirtualHandComponent->IsHiddenInGameIfNoGloveDetected();
}
void UVirtualHandComponentKismetLibrary::SetHiddenIfNoGloveDetected(
USGVirtualHandComponent* VirtualHandComponent, const bool bInHiddenIfNoGloveDetected)
{
VirtualHandComponent->SetHiddenIfNoGloveDetected(bInHiddenIfNoGloveDetected);
}
bool UVirtualHandComponentKismetLibrary::AutoStopsAllHapticsOnEndPlay(
const USGVirtualHandComponent* VirtualHandComponent)
{
@@ -204,18 +216,6 @@ void UVirtualHandComponentKismetLibrary::SetPinkyFingertipTouchSocketName(USGVir
VirtualHandComponent->SetPinkyFingertipTouchSocketName(SocketName);
}
bool UVirtualHandComponentKismetLibrary::IsHiddenInGameIfNoGloveDetected(
const USGVirtualHandComponent* VirtualHandComponent)
{
return VirtualHandComponent->IsHiddenInGameIfNoGloveDetected();
}
void UVirtualHandComponentKismetLibrary::SetHiddenIfNoGloveDetected(
USGVirtualHandComponent* VirtualHandComponent, const bool bInHiddenIfNoGloveDetected)
{
VirtualHandComponent->SetHiddenIfNoGloveDetected(bInHiddenIfNoGloveDetected);
}
bool UVirtualHandComponentKismetLibrary::IsGloveConnected(const USGVirtualHandComponent* VirtualHandComponent)
{
return VirtualHandComponent->IsGloveConnected();
@@ -49,78 +49,17 @@ void UWristTrackerComponentKismetLibrary::OverridePluginWristTrackingSettings(
WristTrackerComponent->OverridePluginWristTrackingSettings(bInOverridePluginWristTrackingSettings);
}
ESGPositionalTrackingHardware UWristTrackerComponentKismetLibrary::GetTrackingHardware(
const FSGWristTrackingSettings& UWristTrackerComponentKismetLibrary::GetWristTrackingSettings(
const USGWristTrackerComponent* WristTrackerComponent)
{
return WristTrackerComponent->GetTrackingHardware();
return WristTrackerComponent->GetWristTrackingSettings();
}
void UWristTrackerComponentKismetLibrary::SetTrackingHardware(
USGWristTrackerComponent* WristTrackerComponent, ESGPositionalTrackingHardware InTrackingHardware)
{
WristTrackerComponent->SetTrackingHardware(InTrackingHardware);
}
const FVector& UWristTrackerComponentKismetLibrary::GetTrackingHardwareLocationOffset(
const USGWristTrackerComponent* WristTrackerComponent)
{
return WristTrackerComponent->GetTrackingHardwareLocationOffset();
}
void UWristTrackerComponentKismetLibrary::SetTrackingHardwareLocationOffset(
void UWristTrackerComponentKismetLibrary::SetWristTrackingSettings(
USGWristTrackerComponent* WristTrackerComponent,
const FVector& InTrackingHardwareLocationOffset)
const FSGWristTrackingSettings& InWristTrackingSettings)
{
WristTrackerComponent->SetTrackingHardwareLocationOffset(InTrackingHardwareLocationOffset);
}
const FRotator& UWristTrackerComponentKismetLibrary::GetTrackingHardwareRotationOffset(
const USGWristTrackerComponent* WristTrackerComponent)
{
return WristTrackerComponent->GetTrackingHardwareRotationOffset();
}
void UWristTrackerComponentKismetLibrary::SetTrackingHardwareRotationOffset(
USGWristTrackerComponent* WristTrackerComponent,
const FRotator& InTrackingHardwareRotationOffset)
{
WristTrackerComponent->SetTrackingHardwareRotationOffset(InTrackingHardwareRotationOffset);
}
bool UWristTrackerComponentKismetLibrary::OverridesPluginWristTrackingDebugSettings(
const USGWristTrackerComponent* WristTrackerComponent)
{
return WristTrackerComponent->OverridesPluginWristTrackingDebugSettings();
}
void UWristTrackerComponentKismetLibrary::OverridePluginWristTrackingDebugSettings(
USGWristTrackerComponent* WristTrackerComponent, const bool bInOverridePluginWristTrackingDebugSettings)
{
WristTrackerComponent->OverridePluginWristTrackingDebugSettings(bInOverridePluginWristTrackingDebugSettings);
}
bool UWristTrackerComponentKismetLibrary::GetDrawWristTrackerDebugGizmo(
const USGWristTrackerComponent* WristTrackerComponent)
{
return WristTrackerComponent->GetDrawWristTrackerDebugGizmo();
}
void UWristTrackerComponentKismetLibrary::SetDrawWristTrackerDebugGizmo(
USGWristTrackerComponent* WristTrackerComponent, const bool bInDrawWristTrackerDebugGizmo)
{
WristTrackerComponent->SetDrawWristTrackerDebugGizmo(bInDrawWristTrackerDebugGizmo);
}
const FSGDebugGizmoSettings& UWristTrackerComponentKismetLibrary::GetWristTrackerDebugGizmoSettings(
const USGWristTrackerComponent* WristTrackerComponent)
{
return WristTrackerComponent->GetWristTrackerDebugGizmoSettings();
}
void UWristTrackerComponentKismetLibrary::SetWristTrackerDebugGizmoSettings(
USGWristTrackerComponent* WristTrackerComponent, const FSGDebugGizmoSettings& InWristTrackerDebugGizmoSettings)
{
WristTrackerComponent->SetWristTrackerDebugGizmoSettings(InWristTrackerDebugGizmoSettings);
WristTrackerComponent->SetWristTrackingSettings(InWristTrackingSettings);
}
bool UWristTrackerComponentKismetLibrary::IsLeft(const USGWristTrackerComponent* WristTrackerComponent)
@@ -81,6 +81,13 @@ public:
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Virtual Hand Component")
static void SetRight(UPARAM(ref) USGVirtualHandComponent* VirtualHandComponent, bool bInRight);
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Virtual Hand Component")
static bool IsHiddenInGameIfNoGloveDetected(const USGVirtualHandComponent* VirtualHandComponent);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Virtual Hand Component")
static void SetHiddenIfNoGloveDetected(UPARAM(ref) USGVirtualHandComponent* VirtualHandComponent,
bool bInHiddenIfNoGloveDetected);
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Virtual Hand Component")
static bool AutoStopsAllHapticsOnEndPlay(const USGVirtualHandComponent* VirtualHandComponent);
@@ -153,13 +160,6 @@ public:
static void SetPinkyFingertipTouchSocketName(UPARAM(ref) USGVirtualHandComponent* VirtualHandComponent,
const FName& SocketName);
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Virtual Hand Component")
static bool IsHiddenInGameIfNoGloveDetected(const USGVirtualHandComponent* VirtualHandComponent);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Virtual Hand Component")
static void SetHiddenIfNoGloveDetected(UPARAM(ref) USGVirtualHandComponent* VirtualHandComponent,
bool bInHiddenIfNoGloveDetected);
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Virtual Hand Component")
static bool IsGloveConnected(const USGVirtualHandComponent* VirtualHandComponent);
@@ -38,9 +38,8 @@
#pragma once
#include "SGKismet/SGBlueprintFunctionLibrary.h"
#include "SGTypes/SGCoreTypes.h"
#include "SGSettings/SGDebugGizmoSettings.h"
#include "SGSettings/SGWristTrackingSettings.h"
#include "SGWristTrackerComponentKismetLibrary.generated.h"
@@ -63,47 +62,12 @@ public:
bool bInOverridePluginWristTrackingSettings);
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Wrist Tracker Component")
static ESGPositionalTrackingHardware GetTrackingHardware(const USGWristTrackerComponent* WristTrackerComponent);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Wrist Tracker Component")
static void SetTrackingHardware(UPARAM(ref) USGWristTrackerComponent* WristTrackerComponent,
ESGPositionalTrackingHardware InTrackingHardware);
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Wrist Tracker Component")
static const FVector& GetTrackingHardwareLocationOffset(const USGWristTrackerComponent* WristTrackerComponent);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Wrist Tracker Component")
static void SetTrackingHardwareLocationOffset(UPARAM(ref) USGWristTrackerComponent* WristTrackerComponent,
const FVector& InTrackingHardwareLocationOffset);
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Wrist Tracker Component")
static const FRotator& GetTrackingHardwareRotationOffset(const USGWristTrackerComponent* WristTrackerComponent);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Wrist Tracker Component")
static void SetTrackingHardwareRotationOffset(UPARAM(ref) USGWristTrackerComponent* WristTrackerComponent,
const FRotator& InTrackingHardwareRotationOffset);
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Wrist Tracker Component")
static bool OverridesPluginWristTrackingDebugSettings(const USGWristTrackerComponent* WristTrackerComponent);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Wrist Tracker Component")
static void OverridePluginWristTrackingDebugSettings(UPARAM(ref) USGWristTrackerComponent* WristTrackerComponent,
bool bInOverridePluginWristTrackingDebugSettings);
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Wrist Tracker Component")
static bool GetDrawWristTrackerDebugGizmo(const USGWristTrackerComponent* WristTrackerComponent);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Wrist Tracker Component")
static void SetDrawWristTrackerDebugGizmo(UPARAM(ref) USGWristTrackerComponent* WristTrackerComponent,
bool bInDrawWristTrackerDebugGizmo);
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Wrist Tracker Component")
static const FSGDebugGizmoSettings& GetWristTrackerDebugGizmoSettings(
static const FSGWristTrackingSettings& GetWristTrackingSettings(
const USGWristTrackerComponent* WristTrackerComponent);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Wrist Tracker Component")
static void SetWristTrackerDebugGizmoSettings(UPARAM(ref) USGWristTrackerComponent* WristTrackerComponent,
const FSGDebugGizmoSettings& InWristTrackerDebugGizmoSettings);
static void SetWristTrackingSettings(UPARAM(ref) USGWristTrackerComponent* WristTrackerComponent,
const FSGWristTrackingSettings& InWristTrackingSettings);
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Wrist Tracker Component")
static bool IsLeft(const USGWristTrackerComponent* WristTrackerComponent);
@@ -35,13 +35,32 @@
#include "SGSettings/SGDebugVirtualHandSettings.h"
FSGDebugVirtualHandSettings::FSGDebugVirtualHandSettings()
: bDrawDebugVirtualHand(false),
DrawingMode(ESGDebugVirtualHandDrawingMode::None),
CubeExtent(FVector(0.5f, 0.5f, 0.5f)),
CubeColor(255, 0, 0, 255),
CubeThickness(0.1f),
GizmoLength(1.0f),
GizmoThickness(1.0f),
GizmoXAxisColor(255, 0, 0, 255),
GizmoYAxisColor(255, 0, 0, 255),
GizmoZAxisColor(255, 0, 0, 255),
bPersistentLines(false),
LifeTimeModifier(1.1f),
DepthPriority(0)
{
}
FSGDebugVirtualHandSettings::FSGDebugVirtualHandSettings(
const bool bInDrawDebugVirtualHand,
const ESGDebugVirtualHandDrawingMode InDrawingMode,
const FVector& InCubeExtent, const FColor& InCubeColor, const float InCubeThickness,
const float InGizmoLength, const float InGizmoThickness,
const FColor& InGizmoXAxisColor, const FColor& InGizmoYAxisColor, const FColor& InGizmoZAxisColor,
const bool bInPersistentLines, const float InLifeTimeModifier, const uint8 InDepthPriority)
: DrawingMode(InDrawingMode),
: bDrawDebugVirtualHand(bInDrawDebugVirtualHand),
DrawingMode(InDrawingMode),
CubeExtent(InCubeExtent),
CubeColor(InCubeColor),
CubeThickness(InCubeThickness),
@@ -42,10 +42,6 @@
struct USGSettings::FImpl
{
/************************
* Static methods
************************/
/************************
* Owner object
************************/
@@ -65,12 +61,6 @@ struct USGSettings::FImpl
FImpl(const FImpl& Rhs) = default;
FImpl& operator=(const FImpl& Rhs) = default;
/************************
* Methods
************************/
void ResetTrackingHardwareValuesToZero();
};
USGSettings* USGSettings::GetInstance()
@@ -82,118 +72,23 @@ USGSettings* USGSettings::GetInstance()
USGSettings::USGSettings()
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
TrackingHardware = ESGPositionalTrackingHardware::None;
Pimpl->ResetTrackingHardwareValuesToZero();
TrackingHardware = ESGPositionalTrackingHardware::None;
TrackingHardwareLocationOffsetLeftHand = FVector::ZeroVector;
TrackingHardwareLocationOffsetRightHand = FVector::ZeroVector;
TrackingHardwareRotationOffsetLeftHand = FRotator::ZeroRotator;
TrackingHardwareRotationOffsetRightHand = FRotator::ZeroRotator;
bDrawWristTrackerDebugGizmo = false;
WristTrackerDebugGizmoSettings = FSGDebugGizmoSettings(
4.0f, 1.0f,
FColor(255, 0, 0, 255),
FColor(0, 255, 0, 255),
FColor(0, 0, 255, 255),
false, 1.1f, 0
WristTrackingSettings = FSGWristTrackingSettings(
ESGPositionalTrackingHardware::None,
FVector::ZeroVector,
FVector::ZeroVector,
FRotator::ZeroRotator,
FRotator::ZeroRotator,
false,
FSGDebugGizmoSettings(
4.0f, 1.0f,
FColor(255, 0, 0, 255),
FColor(0, 255, 0, 255),
FColor(0, 0, 255, 255),
false, 1.1f, 0
)
);
}
const FVector& USGSettings::GetTrackingHardwareLocationOffsetLeftHand() const
{
ensureAlwaysMsgf(
TrackingHardware == ESGPositionalTrackingHardware::Custom,
TEXT( "Getting TrackingHardwareLocationOffsetLeftHand is only permitted when TrackingHardware is set to"
" Custom!"));
return TrackingHardwareLocationOffsetLeftHand;
}
void USGSettings::SetTrackingHardwareLocationOffsetLeftHand(const FVector& InTrackingHardwareLocationOffsetLeftHand)
{
ensureAlwaysMsgf(
TrackingHardware == ESGPositionalTrackingHardware::Custom,
TEXT( "Setting TrackingHardwareLocationOffsetLeftHand is only permitted when TrackingHardware is set to"
" Custom!"));
TrackingHardwareLocationOffsetLeftHand = InTrackingHardwareLocationOffsetLeftHand;
}
const FVector& USGSettings::GetTrackingHardwareLocationOffsetRightHand() const
{
ensureAlwaysMsgf(
TrackingHardware == ESGPositionalTrackingHardware::Custom,
TEXT( "Getting TrackingHardwareLocationOffsetRightHand is only permitted when TrackingHardware is set to"
" Custom!"));
return TrackingHardwareLocationOffsetRightHand;
}
void USGSettings::SetTrackingHardwareLocationOffsetRightHand(const FVector& InTrackingHardwareLocationOffsetRightHand)
{
ensureAlwaysMsgf(
TrackingHardware == ESGPositionalTrackingHardware::Custom,
TEXT( "Setting TrackingHardwareLocationOffsetRightHand is only permitted when TrackingHardware is set to"
" Custom!"));
TrackingHardwareLocationOffsetRightHand = InTrackingHardwareLocationOffsetRightHand;
}
const FRotator& USGSettings::GetTrackingHardwareRotationOffsetLeftHand() const
{
ensureAlwaysMsgf(
TrackingHardware == ESGPositionalTrackingHardware::Custom,
TEXT( "Getting TrackingHardwareRotationOffsetLeftHand is only permitted when TrackingHardware is set to"
" Custom!"));
return TrackingHardwareRotationOffsetLeftHand;
}
void USGSettings::SetTrackingHardwareRotationOffsetLeftHand(
const FRotator& InTrackingHardwareRotationOffsetLeftHand)
{
ensureAlwaysMsgf(
TrackingHardware == ESGPositionalTrackingHardware::Custom,
TEXT("Setting TrackingHardwareRotationOffsetRightHand is only permitted when TrackingHardware is set to"
" Custom!"));
TrackingHardwareRotationOffsetLeftHand = InTrackingHardwareRotationOffsetLeftHand;
}
const FRotator& USGSettings::GetTrackingHardwareRotationOffsetRightHand() const
{
ensureAlwaysMsgf(
TrackingHardware == ESGPositionalTrackingHardware::Custom,
TEXT("Getting TrackingHardwareRotationOffsetRightHand is only permitted when TrackingHardware is set to"
" Custom!"));
return TrackingHardwareRotationOffsetRightHand;
}
void USGSettings::SetTrackingHardwareRotationOffsetRightHand(
const FRotator& InTrackingHardwareRotationOffsetRightHand)
{
ensureAlwaysMsgf(
TrackingHardware == ESGPositionalTrackingHardware::Custom,
TEXT("Setting TrackingHardwareRotationOffsetRightHand is only permitted when TrackingHardware is set to"
" Custom!"));
TrackingHardwareRotationOffsetRightHand = InTrackingHardwareRotationOffsetRightHand;
}
const FSGDebugGizmoSettings& USGSettings::GetWristTrackerDebugGizmoSettings() const
{
ensureAlwaysMsgf(
GetDrawWristTrackerDebugGizmo(),
TEXT("Getting DebugWristTrackerGizmoThickness is only permitted when bDrawDebugWristTrackerGizmo is"
" enabled!"));
return WristTrackerDebugGizmoSettings;
}
void USGSettings::SetWristTrackerDebugGizmoSettings(const FSGDebugGizmoSettings& InWristTrackerDebugGizmoSettings)
{
ensureAlwaysMsgf(
GetDrawWristTrackerDebugGizmo(),
TEXT("Setting DebugWristTrackerGizmoThickness is only permitted when bDrawDebugWristTrackerGizmo is"
" enabled!"));
WristTrackerDebugGizmoSettings = InWristTrackerDebugGizmoSettings;
}
bool USGSettings::ShouldCreateSubsystem(UObject* Outer) const
{
return true;
@@ -221,41 +116,6 @@ 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, TrackingHardware))
{
return TrackingHardware == 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, TrackingHardware))
{
Pimpl->ResetTrackingHardwareValuesToZero();
return;
}
}
#endif /* WITH_EDITOR */
USGSettings::FImpl::FImpl(USGSettings* InOwner)
: Owner(InOwner)
{
@@ -263,14 +123,6 @@ USGSettings::FImpl::FImpl(USGSettings* InOwner)
USGSettings::FImpl::~FImpl() = default;
void USGSettings::FImpl::ResetTrackingHardwareValuesToZero()
{
Owner->TrackingHardwareLocationOffsetLeftHand = FVector::ZeroVector;
Owner->TrackingHardwareLocationOffsetRightHand = FVector::ZeroVector;
Owner->TrackingHardwareRotationOffsetLeftHand = FRotator::ZeroRotator;
Owner->TrackingHardwareRotationOffsetRightHand = FRotator::ZeroRotator;
}
void USGSettings::FImplDeleter::operator()(const FImpl* P) const
{
delete P;
@@ -0,0 +1,65 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2023 SenseGlove
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* @section DESCRIPTION
*
*
*/
#include "SGSettings/SGWristTrackingSettings.h"
FSGWristTrackingSettings::FSGWristTrackingSettings()
: TrackingHardware(ESGPositionalTrackingHardware::None),
TrackingHardwareLocationOffsetLeftHand(FVector::ZeroVector),
TrackingHardwareLocationOffsetRightHand(FVector::ZeroVector),
TrackingHardwareRotationOffsetLeftHand(FRotator::ZeroRotator),
TrackingHardwareRotationOffsetRightHand(FRotator::ZeroRotator),
bDrawWristTrackerDebugGizmo(false),
WristTrackerDebugGizmoSettings(FSGDebugGizmoSettings())
{
}
FSGWristTrackingSettings::FSGWristTrackingSettings(
const ESGPositionalTrackingHardware InTrackingHardware,
const FVector& InTrackingHardwareLocationOffsetLeftHand,
const FVector& InTrackingHardwareLocationOffsetRightHand,
const FRotator& InTrackingHardwareRotationOffsetLeftHand,
const FRotator& InTrackingHardwareRotationOffsetRightHand,
const bool bInDrawWristTrackerDebugGizmo,
const FSGDebugGizmoSettings& InWristTrackerDebugGizmoSettings)
: TrackingHardware(InTrackingHardware),
TrackingHardwareLocationOffsetLeftHand(InTrackingHardwareLocationOffsetLeftHand),
TrackingHardwareLocationOffsetRightHand(InTrackingHardwareLocationOffsetRightHand),
TrackingHardwareRotationOffsetLeftHand(InTrackingHardwareRotationOffsetLeftHand),
TrackingHardwareRotationOffsetRightHand(InTrackingHardwareRotationOffsetRightHand),
bDrawWristTrackerDebugGizmo(bInDrawWristTrackerDebugGizmo),
WristTrackerDebugGizmoSettings(InWristTrackerDebugGizmoSettings)
{
}
@@ -48,6 +48,10 @@ struct SENSEGLOVESETTINGS_API FSGDebugVirtualHandSettings
public:
UPROPERTY(EditAnywhere, Category = "Debug Virtual Hand Settings")
uint8 bDrawDebugVirtualHand : 1;
UPROPERTY(EditAnywhere, Category = "Debug Virtual Hand Settings",
meta=(EditCondition="bDrawDebugVirtualHand", EditConditionHides))
ESGDebugVirtualHandDrawingMode DrawingMode;
UPROPERTY(EditAnywhere, Category = "Debug Virtual Hand Settings",
@@ -95,7 +99,10 @@ public:
uint8 DepthPriority;
public:
FSGDebugVirtualHandSettings();
explicit FSGDebugVirtualHandSettings(
bool bInDrawDebugVirtualHand,
ESGDebugVirtualHandDrawingMode InDrawingMode = ESGDebugVirtualHandDrawingMode::None,
const FVector& InCubeExtent = FVector(0.5f, 0.5f, 0.5f),
const FColor& InCubeColor = FColor(255, 0, 0, 255),
@@ -42,8 +42,7 @@
#include "Templates/UniquePtr.h"
#include "UObject/ObjectMacros.h"
#include "SGSettings/SGDebugGizmoSettings.h"
#include "SGTypes/SGCoreTypes.h"
#include "SGSettings/SGWristTrackingSettings.h"
#include "SGSettings.generated.h"
@@ -67,101 +66,26 @@ private:
FImplDeleter PimplDeleter;
private:
/**
* If set to Custom, any desired location and rotation can be specified.
*/
UPROPERTY(Config, EditDefaultsOnly, Category = "Wrist Tracking")
ESGPositionalTrackingHardware TrackingHardware;
/**
* Valid only if TrackingHardware is set to Custom.
*/
UPROPERTY(Config, EditDefaultsOnly, Category = "Wrist Tracking",
meta=(EditCondition="TrackingHardware == ESGPositionalTrackingHardware::Custom", EditConditionHides))
FVector TrackingHardwareLocationOffsetLeftHand;
/**
* Valid only if TrackingHardware is set to Custom.
*/
UPROPERTY(Config, EditDefaultsOnly, Category = "Wrist Tracking",
meta=(EditCondition="TrackingHardware == ESGPositionalTrackingHardware::Custom", EditConditionHides))
FVector TrackingHardwareLocationOffsetRightHand;
/**
* Valid only if TrackingHardware is set to Custom.
*/
UPROPERTY(Config, EditDefaultsOnly, Category = "Wrist Tracking",
meta=(EditCondition="TrackingHardware == ESGPositionalTrackingHardware::Custom", EditConditionHides))
FRotator TrackingHardwareRotationOffsetLeftHand;
/**
* Valid only if TrackingHardware is set to Custom.
*/
UPROPERTY(Config, EditDefaultsOnly, Category = "Wrist Tracking",
meta=(EditCondition="TrackingHardware == ESGPositionalTrackingHardware::Custom", EditConditionHides))
FRotator TrackingHardwareRotationOffsetRightHand;
/**
* If enabled, draws debug Wrist trackers where possible.
*/
UPROPERTY(Config, EditDefaultsOnly, Category = "Wrist Tracking Debug")
uint8 bDrawWristTrackerDebugGizmo : 1;
/**
* Valid only if bDrawDebugWristTrackerGizmo is enabled.
*/
UPROPERTY(Config, EditDefaultsOnly, Category = "Wrist Tracking Debug",
meta=(EditCondition="bDrawWristTrackerDebugGizmo", EditConditionHides))
FSGDebugGizmoSettings WristTrackerDebugGizmoSettings;
UPROPERTY(Config, EditDefaultsOnly, Category = "SenseGlove")
FSGWristTrackingSettings WristTrackingSettings;
public:
USGSettings();
public:
FORCEINLINE ESGPositionalTrackingHardware GetTrackingHardware() const
FORCEINLINE const FSGWristTrackingSettings& GetWristTrackingSettings() const
{
return TrackingHardware;
return WristTrackingSettings;
}
FORCEINLINE void SetTrackingHardware(const ESGPositionalTrackingHardware InTrackingHardware)
void SetWristTrackingSettings(const FSGWristTrackingSettings& InWristTrackingSettings)
{
TrackingHardware = InTrackingHardware;
WristTrackingSettings = InWristTrackingSettings;
}
const FVector& GetTrackingHardwareLocationOffsetLeftHand() const;
void SetTrackingHardwareLocationOffsetLeftHand(const FVector& InTrackingHardwareLocationOffsetLeftHand);
const FVector& GetTrackingHardwareLocationOffsetRightHand() const;
void SetTrackingHardwareLocationOffsetRightHand(const FVector& InTrackingHardwareLocationOffsetRightHand);
const FRotator& GetTrackingHardwareRotationOffsetLeftHand() const;
void SetTrackingHardwareRotationOffsetLeftHand(const FRotator& InTrackingHardwareRotationOffsetLeftHand);
const FRotator& GetTrackingHardwareRotationOffsetRightHand() const;
void SetTrackingHardwareRotationOffsetRightHand(const FRotator& InTrackingHardwareRotationOffsetRightHand);
FORCEINLINE bool GetDrawWristTrackerDebugGizmo() const
{
return !!bDrawWristTrackerDebugGizmo;
}
void SetDrawWristTrackerDebugGizmo(const bool bInDrawWristTrackerDebugGizmo)
{
bDrawWristTrackerDebugGizmo = bInDrawWristTrackerDebugGizmo;
}
const FSGDebugGizmoSettings& GetWristTrackerDebugGizmoSettings() const;
void SetWristTrackerDebugGizmoSettings(const FSGDebugGizmoSettings& InWristTrackerDebugGizmoSettings);
public:
virtual bool ShouldCreateSubsystem(UObject* Outer) const override;
virtual void Initialize(FSubsystemCollectionBase& Collection) override;
virtual void Deinitialize() override;
public:
#if WITH_EDITOR
virtual bool CanEditChange(const FProperty* InProperty) const override;
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
#endif /* WITH_EDITOR */
};
@@ -0,0 +1,109 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2023 SenseGlove
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* @section DESCRIPTION
*
*
*/
#pragma once
#include "UObject/ObjectMacros.h"
#include "SGSettings/SGDebugGizmoSettings.h"
#include "SGTypes/SGCoreTypes.h"
#include "SGWristTrackingSettings.generated.h"
USTRUCT(BlueprintType)
struct SENSEGLOVESETTINGS_API FSGWristTrackingSettings
{
GENERATED_USTRUCT_BODY()
public:
/**
* If set to Custom, any desired location and rotation can be specified.
*/
UPROPERTY(Config, EditDefaultsOnly, Category = "Wrist Tracking")
ESGPositionalTrackingHardware TrackingHardware;
/**
* Valid only if TrackingHardware is set to Custom.
*/
UPROPERTY(Config, EditDefaultsOnly, Category = "Wrist Tracking",
meta=(EditCondition="TrackingHardware == ESGPositionalTrackingHardware::Custom", EditConditionHides))
FVector TrackingHardwareLocationOffsetLeftHand;
/**
* Valid only if TrackingHardware is set to Custom.
*/
UPROPERTY(Config, EditDefaultsOnly, Category = "Wrist Tracking",
meta=(EditCondition="TrackingHardware == ESGPositionalTrackingHardware::Custom", EditConditionHides))
FVector TrackingHardwareLocationOffsetRightHand;
/**
* Valid only if TrackingHardware is set to Custom.
*/
UPROPERTY(Config, EditDefaultsOnly, Category = "Wrist Tracking",
meta=(EditCondition="TrackingHardware == ESGPositionalTrackingHardware::Custom", EditConditionHides))
FRotator TrackingHardwareRotationOffsetLeftHand;
/**
* Valid only if TrackingHardware is set to Custom.
*/
UPROPERTY(Config, EditDefaultsOnly, Category = "Wrist Tracking",
meta=(EditCondition="TrackingHardware == ESGPositionalTrackingHardware::Custom", EditConditionHides))
FRotator TrackingHardwareRotationOffsetRightHand;
/**
* If enabled, draws debug Wrist trackers where possible.
*/
UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Wrist Tracking")
uint8 bDrawWristTrackerDebugGizmo : 1;
/**
* Valid only if bDrawDebugWristTrackerGizmo is enabled.
*/
UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Wrist Tracking",
meta=(EditCondition="bDrawWristTrackerDebugGizmo", EditConditionHides))
FSGDebugGizmoSettings WristTrackerDebugGizmoSettings;
public:
FSGWristTrackingSettings();
explicit FSGWristTrackingSettings(
ESGPositionalTrackingHardware InTrackingHardware,
const FVector& InTrackingHardwareLocationOffsetLeftHand,
const FVector& InTrackingHardwareLocationOffsetRightHand,
const FRotator& InTrackingHardwareRotationOffsetLeftHand,
const FRotator& InTrackingHardwareRotationOffsetRightHand,
bool bInDrawWristTrackerDebugGizmo,
const FSGDebugGizmoSettings& InWristTrackerDebugGizmoSettings);
};
@@ -42,79 +42,13 @@ USGSettings* USGSettingsKismetLibrary::GetInstance()
return USGSettings::GetInstance();
}
ESGPositionalTrackingHardware USGSettingsKismetLibrary::GetTrackingHardware(const USGSettings* Settings)
const FSGWristTrackingSettings& USGSettingsKismetLibrary::GetWristTrackingSettings(const USGSettings* Settings)
{
return Settings->GetTrackingHardware();
return Settings->GetWristTrackingSettings();
}
void USGSettingsKismetLibrary::SetTrackingHardware(
USGSettings* Settings, const ESGPositionalTrackingHardware InTrackingHardware)
void USGSettingsKismetLibrary::SetWristTrackingSettings(
USGSettings* Settings, const FSGWristTrackingSettings& InWristTrackingSettings)
{
Settings->SetTrackingHardware(InTrackingHardware);
}
const FVector& USGSettingsKismetLibrary::GetTrackingHardwareLocationOffsetLeftHand(const USGSettings* Settings)
{
return Settings->GetTrackingHardwareLocationOffsetLeftHand();
}
void USGSettingsKismetLibrary::SetTrackingHardwareLocationOffsetLeftHand(
USGSettings* Settings, const FVector& InTrackingHardwareLocationOffsetLeftHand)
{
Settings->SetTrackingHardwareLocationOffsetLeftHand(InTrackingHardwareLocationOffsetLeftHand);
}
const FVector& USGSettingsKismetLibrary::GetTrackingHardwareLocationOffsetRightHand(const USGSettings* Settings)
{
return Settings->GetTrackingHardwareLocationOffsetRightHand();
}
void USGSettingsKismetLibrary::SetTrackingHardwareLocationOffsetRightHand(
USGSettings* Settings, const FVector& InTrackingHardwareLocationOffsetRightHand)
{
Settings->SetTrackingHardwareLocationOffsetRightHand(InTrackingHardwareLocationOffsetRightHand);
}
const FRotator& USGSettingsKismetLibrary::GetTrackingHardwareRotationOffsetLeftHand(const USGSettings* Settings)
{
return Settings->GetTrackingHardwareRotationOffsetLeftHand();
}
void USGSettingsKismetLibrary::SetTrackingHardwareRotationOffsetLeftHand(
USGSettings* Settings, const FRotator& InTrackingHardwareRotationOffsetLeftHand)
{
Settings->SetTrackingHardwareRotationOffsetLeftHand(InTrackingHardwareRotationOffsetLeftHand);
}
const FRotator& USGSettingsKismetLibrary::GetTrackingHardwareRotationOffsetRightHand(const USGSettings* Settings)
{
return Settings->GetTrackingHardwareRotationOffsetRightHand();
}
void USGSettingsKismetLibrary::SetTrackingHardwareRotationOffsetRightHand(
USGSettings* Settings, const FRotator& InTrackingHardwareRotationOffsetRightHand)
{
Settings->SetTrackingHardwareRotationOffsetRightHand(InTrackingHardwareRotationOffsetRightHand);
}
bool USGSettingsKismetLibrary::GetDrawWristTrackerDebugGizmo(const USGSettings* Settings)
{
return Settings->GetDrawWristTrackerDebugGizmo();
}
void USGSettingsKismetLibrary::SetDrawWristTrackerDebugGizmo(
USGSettings* Settings, const bool bInDrawWristTrackerDebugGizmo)
{
Settings->SetDrawWristTrackerDebugGizmo(bInDrawWristTrackerDebugGizmo);
}
const FSGDebugGizmoSettings& USGSettingsKismetLibrary::GetWristTrackerDebugGizmoSettings(const USGSettings* Settings)
{
return Settings->GetWristTrackerDebugGizmoSettings();
}
void USGSettingsKismetLibrary::SetWristTrackerDebugGizmoSettings(USGSettings* Settings,
const FSGDebugGizmoSettings& InWristTrackerDebugGizmoSettings)
{
Settings->SetWristTrackerDebugGizmoSettings(InWristTrackerDebugGizmoSettings);
Settings->SetWristTrackingSettings(InWristTrackingSettings);
}
@@ -36,9 +36,7 @@
#pragma once
#include "SGKismet/SGBlueprintFunctionLibrary.h"
#include "SGTypes/SGCoreTypes.h"
#include "SGSettings/SGDebugGizmoSettings.h"
#include "SGSettings/SGWristTrackingSettings.h"
#include "SGSettingsKismetLibrary.generated.h"
@@ -54,50 +52,9 @@ public:
static USGSettings* GetInstance();
UFUNCTION(BlueprintPure, Category="SenseGlove | Settings")
static ESGPositionalTrackingHardware GetTrackingHardware(const USGSettings* Settings);
static const FSGWristTrackingSettings& GetWristTrackingSettings(const USGSettings* Settings);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Settings")
static void SetTrackingHardware(UPARAM(ref) USGSettings* Settings,
ESGPositionalTrackingHardware InTrackingHardware);
UFUNCTION(BlueprintPure, Category="SenseGlove | Settings")
static const FVector& GetTrackingHardwareLocationOffsetLeftHand(const USGSettings* Settings);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Settings")
static void SetTrackingHardwareLocationOffsetLeftHand(UPARAM(ref) USGSettings* Settings,
const FVector& InTrackingHardwareLocationOffsetLeftHand);
UFUNCTION(BlueprintPure, Category="SenseGlove | Settings")
static const FVector& GetTrackingHardwareLocationOffsetRightHand(const USGSettings* Settings);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Settings")
static void SetTrackingHardwareLocationOffsetRightHand(UPARAM(ref) USGSettings* Settings,
const FVector& InTrackingHardwareLocationOffsetRightHand);
UFUNCTION(BlueprintPure, Category="SenseGlove | Settings")
static const FRotator& GetTrackingHardwareRotationOffsetLeftHand(const USGSettings* Settings);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Settings")
static void SetTrackingHardwareRotationOffsetLeftHand(UPARAM(ref) USGSettings* Settings,
const FRotator& InTrackingHardwareRotationOffsetLeftHand);
UFUNCTION(BlueprintPure, Category="SenseGlove | Settings")
static const FRotator& GetTrackingHardwareRotationOffsetRightHand(const USGSettings* Settings);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Settings")
static void SetTrackingHardwareRotationOffsetRightHand(UPARAM(ref) USGSettings* Settings,
const FRotator& InTrackingHardwareRotationOffsetRightHand);
UFUNCTION(BlueprintPure, Category="SenseGlove | Settings")
static bool GetDrawWristTrackerDebugGizmo(const USGSettings* Settings);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Settings")
static void SetDrawWristTrackerDebugGizmo(UPARAM(ref) USGSettings* Settings, bool bInDrawWristTrackerDebugGizmo);
UFUNCTION(BlueprintPure, Category="SenseGlove | Settings")
static const FSGDebugGizmoSettings& GetWristTrackerDebugGizmoSettings(const USGSettings* Settings);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Settings")
static void SetWristTrackerDebugGizmoSettings(UPARAM(ref) USGSettings* Settings,
const FSGDebugGizmoSettings& InWristTrackerDebugGizmoSettings);
static void SetWristTrackingSettings(UPARAM(ref) USGSettings* Settings,
const FSGWristTrackingSettings& InWristTrackingSettings);
};