refactor the newly added motion source settings and off-load them from the wrist tracker to the settings system, though this causes crashes still
This commit is contained in:
@@ -106,11 +106,6 @@ USGWristTrackerComponent::USGWristTrackerComponent(const FObjectInitializer& Obj
|
||||
SetReceivesDecals(false);
|
||||
SetCanEverAffectNavigation(false);
|
||||
|
||||
LeftHandMotionSource = EControllerHand::Left;
|
||||
RightHandMotionSource = EControllerHand::Right;
|
||||
|
||||
SetRight(true);
|
||||
|
||||
bOverridePluginWristTrackingSettings = false;
|
||||
WristTrackingSettings = FSGWristTrackingSettings(
|
||||
ESGPositionalTrackingHardware::None,
|
||||
@@ -118,6 +113,8 @@ USGWristTrackerComponent::USGWristTrackerComponent(const FObjectInitializer& Obj
|
||||
FVector::ZeroVector,
|
||||
FRotator::ZeroRotator,
|
||||
FRotator::ZeroRotator,
|
||||
EControllerHand::Left,
|
||||
EControllerHand::Right,
|
||||
false,
|
||||
FSGDebugGizmoSettings(
|
||||
4.0f, 1.0f,
|
||||
@@ -132,6 +129,8 @@ USGWristTrackerComponent::USGWristTrackerComponent(const FObjectInitializer& Obj
|
||||
Glove = nullptr;
|
||||
WristLocation = FVector::ZeroVector;
|
||||
WristRotation = FRotator::ZeroRotator;
|
||||
|
||||
SetRight(true);
|
||||
}
|
||||
|
||||
const FSGWristTrackingSettings& USGWristTrackerComponent::GetWristTrackingSettings() const
|
||||
@@ -141,7 +140,13 @@ const FSGWristTrackingSettings& USGWristTrackerComponent::GetWristTrackingSettin
|
||||
return WristTrackingSettings;
|
||||
}
|
||||
|
||||
return USGSettings::GetInstance()->GetWristTrackingSettings();
|
||||
const USGSettings* Settings{USGSettings::GetInstance()};
|
||||
if (!ensureAlwaysMsgf(Settings, TEXT("The settings subsystem has not been initialized!")))
|
||||
{
|
||||
return WristTrackingSettings;
|
||||
}
|
||||
|
||||
return Settings->GetWristTrackingSettings();
|
||||
}
|
||||
|
||||
void USGWristTrackerComponent::SetWristTrackingSettings(const FSGWristTrackingSettings& InWristTrackingSettings)
|
||||
@@ -155,7 +160,9 @@ void USGWristTrackerComponent::SetWristTrackingSettings(const FSGWristTrackingSe
|
||||
|
||||
void USGWristTrackerComponent::SetRight(const bool bRight)
|
||||
{
|
||||
SetTrackingSource(bRight ? GetRightHandMotionSource() : GetLeftHandMotionSource());
|
||||
SetTrackingSource(bRight
|
||||
? GetWristTrackingSettings().LeftHandMotionSource
|
||||
: GetWristTrackingSettings().RightHandMotionSource);
|
||||
}
|
||||
|
||||
#if WITH_EDITOR
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "InputCoreTypes.h"
|
||||
#include "Math/Rotator.h"
|
||||
#include "Math/Vector.h"
|
||||
#include "MotionControllerComponent.h"
|
||||
@@ -95,20 +94,6 @@ private:
|
||||
FImplDeleter PimplDeleter;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Determines which motion source to use.
|
||||
* For Oculus this is usually Left, and for VIVE usually LeftFoot.
|
||||
*/
|
||||
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
||||
EControllerHand LeftHandMotionSource;
|
||||
|
||||
/**
|
||||
* Determines which motion source to use.
|
||||
* For Oculus this is usually Right, and for VIVE usually RightFoot.
|
||||
*/
|
||||
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
||||
EControllerHand RightHandMotionSource;
|
||||
|
||||
/**
|
||||
* Determines whether to override the plugin's wrist tracking settings or not.
|
||||
*/
|
||||
@@ -136,26 +121,6 @@ private:
|
||||
FRotator WristRotation;
|
||||
|
||||
public:
|
||||
FORCEINLINE EControllerHand GetLeftHandMotionSource() const
|
||||
{
|
||||
return LeftHandMotionSource;
|
||||
}
|
||||
|
||||
void SetLeftHandMotionSource(const EControllerHand InLeftHandMotionSource)
|
||||
{
|
||||
LeftHandMotionSource = InLeftHandMotionSource;
|
||||
}
|
||||
|
||||
FORCEINLINE EControllerHand GetRightHandMotionSource() const
|
||||
{
|
||||
return RightHandMotionSource;
|
||||
}
|
||||
|
||||
void SetRightHandMotionSource(const EControllerHand InRightHandMotionSource)
|
||||
{
|
||||
RightHandMotionSource = InRightHandMotionSource;
|
||||
}
|
||||
|
||||
FORCEINLINE bool OverridesPluginWristTrackingSettings() const
|
||||
{
|
||||
return !!bOverridePluginWristTrackingSettings;
|
||||
@@ -171,12 +136,12 @@ public:
|
||||
|
||||
FORCEINLINE bool IsLeft() const
|
||||
{
|
||||
return GetTrackingSource() == GetLeftHandMotionSource();
|
||||
return GetTrackingSource() == GetWristTrackingSettings().LeftHandMotionSource;
|
||||
}
|
||||
|
||||
FORCEINLINE bool IsRight() const
|
||||
{
|
||||
return GetTrackingSource() == GetRightHandMotionSource();
|
||||
return GetTrackingSource() == GetWristTrackingSettings().RightHandMotionSource;
|
||||
}
|
||||
|
||||
void SetRight(const bool bRight);
|
||||
|
||||
@@ -37,30 +37,6 @@
|
||||
|
||||
#include "SenseGlove/Components/SGWristTrackerComponent.h"
|
||||
|
||||
EControllerHand UWristTrackerComponentKismetLibrary::GetLeftHandMotionSource(
|
||||
const USGWristTrackerComponent* WristTrackerComponent)
|
||||
{
|
||||
return WristTrackerComponent->GetLeftHandMotionSource();
|
||||
}
|
||||
|
||||
void UWristTrackerComponentKismetLibrary::SetLeftHandMotionSource(
|
||||
USGWristTrackerComponent* WristTrackerComponent, const EControllerHand InLeftHandMotionSource)
|
||||
{
|
||||
WristTrackerComponent->SetLeftHandMotionSource(InLeftHandMotionSource);
|
||||
}
|
||||
|
||||
EControllerHand UWristTrackerComponentKismetLibrary::GetRightHandMotionSource(
|
||||
const USGWristTrackerComponent* WristTrackerComponent)
|
||||
{
|
||||
return WristTrackerComponent->GetRightHandMotionSource();
|
||||
}
|
||||
|
||||
void UWristTrackerComponentKismetLibrary::SetRightHandMotionSource(
|
||||
USGWristTrackerComponent* WristTrackerComponent, const EControllerHand InRightHandMotionSource)
|
||||
{
|
||||
WristTrackerComponent->SetRightHandMotionSource(InRightHandMotionSource);
|
||||
}
|
||||
|
||||
bool UWristTrackerComponentKismetLibrary::OverridesPluginWristTrackingSettings(
|
||||
const USGWristTrackerComponent* WristTrackerComponent)
|
||||
{
|
||||
|
||||
@@ -37,8 +37,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "InputCoreTypes.h"
|
||||
|
||||
#include "SGKismet/SGBlueprintFunctionLibrary.h"
|
||||
#include "SGSettings/SGWristTrackingSettings.h"
|
||||
|
||||
@@ -55,20 +53,6 @@ class SENSEGLOVEKISMET_API UWristTrackerComponentKismetLibrary final : public US
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Wrist Tracker Component")
|
||||
static EControllerHand GetLeftHandMotionSource(const USGWristTrackerComponent* WristTrackerComponent);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Wrist Tracker Component")
|
||||
static void SetLeftHandMotionSource(UPARAM(ref) USGWristTrackerComponent* WristTrackerComponent,
|
||||
EControllerHand InLeftHandMotionSource);
|
||||
|
||||
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Wrist Tracker Component")
|
||||
static EControllerHand GetRightHandMotionSource(const USGWristTrackerComponent* WristTrackerComponent);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Wrist Tracker Component")
|
||||
static void SetRightHandMotionSource(UPARAM(ref) USGWristTrackerComponent* WristTrackerComponent,
|
||||
EControllerHand InRightHandMotionSource);
|
||||
|
||||
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Wrist Tracker Component")
|
||||
static bool OverridesPluginWristTrackingSettings(const USGWristTrackerComponent* WristTrackerComponent);
|
||||
|
||||
|
||||
@@ -55,7 +55,6 @@ public class SenseGloveKismet : ModuleRules
|
||||
"CoreUObject",
|
||||
"Engine",
|
||||
"HeadMountedDisplay",
|
||||
"InputCore",
|
||||
"SenseGlove",
|
||||
"SenseGloveCore",
|
||||
"SenseGloveLog",
|
||||
|
||||
@@ -65,6 +65,11 @@ struct USGSettings::FImpl
|
||||
|
||||
USGSettings* USGSettings::GetInstance()
|
||||
{
|
||||
if (!ensureAlwaysMsgf(GEngine, TEXT("The engine has not been initialized!")))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
USGSettings* Instance{GEngine->GetEngineSubsystem<USGSettings>()};
|
||||
return Instance;
|
||||
}
|
||||
@@ -78,6 +83,8 @@ USGSettings::USGSettings()
|
||||
FVector::ZeroVector,
|
||||
FRotator::ZeroRotator,
|
||||
FRotator::ZeroRotator,
|
||||
EControllerHand::Left,
|
||||
EControllerHand::Right,
|
||||
false,
|
||||
FSGDebugGizmoSettings(
|
||||
4.0f, 1.0f,
|
||||
|
||||
@@ -41,6 +41,8 @@ FSGWristTrackingSettings::FSGWristTrackingSettings()
|
||||
TrackingHardwareLocationOffsetRightHand(FVector::ZeroVector),
|
||||
TrackingHardwareRotationOffsetLeftHand(FRotator::ZeroRotator),
|
||||
TrackingHardwareRotationOffsetRightHand(FRotator::ZeroRotator),
|
||||
LeftHandMotionSource(EControllerHand::Left),
|
||||
RightHandMotionSource(EControllerHand::Right),
|
||||
bDrawWristTrackerDebugGizmo(false),
|
||||
WristTrackerDebugGizmoSettings(FSGDebugGizmoSettings())
|
||||
{
|
||||
@@ -52,6 +54,8 @@ FSGWristTrackingSettings::FSGWristTrackingSettings(
|
||||
const FVector& InTrackingHardwareLocationOffsetRightHand,
|
||||
const FRotator& InTrackingHardwareRotationOffsetLeftHand,
|
||||
const FRotator& InTrackingHardwareRotationOffsetRightHand,
|
||||
const EControllerHand InLeftHandMotionSource,
|
||||
const EControllerHand InRightHandMotionSource,
|
||||
const bool bInDrawWristTrackerDebugGizmo,
|
||||
const FSGDebugGizmoSettings& InWristTrackerDebugGizmoSettings)
|
||||
: TrackingHardware(InTrackingHardware),
|
||||
@@ -59,6 +63,8 @@ FSGWristTrackingSettings::FSGWristTrackingSettings(
|
||||
TrackingHardwareLocationOffsetRightHand(InTrackingHardwareLocationOffsetRightHand),
|
||||
TrackingHardwareRotationOffsetLeftHand(InTrackingHardwareRotationOffsetLeftHand),
|
||||
TrackingHardwareRotationOffsetRightHand(InTrackingHardwareRotationOffsetRightHand),
|
||||
LeftHandMotionSource(InLeftHandMotionSource),
|
||||
RightHandMotionSource(InRightHandMotionSource),
|
||||
bDrawWristTrackerDebugGizmo(bInDrawWristTrackerDebugGizmo),
|
||||
WristTrackerDebugGizmoSettings(InWristTrackerDebugGizmoSettings)
|
||||
{
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "InputCoreTypes.h"
|
||||
#include "UObject/ObjectMacros.h"
|
||||
|
||||
#include "SGSettings/SGDebugGizmoSettings.h"
|
||||
@@ -82,6 +83,20 @@ public:
|
||||
meta=(EditCondition="TrackingHardware == ESGPositionalTrackingHardware::Custom", EditConditionHides))
|
||||
FRotator TrackingHardwareRotationOffsetRightHand;
|
||||
|
||||
/**
|
||||
* Determines which motion source to use.
|
||||
* For Oculus this is usually Left, and for VIVE usually LeftFoot.
|
||||
*/
|
||||
UPROPERTY(Config, EditDefaultsOnly, Category="Wrist Tracking")
|
||||
EControllerHand LeftHandMotionSource;
|
||||
|
||||
/**
|
||||
* Determines which motion source to use.
|
||||
* For Oculus this is usually Right, and for VIVE usually RightFoot.
|
||||
*/
|
||||
UPROPERTY(Config, EditDefaultsOnly, Category="Wrist Tracking")
|
||||
EControllerHand RightHandMotionSource;
|
||||
|
||||
/**
|
||||
* If enabled, draws debug Wrist trackers where possible.
|
||||
*/
|
||||
@@ -104,6 +119,8 @@ public:
|
||||
const FVector& InTrackingHardwareLocationOffsetRightHand,
|
||||
const FRotator& InTrackingHardwareRotationOffsetLeftHand,
|
||||
const FRotator& InTrackingHardwareRotationOffsetRightHand,
|
||||
EControllerHand InLeftHandMotionSource,
|
||||
EControllerHand InRightHandMotionSource,
|
||||
bool bInDrawWristTrackerDebugGizmo,
|
||||
const FSGDebugGizmoSettings& InWristTrackerDebugGizmoSettings);
|
||||
};
|
||||
@@ -54,6 +54,7 @@ public class SenseGloveSettings : ModuleRules
|
||||
{
|
||||
"CoreUObject",
|
||||
"Engine",
|
||||
"InputCore",
|
||||
"SenseGloveCore",
|
||||
"SenseGloveLog",
|
||||
"SenseGloveTypes",
|
||||
|
||||
Reference in New Issue
Block a user