2021-04-08 14:32:07 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
2022-08-26 17:40:42 -04:00
|
|
|
#include "CommonInputPrivate.h"
|
2022-12-19 13:28:22 -05:00
|
|
|
#include "CommonInputSettings.h"
|
2021-04-08 14:32:07 -04:00
|
|
|
#include "ICommonInputModule.h"
|
2022-11-03 14:18:47 -04:00
|
|
|
#include "UObject/Package.h"
|
2021-04-08 14:32:07 -04:00
|
|
|
#if WITH_EDITOR
|
|
|
|
|
#include "ISettingsModule.h"
|
|
|
|
|
#endif // WITH_EDITOR
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Implements the FCommonInputModule module.
|
|
|
|
|
*/
|
|
|
|
|
class FCommonInputModule
|
|
|
|
|
: public ICommonInputModule
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
FCommonInputModule();
|
|
|
|
|
virtual void StartupModule() override;
|
|
|
|
|
virtual void ShutdownModule() override;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual UCommonInputSettings* GetSettingsInstance() const override;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void CreateInputSettings();
|
|
|
|
|
|
|
|
|
|
UCommonInputSettings* CommonInputSettings;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FCommonInputModule::FCommonInputModule()
|
|
|
|
|
{
|
|
|
|
|
CommonInputSettings = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FCommonInputModule::StartupModule()
|
|
|
|
|
{
|
|
|
|
|
CreateInputSettings();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FCommonInputModule::CreateInputSettings()
|
|
|
|
|
{
|
|
|
|
|
CommonInputSettings = NewObject<UCommonInputSettings>(GetTransientPackage(), UCommonInputSettings::StaticClass());
|
|
|
|
|
check(CommonInputSettings);
|
|
|
|
|
CommonInputSettings->AddToRoot();
|
|
|
|
|
|
|
|
|
|
#if WITH_EDITOR
|
|
|
|
|
|
|
|
|
|
// Register settings
|
|
|
|
|
ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings");
|
|
|
|
|
|
CommonInput - Using the new UPlatformSettings, to store per-platform information into an NDA location when each platform is configured. These changes make it so we use the 'real' platform ini name, e.g. There's no more "PC" platform as far as the common input exists for configuring the platforms. So if you setup linux, that's another platform you'd configure. The gamepads are still wonky, they're trying to use platform ini names for gamepad names, going to refactor that so it's not coming from platform names. Made an upgrade path for the old settings that will update and then clear the old configuration. Also removed some settings that were added to DataDrivenPlatformInfo that don't make sense, and updated some platforms that never got the settings to begin with.
#review-16605256 Josh.Adams, Michael.Noland, Daren.Cheng
#fyi Josh.Adams, Michael.Noland, Daren.Cheng
[CL 16605253 by Nick Darnell in ue5-main branch]
2021-06-09 10:44:46 -04:00
|
|
|
//if (SettingsModule != nullptr)
|
|
|
|
|
//{
|
|
|
|
|
// ISettingsSectionPtr SettingsSection = SettingsModule->RegisterSettings("Project", "Plugins", "CommonInput",
|
|
|
|
|
// NSLOCTEXT("CommonInputPlugin", "CommonInputSettingsName", "Common Input"),
|
|
|
|
|
// NSLOCTEXT("CommonInputPlugin", "CommonInputSettingsDescription", "Configure Common Input defaults."),
|
|
|
|
|
// CommonInputSettings
|
|
|
|
|
// );
|
|
|
|
|
//}
|
2021-04-08 14:32:07 -04:00
|
|
|
|
|
|
|
|
#endif //WITH_EDITOR
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FCommonInputModule::ShutdownModule()
|
|
|
|
|
{
|
|
|
|
|
#if WITH_EDITOR
|
|
|
|
|
// Unregister settings
|
|
|
|
|
ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings");
|
|
|
|
|
|
|
|
|
|
if (SettingsModule != nullptr)
|
|
|
|
|
{
|
|
|
|
|
SettingsModule->UnregisterSettings("Project", "Plugins", "CommonInput");
|
|
|
|
|
}
|
|
|
|
|
#endif //WITH_EDITOR
|
|
|
|
|
|
|
|
|
|
if (!GExitPurge) // If GExitPurge Object is already gone
|
|
|
|
|
{
|
|
|
|
|
CommonInputSettings->RemoveFromRoot();
|
|
|
|
|
}
|
|
|
|
|
CommonInputSettings = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UCommonInputSettings* FCommonInputModule::GetSettingsInstance() const
|
|
|
|
|
{
|
|
|
|
|
return CommonInputSettings;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_MODULE(FCommonInputModule, CommonInput);
|
|
|
|
|
|
2022-12-19 13:28:22 -05:00
|
|
|
DEFINE_LOG_CATEGORY(LogCommonInput);
|