2021-04-08 14:32:07 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#include "CommonInputSettings.h"
|
|
|
|
|
#include "CommonInputPrivatePCH.h"
|
|
|
|
|
#include "Engine/UserInterfaceSettings.h"
|
|
|
|
|
#include "Engine/StreamableManager.h"
|
|
|
|
|
#include "Engine/AssetManager.h"
|
|
|
|
|
#include "Misc/DataDrivenPlatformInfoRegistry.h"
|
2021-06-09 12:12:20 -04:00
|
|
|
#include "CommonInputBaseTypes.h"
|
|
|
|
|
#include "Engine/PlatformSettings.h"
|
2021-04-08 14:32:07 -04:00
|
|
|
|
|
|
|
|
UCommonInputSettings::UCommonInputSettings(const FObjectInitializer& Initializer)
|
|
|
|
|
: Super(Initializer)
|
|
|
|
|
, bInputDataLoaded(false)
|
|
|
|
|
{
|
2021-06-09 13:07:10 -04:00
|
|
|
#if WITH_EDITOR
|
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.
Josh.Adams, Michael.Noland, Daren.Cheng
[FYI] Josh.Adams, Michael.Noland, Daren.Cheng
#ROBOMERGE-SOURCE: CL 16605253 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v828-16531559)
[CL 16605300 by nick darnell in ue5-release-engine-test branch]
2021-06-09 10:46:45 -04:00
|
|
|
PlatformInput.Settings = UPlatformSettings::GetAllPlatformSettings<UCommonInputPlatformSettings>();
|
2021-06-09 13:07:10 -04:00
|
|
|
#endif
|
2021-04-08 14:32:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UCommonInputSettings::LoadData()
|
|
|
|
|
{
|
|
|
|
|
LoadInputData();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if WITH_EDITOR
|
|
|
|
|
void UCommonInputSettings::PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent)
|
|
|
|
|
{
|
|
|
|
|
bInputDataLoaded = false;
|
|
|
|
|
LoadData();
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
void UCommonInputSettings::LoadInputData()
|
|
|
|
|
{
|
|
|
|
|
if (!bInputDataLoaded)
|
|
|
|
|
{
|
|
|
|
|
// If we were created early enough to be disregarded by the GC (which we should be), then we need to
|
|
|
|
|
// add all of our members to the root set, since our hard reference to them is totally meaningless to the GC.
|
|
|
|
|
const bool bIsDisregardForGC = GUObjectArray.IsDisregardForGC(this);
|
|
|
|
|
|
|
|
|
|
InputDataClass = InputData.LoadSynchronous();
|
|
|
|
|
if (InputDataClass)
|
|
|
|
|
{
|
|
|
|
|
if (bIsDisregardForGC)
|
|
|
|
|
{
|
|
|
|
|
InputDataClass->AddToRoot();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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.
Josh.Adams, Michael.Noland, Daren.Cheng
[FYI] Josh.Adams, Michael.Noland, Daren.Cheng
#ROBOMERGE-SOURCE: CL 16605253 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v828-16531559)
[CL 16605300 by nick darnell in ue5-release-engine-test branch]
2021-06-09 10:46:45 -04:00
|
|
|
//CurrentPlatform = CommonInputPlatformData[FCommonInputBase::GetCurrentPlatformName()];
|
|
|
|
|
//for (TSoftClassPtr<UCommonInputBaseControllerData> ControllerData : CurrentPlatform.GetControllerData())
|
|
|
|
|
//{
|
|
|
|
|
// if (TSubclassOf<UCommonInputBaseControllerData> ControllerDataClass = ControllerData.LoadSynchronous())
|
|
|
|
|
// {
|
|
|
|
|
// CurrentPlatform.ControllerDataClasses.Add(ControllerDataClass);
|
|
|
|
|
// if (bIsDisregardForGC)
|
|
|
|
|
// {
|
|
|
|
|
// ControllerDataClass->AddToRoot();
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//}
|
2021-04-08 14:32:07 -04:00
|
|
|
bInputDataLoaded = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UCommonInputSettings::ValidateData()
|
|
|
|
|
{
|
|
|
|
|
bInputDataLoaded &= !InputData.IsPending();
|
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.
Josh.Adams, Michael.Noland, Daren.Cheng
[FYI] Josh.Adams, Michael.Noland, Daren.Cheng
#ROBOMERGE-SOURCE: CL 16605253 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v828-16531559)
[CL 16605300 by nick darnell in ue5-release-engine-test branch]
2021-06-09 10:46:45 -04:00
|
|
|
// for (TSoftClassPtr<UCommonInputBaseControllerData> ControllerData : CurrentPlatform.GetControllerData())
|
|
|
|
|
// {
|
|
|
|
|
//bInputDataLoaded &= CurrentPlatform.ControllerDataClasses.ContainsByPredicate([&ControllerData](const TSubclassOf<UCommonInputBaseControllerData>& ControllerDataClass)
|
|
|
|
|
// {
|
|
|
|
|
// return ControllerDataClass.Get() == ControllerData.Get();
|
|
|
|
|
// });
|
2021-04-08 14:32:07 -04:00
|
|
|
|
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.
Josh.Adams, Michael.Noland, Daren.Cheng
[FYI] Josh.Adams, Michael.Noland, Daren.Cheng
#ROBOMERGE-SOURCE: CL 16605253 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v828-16531559)
[CL 16605300 by nick darnell in ue5-release-engine-test branch]
2021-06-09 10:46:45 -04:00
|
|
|
// bInputDataLoaded &= !ControllerData.IsPending();
|
|
|
|
|
// }
|
2021-04-08 14:32:07 -04:00
|
|
|
|
|
|
|
|
#if !WITH_EDITOR
|
|
|
|
|
UE_CLOG(!bInputDataLoaded, LogCommonInput, Warning, TEXT("Trying to access unloaded CommmonInputSettings data. This may force a sync load."));
|
|
|
|
|
#endif // !WITH_EDITOR
|
|
|
|
|
|
|
|
|
|
LoadData();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FDataTableRowHandle UCommonInputSettings::GetDefaultClickAction() const
|
|
|
|
|
{
|
|
|
|
|
ensure(bInputDataLoaded);
|
|
|
|
|
|
|
|
|
|
if (InputDataClass)
|
|
|
|
|
{
|
|
|
|
|
if (const UCommonUIInputData* InputDataPtr = InputDataClass.GetDefaultObject())
|
|
|
|
|
{
|
|
|
|
|
return InputDataPtr->DefaultClickAction;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return FDataTableRowHandle();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FDataTableRowHandle UCommonInputSettings::GetDefaultBackAction() const
|
|
|
|
|
{
|
|
|
|
|
ensure(bInputDataLoaded);
|
|
|
|
|
|
|
|
|
|
if (InputDataClass)
|
|
|
|
|
{
|
|
|
|
|
if (const UCommonUIInputData* InputDataPtr = InputDataClass.GetDefaultObject())
|
|
|
|
|
{
|
|
|
|
|
return InputDataPtr->DefaultBackAction;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return FDataTableRowHandle();
|
|
|
|
|
}
|
|
|
|
|
|
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.
Josh.Adams, Michael.Noland, Daren.Cheng
[FYI] Josh.Adams, Michael.Noland, Daren.Cheng
#ROBOMERGE-SOURCE: CL 16605253 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v828-16531559)
[CL 16605300 by nick darnell in ue5-release-engine-test branch]
2021-06-09 10:46:45 -04:00
|
|
|
void UCommonInputSettings::PostInitProperties()
|
2021-04-08 14:32:07 -04:00
|
|
|
{
|
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.
Josh.Adams, Michael.Noland, Daren.Cheng
[FYI] Josh.Adams, Michael.Noland, Daren.Cheng
#ROBOMERGE-SOURCE: CL 16605253 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v828-16531559)
[CL 16605300 by nick darnell in ue5-release-engine-test branch]
2021-06-09 10:46:45 -04:00
|
|
|
Super::PostInitProperties();
|
2021-04-08 14:32:07 -04:00
|
|
|
|
2021-06-09 12:12:20 -04:00
|
|
|
#if WITH_EDITOR
|
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.
Josh.Adams, Michael.Noland, Daren.Cheng
[FYI] Josh.Adams, Michael.Noland, Daren.Cheng
#ROBOMERGE-SOURCE: CL 16605253 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v828-16531559)
[CL 16605300 by nick darnell in ue5-release-engine-test branch]
2021-06-09 10:46:45 -04:00
|
|
|
if (CommonInputPlatformData_DEPRECATED.Num())
|
|
|
|
|
{
|
|
|
|
|
for (const auto& PlatformData : CommonInputPlatformData_DEPRECATED)
|
|
|
|
|
{
|
|
|
|
|
const FCommonInputPlatformBaseData& OriginalData = PlatformData.Value;
|
|
|
|
|
|
|
|
|
|
if (UCommonInputPlatformSettings* Settings = UPlatformSettings::GetSettingsForPlatform<UCommonInputPlatformSettings>(PlatformData.Key.ToString()))
|
|
|
|
|
{
|
|
|
|
|
Settings->bSupportsMouseAndKeyboard = OriginalData.bSupportsMouseAndKeyboard;
|
|
|
|
|
Settings->bSupportsGamepad = OriginalData.bSupportsGamepad;
|
|
|
|
|
Settings->bSupportsTouch = OriginalData.bSupportsTouch;
|
|
|
|
|
Settings->bCanChangeGamepadType = OriginalData.bCanChangeGamepadType;
|
|
|
|
|
Settings->DefaultGamepadName = OriginalData.DefaultGamepadName;
|
|
|
|
|
Settings->DefaultInputType = OriginalData.DefaultInputType;
|
|
|
|
|
Settings->ControllerData = OriginalData.ControllerData;
|
2021-06-09 15:33:09 -04:00
|
|
|
|
2021-10-25 20:05:28 -04:00
|
|
|
Settings->TryUpdateDefaultConfigFile();
|
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.
Josh.Adams, Michael.Noland, Daren.Cheng
[FYI] Josh.Adams, Michael.Noland, Daren.Cheng
#ROBOMERGE-SOURCE: CL 16605253 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v828-16531559)
[CL 16605300 by nick darnell in ue5-release-engine-test branch]
2021-06-09 10:46:45 -04:00
|
|
|
}
|
|
|
|
|
else if (PlatformData.Key == FCommonInputDefaults::PlatformPC)
|
|
|
|
|
{
|
|
|
|
|
TArray<UCommonInputPlatformSettings*> PCPlatforms;
|
|
|
|
|
PCPlatforms.Add(UPlatformSettings::GetSettingsForPlatform<UCommonInputPlatformSettings>("Windows"));
|
|
|
|
|
PCPlatforms.Add(UPlatformSettings::GetSettingsForPlatform<UCommonInputPlatformSettings>("WinGDK"));
|
|
|
|
|
PCPlatforms.Add(UPlatformSettings::GetSettingsForPlatform<UCommonInputPlatformSettings>("Linux"));
|
|
|
|
|
|
|
|
|
|
for (UCommonInputPlatformSettings* PCPlatform : PCPlatforms)
|
|
|
|
|
{
|
2021-06-09 15:33:09 -04:00
|
|
|
if (PCPlatform)
|
|
|
|
|
{
|
|
|
|
|
PCPlatform->bSupportsMouseAndKeyboard = OriginalData.bSupportsMouseAndKeyboard;
|
|
|
|
|
PCPlatform->bSupportsGamepad = OriginalData.bSupportsGamepad;
|
|
|
|
|
PCPlatform->bSupportsTouch = OriginalData.bSupportsTouch;
|
|
|
|
|
PCPlatform->bCanChangeGamepadType = OriginalData.bCanChangeGamepadType;
|
|
|
|
|
PCPlatform->DefaultGamepadName = OriginalData.DefaultGamepadName;
|
|
|
|
|
PCPlatform->DefaultInputType = OriginalData.DefaultInputType;
|
|
|
|
|
PCPlatform->ControllerData = OriginalData.ControllerData;
|
|
|
|
|
|
2021-10-25 20:05:28 -04:00
|
|
|
PCPlatform->TryUpdateDefaultConfigFile();
|
2021-06-09 15:33:09 -04:00
|
|
|
}
|
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.
Josh.Adams, Michael.Noland, Daren.Cheng
[FYI] Josh.Adams, Michael.Noland, Daren.Cheng
#ROBOMERGE-SOURCE: CL 16605253 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v828-16531559)
[CL 16605300 by nick darnell in ue5-release-engine-test branch]
2021-06-09 10:46:45 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CommonInputPlatformData_DEPRECATED.Reset();
|
2021-10-25 20:05:28 -04:00
|
|
|
TryUpdateDefaultConfigFile();
|
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.
Josh.Adams, Michael.Noland, Daren.Cheng
[FYI] Josh.Adams, Michael.Noland, Daren.Cheng
#ROBOMERGE-SOURCE: CL 16605253 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v828-16531559)
[CL 16605300 by nick darnell in ue5-release-engine-test branch]
2021-06-09 10:46:45 -04:00
|
|
|
}
|
2021-06-09 12:12:20 -04:00
|
|
|
#endif
|
2021-04-08 14:32:07 -04:00
|
|
|
}
|