introduce bValidateIfDefaultClassesAreSGCompliant

This commit is contained in:
Mamadou Babaei
2024-06-07 00:08:31 +02:00
parent 308a70eddf
commit da513b653b
5 changed files with 140 additions and 1 deletions
+2 -1
View File
@@ -26,6 +26,7 @@ This is a minor release focusing mainly on bringing OpenXR-compatible hand track
- Added USGWristTrackerComponent::OnWristDeviceVisualTypeChanged event in order to be able to notify other components/actors whenever the wrist-tracking device switches between hand tracking or motion controllers.
- Added the SenseGloveDebugKismet module in order to allow drawing of debugging gizmos and virtual hands from Blueprint.
- Added a new static Draw() method overload to DebugGizmo which allows passing an FQuat instead of a FRotator.
- Introduced the SGInitializationSettings in order to control how the plugin is initialized.
- Introduced the SGGameUserSettings for managing Engine Scalability Settings through the SenseGlove plugin.
### Fixed
@@ -34,7 +35,7 @@ This is a minor release focusing mainly on bringing OpenXR-compatible hand track
### Changed
- Now, the SenseGlove plugin checks for default SenseGlove-compliant GameMode, GameInstance, etc, at module initialization and tries to set to default, native SenseGlove classes, if any of those default classes are not a SenseGlove or a SenseGlove-derived class.
- Now, if bValidateIfDefaultClassesAreSGCompliant option from SGInitializationSettings is enabled (default) the SenseGlove plugin checks for default SenseGlove-compliant GameMode, GameInstance, etc, at module initialization and tries to set to default, native SenseGlove classes, if any of those default classes are not a SenseGlove or a SenseGlove-derived class.
- The SGSettings has been fully revamped with more customizations added and categorized in a different manner.
- The SGSettings constructor visibility has been changed from public to private.
- The SenseGlove libraries have been updated to v2.103.0-4a8bd81d.
@@ -36,10 +36,12 @@
#include "SenseGloveModule.h"
#include "GameMapsSettings.h"
#include "SGLog/SGLog.h"
#include "SenseGlove/Engine/SGGameInstance.h"
#include "SenseGlove/GameFramework/SGGameModeBase.h"
#include "SenseGlove/GameFramework/SGGameUserSettings.h"
#include "SGSettings/SGSettings.h"
#define LOCTEXT_NAMESPACE "FSenseGloveModule"
@@ -70,6 +72,17 @@ void FSenseGloveModule::ShutdownModule()
void FSenseGloveModule::OnPostEngineInit() const
{
const FSGInitializationSettings& Settings{
USGSettings::GetInstance()->GetInitializationSettings()
};
if (!Settings.bValidateIfDefaultClassesAreSGCompliant)
{
SGLOG("Will not be checking whether the default classes are SenseGlove-compliant, or not since it's disabled!");
return;
}
SGLOG("Checking whether the default classes are SenseGlove-compliant, or not...");
SGLOG("Checking whether the GameMapsSettings is compliant with SenseGlove, or not...");
UGameMapsSettings* GameMapsSettings{UGameMapsSettings::GetGameMapsSettings()};
@@ -0,0 +1,48 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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/SGInitializationSettings.h"
FSGInitializationSettings::FSGInitializationSettings()
: FSGInitializationSettings(
true)
{
}
FSGInitializationSettings::FSGInitializationSettings(
const bool bInValidateIfDefaultClassesAreSGCompliant)
: bValidateIfDefaultClassesAreSGCompliant(bInValidateIfDefaultClassesAreSGCompliant)
{
}
@@ -0,0 +1,64 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 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 "SGInitializationSettings.generated.h"
/**
* Implements the glove tracking settings for the SenseGlove Tracking module.
*/
USTRUCT(BlueprintType)
struct SENSEGLOVESETTINGS_API FSGInitializationSettings
{
GENERATED_USTRUCT_BODY()
public:
/**
* If enabled, the plugin tries to check and validate whether the default classes such as GameMode, GameInstance,
* etc. are indeed SenseGlove classes or SenseGlove-derived classes. If not, it attempts to set them. If you don't
* like this behavior for whatever reason, consider disabling this option.
*/
UPROPERTY(Config, EditDefaultsOnly, Category="Glove Tracking")
uint8 bValidateIfDefaultClassesAreSGCompliant : 1;
public:
FSGInitializationSettings();
explicit FSGInitializationSettings(
bool bInValidateIfDefaultClassesAreSGCompliant);
};
@@ -43,6 +43,7 @@
#include "UObject/ObjectMacros.h"
#include "SGSettings/SGGameUserSettingSettings.h"
#include "SGSettings/SGInitializationSettings.h"
#include "SGSettings/SGTrackingSettings.h"
#include "SGSettings.generated.h"
@@ -70,6 +71,9 @@ private:
FImplDeleter PimplDeleter;
private:
UPROPERTY(Config, EditDefaultsOnly, Category = "SenseGlove")
FSGInitializationSettings InitializationSettings;
UPROPERTY(Config, EditDefaultsOnly, Category = "SenseGlove")
FSGGameUserSettingSettings GameUserSettings;
@@ -80,6 +84,15 @@ private:
USGSettings();
public:
FORCEINLINE const FSGInitializationSettings& GetInitializationSettings() const
{
return InitializationSettings;
}
void SetInitializationSettings(const FSGInitializationSettings& InInitializationSettings)
{
InitializationSettings = InInitializationSettings;
}
FORCEINLINE const FSGGameUserSettingSettings& GetGameUserSettings() const
{
return GameUserSettings;