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