add the console commands SG_GetEngineScalabilitySettings and SG_SetEngineScalabilitySettings
This commit is contained in:
@@ -51,6 +51,10 @@ Welcom to the SenseGlove Unreal Engine Handbook!
|
||||
- [Touch](plugin-configuration/plugin-settings/virtual-hand/touch.md)
|
||||
- [Overriding Settings](plugin-configuration/overriding-settings/README.md)
|
||||
|
||||
# 💡 Miscellaneous
|
||||
|
||||
- [SenseGlove Console Commands](misc/console-commands/README.md)
|
||||
|
||||
# 🛠️ Advanced Topics
|
||||
|
||||
- [Safe Glove Access in Blueprint](advanced-topics/safe-glove-access-blueprint/README.md)
|
||||
|
||||
@@ -61,6 +61,7 @@ This is a minor release focusing mainly on bringing OpenXR-compatible hand track
|
||||
- Introduced the FSGGameUserSettings for managing the Engine Scalability Settings through the SenseGlove plugin in order to change the graphics settings on the fly.
|
||||
- Added USGGameUserSettingsKismetLibrary in order to allow all the Engine Scalability Settings to be managed from the Blueprint side.
|
||||
- Added FSGGameUserSettingsSettings config struct.
|
||||
- Added the SenseGlove console commands: SG_GetEngineScalabilitySettings() and SG_SetEngineScalabilitySettings(Scalability).
|
||||
- Added SGHardwareBenchmarkingSettings config struct.
|
||||
- Introduced ESGEngineScalabilitySettings enum.
|
||||
- Added FSGVirtualHandSettingsOverrides config struct used by the new settings override system.
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
# The SenseGlove Console Commands
|
||||
|
||||
The SenseGlove Unreal Engine Plugin offers a variety of utility console commands to enhance your development experience.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> To ensure the SenseGlove console commands are registered and recognized by
|
||||
> Unreal Engine, set the default Game Instance class to `SGGameInstance` or a
|
||||
> subclass of it. This can be done through:
|
||||
> `Project Settings > Project > Maps & Modes > Game Instance > Game Instance Class`.
|
||||
> Failing to do so will result in the error: `Command not recognized: SG_*` in
|
||||
> the logs. For more details, refer to
|
||||
> [SGGameInstance](../../setup-senseglove-default-classes/sggameinstance.md).
|
||||
|
||||
## SGGameUserSettings Console Commands
|
||||
|
||||
> [!CAUTION]
|
||||
> Before running any of the following console commands, ensure that the default
|
||||
> Game User Settings class is set to `SGGameUserSettings` or a subclass of it.
|
||||
> This can be configured via:
|
||||
> `Project Settings > Engine > General Settings > Default Classes > Advanced > Game User Settings Class`.
|
||||
> Failure to set this correctly will cause your simulation or editor to crash
|
||||
> upon calling any of the following console commands. For more information,
|
||||
> refer to
|
||||
> [SGGameUserSettings](../../setup-senseglove-default-classes/sggameusersettings.md).
|
||||
|
||||
### SG_GetEngineScalabilitySettings
|
||||
|
||||
This console command prints the current Engine Scalability Settings to the logs.
|
||||
|
||||
### SG_SetEngineScalabilitySettings
|
||||
|
||||
This console command sets the Engine Scalability Settings for both the current game and the editor. It accepts a `Scalability` parameter with the following valid values:
|
||||
|
||||
- `Low`
|
||||
- `Medium`
|
||||
- `High`
|
||||
- `Epic`
|
||||
- `Cinematic`
|
||||
- `Auto`
|
||||
|
||||
> [!NOTE]
|
||||
> The `Auto` option is used for benchmarking purposes. It will adjust the engine
|
||||
> scalability settings to one of the other levels based on the benchmarking
|
||||
> results.
|
||||
@@ -49,6 +49,12 @@ This section provides detailed information on configuring the plugin:
|
||||
- [Touch](../plugin-configuration/plugin-settings/virtual-hand/touch.md)
|
||||
- [Overriding Settings](../plugin-configuration/overriding-settings/)
|
||||
|
||||
## 💡 Miscellaneous
|
||||
|
||||
Toipcs that do not fall under any specific category:
|
||||
|
||||
- [SenseGlove Console Commands](../misc/console-commands/)
|
||||
|
||||
## 🛠️ Advanced Topics
|
||||
|
||||
For users familiar with the basics, this section explores advanced features of the plugin:
|
||||
|
||||
@@ -40,6 +40,39 @@
|
||||
#include "SenseGlove/GameFramework/SGGameUserSettings.h"
|
||||
#include "SGLog/SGLog.h"
|
||||
|
||||
void USGGameInstance::SG_GetEngineScalabilitySettings()
|
||||
{
|
||||
const USGGameUserSettings* GameUserSettings{USGGameUserSettings::GetInstance()};
|
||||
ensureAlwaysMsgf(GameUserSettings, TEXT("Invalid GameUserSettings!"));
|
||||
|
||||
static UEnum* EnumPtr{StaticEnum<ESGEngineScalabilitySettings>()};
|
||||
ensureAlwaysMsgf(EnumPtr, TEXT("Failed to find the ESGEngineScalabilitySettings enum!"));
|
||||
|
||||
const ESGEngineScalabilitySettings Scalability = GameUserSettings->GetEngineScalabilitySettings();
|
||||
const FName ScalabilityName{
|
||||
EnumPtr->GetNameByValue(static_cast<int64>(Scalability))
|
||||
};
|
||||
|
||||
SGLOG("Get Engine Scalability Settings", ScalabilityName);
|
||||
}
|
||||
|
||||
void USGGameInstance::SG_SetEngineScalabilitySettings(const ESGEngineScalabilitySettings Scalability)
|
||||
{
|
||||
USGGameUserSettings* GameUserSettings{USGGameUserSettings::GetInstance()};
|
||||
ensureAlwaysMsgf(GameUserSettings, TEXT("Invalid GameUserSettings!"));
|
||||
|
||||
static UEnum* EnumPtr{StaticEnum<ESGEngineScalabilitySettings>()};
|
||||
ensureAlwaysMsgf(EnumPtr, TEXT("Failed to find the ESGEngineScalabilitySettings enum!"));
|
||||
|
||||
GameUserSettings->SetEngineScalabilitySettings(Scalability);
|
||||
|
||||
const FName ScalabilityName{
|
||||
EnumPtr->GetNameByValue(static_cast<int64>(Scalability))
|
||||
};
|
||||
|
||||
SGLOG("Set Engine Scalability Settings", ScalabilityName);
|
||||
}
|
||||
|
||||
USGGameInstance::USGGameInstance(const FObjectInitializer& ObjectInitializer)
|
||||
: Super(ObjectInitializer)
|
||||
{
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
|
||||
#include "Engine/GameInstance.h"
|
||||
|
||||
#include "SGTypes/SGTypes.h"
|
||||
|
||||
#include "SGGameInstance.generated.h"
|
||||
|
||||
UCLASS(config=Game, Transient, BlueprintType, Blueprintable)
|
||||
@@ -44,6 +46,13 @@ class SENSEGLOVE_API USGGameInstance : public UGameInstance
|
||||
{
|
||||
GENERATED_UCLASS_BODY()
|
||||
|
||||
public:
|
||||
UFUNCTION(Exec, Category = "Console Command")
|
||||
static void SG_GetEngineScalabilitySettings();
|
||||
|
||||
UFUNCTION(Exec, Category = "Console Command")
|
||||
static void SG_SetEngineScalabilitySettings(ESGEngineScalabilitySettings Scalability);
|
||||
|
||||
public:
|
||||
virtual void Init() override;
|
||||
virtual void Shutdown() override;
|
||||
|
||||
Reference in New Issue
Block a user