You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3105904 on 2016/08/30 by Ben.Marsh PR #2691: Copy .map-file to staging & cleanup (Contributed by projectgheist) Change 3105974 on 2016/08/30 by Ben.Marsh PR #2748: [Bug-Fix] UGS - Ensure older events do not trample newer ones (Contributed by paulevans) Change 3106035 on 2016/08/30 by Ben.Marsh PR #2746: [Bug-Fix] UGS - Starting build colour was the same as disabled (Contributed by paulevans) Change 3106172 on 2016/08/30 by Ben.Marsh UAT: Do not default to submitting build products from BuildCookRun unless -submit is explicitly specified on the command line. #codreview Maciej.Mroz Change 3107642 on 2016/08/31 by Matthew.Griffin More Monolithic editor fixes Fixed IMPLEMENT_MODULE macros with incorrect module name Wrapped some usages of GIsHotReload in WITH_HOT_RELOAD Fixed NiagaraConstants so that they can be used in multiple modules Change 3107808 on 2016/08/31 by Matthew.Griffin Added Node to Compile UAT on Mac to catch any Mono failures which will run as part of monolithics aggregate Change 3111527 on 2016/09/02 by Matthew.Griffin Duplicating CL#3111524 from Release-4.13 stream Including Documentation/Extras in installed build Change 3117683 on 2016/09/08 by Ben.Marsh PR #2771: Fix compilation of C# projects on case-sensitive OSes (Contributed by slonopotamus) Change 3119707 on 2016/09/09 by Ben.Marsh UBT: Add more explicit methods for querying Visual C++ and Visual Studio installation directories. Now uses the same logic in the Visual Studio batch files. Change 3120824 on 2016/09/12 by Ben.Marsh UnrealGameSync: Add a project-wide option which can disable using the last code changelist for version files, and use the sync changelist instead. ("VersionToLastCodeChange" in the "[Options]" section). Update version to 1.80. Change 3120996 on 2016/09/12 by Ben.Marsh Core: Fix lines of output text from FMonitoredProcess being truncated at 512 characters, due to pipe buffer size. Accumulate incomplete lines and merge them together again instead. Also remove CR-LF pairs if they occur at the end of a line. #jira UE-35659 Change 3121353 on 2016/09/12 by Ben.Marsh Core: Manually enumerate and load dependent DLLs for modules by the editor, to work around limitations in the number of search paths checked by the Windows loader. We previously temporarily modified the PATH environment variable to provide this functionality, but are close to the OS limit for length of that string. This method should not have any such restrictions (though it will not work for circular dependencies). Change 3121996 on 2016/09/12 by Ben.Marsh Add support for Visual Studio 2017 (aka "15"; assuming consistent naming with other versions until final name is announced). * Compiler, STL implementation and CRT are binary compatible with VS2015 (see https://blogs.msdn.microsoft.com/vcblog/2016/08/24/c1417-features-and-stl-fixes-in-vs-15-preview-4/), so no new third-party libraries needed so far. WindowsPlatform.GetVisualStudioCompilerVersionName() returns "2015" as a result. * Default compiler for compiling and generating project files is still VS 2015 for now. Pass -2017 on the command line to GenerateProjectFiles.bat to generate VS2017 projects. Projects generated for VS2017 will use the 2017 compiler by default. * Visual Studio source code accessor can talk to VS 2017 instances. * Added a VS2017 configuration for UnrealVS, and added precompiled vsix package. * Switched GetVSComnTools to check the SOFTWARE\Microsoft\VisualStudio\SxS\VS7 registry key rather than the individual product install registry key. "15" doesn't seem to have it's own "InstallDir" key, but this system seems to work for all versions of Visual Studio (including previous releases of VS Express). * Removed ATL dependency from VisualStudioSourceCodeAccessor. It's not installed with VS by default any more, and is only used for a couple of smart pointer classes. Tested running the editor and packaging TP_Flying for Win64. Packaging from the editor still defaults to using the 2015 compiler, so ConfigureToolchain() needs to be overriden from the .target.cs file if multiple Visual Studio versions are installed. Change 3123144 on 2016/09/13 by Ben.Marsh BuildGraph: Fix exception due to mismatched argument lists. Change 3123160 on 2016/09/13 by Ben.Marsh Linux: Make PLATFORM_SUPPORTS_JEMALLOC a globally defined macro rather than just defined by the jemalloc module. Core supplies a default value for this macro which is inconsistent unless your module has an explicit dependency on jemalloc. Change 3123211 on 2016/09/13 by Ben.Marsh UBT: Fix exception writing a version manifest if the output directory does not exist. Change 3125300 on 2016/09/14 by Ben.Marsh UnrealVS: Few fixes to single-file compile command. * All documents are now saved before compile starts. * Now gives a useful error when trying to compile non-cpp files, rather than falling back to the invalid default command handler. * Trying to do a single-file compile while an existing build is running now prompts to stop it, rather than falling back to the default command handler (which gives a "Invalid command" message for makefile projects) Change 3125437 on 2016/09/14 by Ben.Marsh UnrealVS: Update version number to 1.43 in order to prevent installer from bailing unless existing version is uninstalled first. [CL 3126342 by Ben Marsh in Main branch]
312 lines
12 KiB
C++
312 lines
12 KiB
C++
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "HardwareTargetingPrivatePCH.h"
|
|
#include "HardwareTargetingModule.h"
|
|
#include "HardwareTargetingSettings.h"
|
|
#include "Internationalization.h"
|
|
#include "ISettingsModule.h"
|
|
#include "ModuleManager.h"
|
|
#include "SDecoratedEnumCombo.h"
|
|
|
|
#include "Runtime/Engine/Classes/Engine/RendererSettings.h"
|
|
#include "Editor/Documentation/Public/IDocumentation.h"
|
|
#include "GameFramework/InputSettings.h"
|
|
#include "GameMapsSettings.h"
|
|
#include "EditorProjectSettings.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "HardwareTargeting"
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// FMetaSettingGatherer
|
|
|
|
struct FMetaSettingGatherer
|
|
{
|
|
FTextBuilder DescriptionBuffer;
|
|
|
|
TMap<UObject*, FTextBuilder> DescriptionBuffers;
|
|
TMap<UObject*, FText> CategoryNames;
|
|
|
|
// Are we just displaying what would change, or actually changing things?
|
|
bool bReadOnly;
|
|
|
|
bool bIncludeUnmodifiedProperties;
|
|
|
|
FMetaSettingGatherer()
|
|
: bReadOnly(false)
|
|
, bIncludeUnmodifiedProperties(false)
|
|
{
|
|
}
|
|
|
|
void AddEntry(UObject* SettingsObject, UProperty* Property, FText NewValue, bool bModified)
|
|
{
|
|
if (bModified || bIncludeUnmodifiedProperties)
|
|
{
|
|
FTextBuilder& SettingsDescriptionBuffer = DescriptionBuffers.FindOrAdd(SettingsObject);
|
|
|
|
if (!bReadOnly)
|
|
{
|
|
FPropertyChangedEvent ChangeEvent(Property, EPropertyChangeType::ValueSet);
|
|
SettingsObject->PostEditChangeProperty(ChangeEvent);
|
|
}
|
|
else
|
|
{
|
|
FText SettingDisplayName = Property->GetDisplayNameText();
|
|
|
|
FFormatNamedArguments Args;
|
|
Args.Add(TEXT("SettingName"), SettingDisplayName);
|
|
Args.Add(TEXT("SettingValue"), NewValue);
|
|
|
|
FText FormatString = bModified ?
|
|
LOCTEXT("MetaSettingDisplayStringModified", "{SettingName} is {SettingValue} <HardwareTargets.Strong>(modified)</>") :
|
|
LOCTEXT("MetaSettingDisplayStringUnmodified", "{SettingName} is {SettingValue}");
|
|
|
|
SettingsDescriptionBuffer.AppendLine(FText::Format(FormatString, Args));
|
|
}
|
|
}
|
|
}
|
|
|
|
template <typename ValueType>
|
|
static FText ValueToString(ValueType Value);
|
|
|
|
bool Finalize()
|
|
{
|
|
check(!bReadOnly);
|
|
|
|
bool bSuccess = true;
|
|
for (auto& Pair : DescriptionBuffers)
|
|
{
|
|
const FString Filename = Pair.Key->GetDefaultConfigFilename();
|
|
const FDateTime BeforeTime = IFileManager::Get().GetTimeStamp(*Filename);
|
|
|
|
Pair.Key->UpdateDefaultConfigFile();
|
|
|
|
const FDateTime AfterTime = IFileManager::Get().GetTimeStamp(*Filename);
|
|
bSuccess = BeforeTime != AfterTime && bSuccess;
|
|
}
|
|
|
|
return bSuccess;
|
|
}
|
|
};
|
|
|
|
|
|
template <>
|
|
FText FMetaSettingGatherer::ValueToString(bool Value)
|
|
{
|
|
return Value ? LOCTEXT("BoolEnabled", "enabled") : LOCTEXT("BoolDisabled", "disabled");
|
|
}
|
|
|
|
template <>
|
|
FText FMetaSettingGatherer::ValueToString(EAntiAliasingMethod Value)
|
|
{
|
|
switch (Value)
|
|
{
|
|
case AAM_None:
|
|
return LOCTEXT("AA_None", "None");
|
|
case AAM_FXAA:
|
|
return LOCTEXT("AA_FXAA", "FXAA");
|
|
case AAM_TemporalAA:
|
|
return LOCTEXT("AA_TemporalAA", "Temporal AA");
|
|
case AAM_MSAA:
|
|
return LOCTEXT("AA_MSAA", "MSAA");
|
|
default:
|
|
return FText::AsNumber((int32)Value);
|
|
}
|
|
}
|
|
|
|
#define UE_META_SETTING_ENTRY(Builder, Class, PropertyName, TargetValue) \
|
|
{ \
|
|
Class* SettingsObject = GetMutableDefault<Class>(); \
|
|
bool bModified = SettingsObject->PropertyName != (TargetValue); \
|
|
if (!Builder.bReadOnly) { SettingsObject->PropertyName = (TargetValue); } \
|
|
Builder.AddEntry(SettingsObject, FindFieldChecked<UProperty>(Class::StaticClass(), GET_MEMBER_NAME_CHECKED(Class, PropertyName)), FMetaSettingGatherer::ValueToString(TargetValue), bModified); \
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// FHardwareTargetingModule
|
|
|
|
class FHardwareTargetingModule : public IHardwareTargetingModule
|
|
{
|
|
public:
|
|
// IModuleInterface interface
|
|
virtual void StartupModule() override;
|
|
virtual void ShutdownModule() override;
|
|
// End of IModuleInterface interface
|
|
|
|
// IHardwareTargetingModule interface
|
|
virtual void ApplyHardwareTargetingSettings() override;
|
|
virtual TArray<FModifiedDefaultConfig> GetPendingSettingsChanges() override;
|
|
virtual TSharedRef<SWidget> MakeHardwareClassTargetCombo(FOnHardwareClassChanged OnChanged, TAttribute<EHardwareClass::Type> SelectedEnum) override;
|
|
virtual TSharedRef<SWidget> MakeGraphicsPresetTargetCombo(FOnGraphicsPresetChanged OnChanged, TAttribute<EGraphicsPreset::Type> SelectedEnum) override;
|
|
// End of IHardwareTargetingModule interface
|
|
|
|
private:
|
|
void GatherSettings(FMetaSettingGatherer& Builder);
|
|
};
|
|
|
|
void FHardwareTargetingModule::StartupModule()
|
|
{
|
|
ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings");
|
|
|
|
if (SettingsModule != nullptr)
|
|
{
|
|
SettingsModule->RegisterSettings("Project", "Project", "HardwareTargeting",
|
|
LOCTEXT("HardwareTargetingSettingsName", "Target Hardware"),
|
|
LOCTEXT("HardwareTargetingSettingsDescription", "Options for choosing which class of hardware to target"),
|
|
GetMutableDefault<UHardwareTargetingSettings>()
|
|
);
|
|
}
|
|
|
|
// Apply any settings on startup if necessary
|
|
ApplyHardwareTargetingSettings();
|
|
}
|
|
|
|
void FHardwareTargetingModule::ShutdownModule()
|
|
{
|
|
}
|
|
|
|
TArray<FModifiedDefaultConfig> FHardwareTargetingModule::GetPendingSettingsChanges()
|
|
{
|
|
// Gather and stringify the modified settings
|
|
FMetaSettingGatherer Gatherer;
|
|
Gatherer.bReadOnly = true;
|
|
Gatherer.bIncludeUnmodifiedProperties = true;
|
|
GatherSettings(Gatherer);
|
|
|
|
TArray<FModifiedDefaultConfig> OutArray;
|
|
for (auto& Pair : Gatherer.DescriptionBuffers)
|
|
{
|
|
FModifiedDefaultConfig ModifiedConfig;
|
|
ModifiedConfig.SettingsObject = Pair.Key;
|
|
ModifiedConfig.Description = Pair.Value.ToText();
|
|
ModifiedConfig.CategoryHeading = Gatherer.CategoryNames.FindChecked(Pair.Key);
|
|
|
|
OutArray.Add(ModifiedConfig);
|
|
}
|
|
return OutArray;
|
|
}
|
|
|
|
void FHardwareTargetingModule::GatherSettings(FMetaSettingGatherer& Builder)
|
|
{
|
|
UHardwareTargetingSettings* Settings = GetMutableDefault<UHardwareTargetingSettings>();
|
|
|
|
|
|
if (Builder.bReadOnly)
|
|
{
|
|
// Force the category order and give nice descriptions
|
|
Builder.CategoryNames.Add(GetMutableDefault<URendererSettings>(), LOCTEXT("RenderingCategoryHeader", "Engine - Rendering"));
|
|
Builder.CategoryNames.Add(GetMutableDefault<UInputSettings>(), LOCTEXT("InputCategoryHeader", "Engine - Input"));
|
|
Builder.CategoryNames.Add(GetMutableDefault<UGameMapsSettings>(), LOCTEXT("MapsAndModesCategoryHeader", "Project - Maps & Modes"));
|
|
Builder.CategoryNames.Add(GetMutableDefault<ULevelEditor2DSettings>(), LOCTEXT("EditorSettings2D", "Editor - 2D"));
|
|
}
|
|
|
|
|
|
const bool bLowEndMobile = (Settings->TargetedHardwareClass == EHardwareClass::Mobile) && (Settings->DefaultGraphicsPerformance == EGraphicsPreset::Scalable);
|
|
const bool bAnyMobile = (Settings->TargetedHardwareClass == EHardwareClass::Mobile);
|
|
const bool bHighEndMobile = (Settings->TargetedHardwareClass == EHardwareClass::Mobile) && (Settings->DefaultGraphicsPerformance == EGraphicsPreset::Maximum);
|
|
const bool bAnyPC = (Settings->TargetedHardwareClass == EHardwareClass::Desktop);
|
|
const bool bHighEndPC = (Settings->TargetedHardwareClass == EHardwareClass::Desktop) && (Settings->DefaultGraphicsPerformance == EGraphicsPreset::Maximum);
|
|
const bool bAnyScalable = Settings->DefaultGraphicsPerformance == EGraphicsPreset::Scalable;
|
|
|
|
{
|
|
// Based roughly on https://docs.unrealengine.com/latest/INT/Platforms/Mobile/PostProcessEffects/index.html
|
|
UE_META_SETTING_ENTRY(Builder, URendererSettings, bMobileHDR, !bLowEndMobile);
|
|
|
|
// Bloom works and isn't terribly expensive on anything beyond low-end
|
|
UE_META_SETTING_ENTRY(Builder, URendererSettings, bDefaultFeatureBloom, !bLowEndMobile);
|
|
|
|
// Separate translucency does nothing in the ES2 renderer
|
|
UE_META_SETTING_ENTRY(Builder, URendererSettings, bSeparateTranslucency, !bAnyMobile);
|
|
|
|
// Motion blur, auto-exposure, and ambient occlusion don't work in the ES2 renderer
|
|
UE_META_SETTING_ENTRY(Builder, URendererSettings, bDefaultFeatureMotionBlur, bHighEndPC);
|
|
UE_META_SETTING_ENTRY(Builder, URendererSettings, bDefaultFeatureAutoExposure, bHighEndPC);
|
|
UE_META_SETTING_ENTRY(Builder, URendererSettings, bDefaultFeatureAmbientOcclusion, bAnyPC);
|
|
|
|
// lens flare doesn't work in the ES2 renderer, the quality is low and the feature is controversial
|
|
UE_META_SETTING_ENTRY(Builder, URendererSettings, bDefaultFeatureLensFlare, false);
|
|
|
|
// DOF and AA work on mobile but are expensive, keeping them off by default
|
|
//@TODO: DOF setting doesn't exist yet
|
|
// UE_META_SETTING_ENTRY(Builder, URendererSettings, bDefaultFeatureDepthOfField, bHighEndPC);
|
|
UE_META_SETTING_ENTRY(Builder, URendererSettings, DefaultFeatureAntiAliasing, bHighEndPC ? AAM_TemporalAA : AAM_None);
|
|
}
|
|
|
|
{
|
|
// Mobile uses touch
|
|
UE_META_SETTING_ENTRY(Builder, UInputSettings, bUseMouseForTouch, bAnyMobile);
|
|
//@TODO: Use bAlwaysShowTouchInterface (sorta implied by bUseMouseForTouch)?
|
|
}
|
|
|
|
{
|
|
// Tablets or phones are usually shared-screen multiplayer instead of split-screen
|
|
UE_META_SETTING_ENTRY(Builder, UGameMapsSettings, bUseSplitscreen, bAnyPC);
|
|
}
|
|
}
|
|
|
|
void FHardwareTargetingModule::ApplyHardwareTargetingSettings()
|
|
{
|
|
UHardwareTargetingSettings* Settings = GetMutableDefault<UHardwareTargetingSettings>();
|
|
|
|
// Apply the settings if they've changed
|
|
if (Settings->HasPendingChanges())
|
|
{
|
|
// Gather and apply the modified settings
|
|
FMetaSettingGatherer Builder;
|
|
Builder.bReadOnly = false;
|
|
GatherSettings(Builder);
|
|
|
|
const bool bSuccess = Builder.Finalize();
|
|
|
|
// Write out the 'did we apply' values
|
|
if (bSuccess)
|
|
{
|
|
Settings->AppliedTargetedHardwareClass = Settings->TargetedHardwareClass;
|
|
Settings->AppliedDefaultGraphicsPerformance = Settings->DefaultGraphicsPerformance;
|
|
Settings->UpdateDefaultConfigFile();
|
|
}
|
|
}
|
|
}
|
|
|
|
TSharedRef<SWidget> FHardwareTargetingModule::MakeHardwareClassTargetCombo(FOnHardwareClassChanged OnChanged, TAttribute<EHardwareClass::Type> SelectedEnum)
|
|
{
|
|
TArray<SDecoratedEnumCombo<EHardwareClass::Type>::FComboOption> HardwareClassInfo;
|
|
HardwareClassInfo.Add(SDecoratedEnumCombo<EHardwareClass::Type>::FComboOption(
|
|
EHardwareClass::Unspecified, FSlateIcon(FEditorStyle::GetStyleSetName(), "HardwareTargeting.HardwareUnspecified"), LOCTEXT("UnspecifiedCaption", "Unspecified"), false));
|
|
HardwareClassInfo.Add(SDecoratedEnumCombo<EHardwareClass::Type>::FComboOption(
|
|
EHardwareClass::Desktop, FSlateIcon(FEditorStyle::GetStyleSetName(), "HardwareTargeting.DesktopPlatform"), LOCTEXT("DesktopCaption", "Desktop / Console")));
|
|
HardwareClassInfo.Add(SDecoratedEnumCombo<EHardwareClass::Type>::FComboOption(
|
|
EHardwareClass::Mobile, FSlateIcon(FEditorStyle::GetStyleSetName(), "HardwareTargeting.MobilePlatform"), LOCTEXT("MobileCaption", "Mobile / Tablet")));
|
|
|
|
return SNew(SDecoratedEnumCombo<EHardwareClass::Type>, MoveTemp(HardwareClassInfo))
|
|
.SelectedEnum(SelectedEnum)
|
|
.OnEnumChanged(OnChanged)
|
|
.ToolTip(IDocumentation::Get()->CreateToolTip(LOCTEXT("HardwareClassTooltip", "Choose the overall class of hardware to target (desktop/console or mobile/tablet)."), NULL, TEXT("Shared/Editor/Settings/TargetHardware"), TEXT("HardwareClass")));
|
|
}
|
|
|
|
TSharedRef<SWidget> FHardwareTargetingModule::MakeGraphicsPresetTargetCombo(FOnGraphicsPresetChanged OnChanged, TAttribute<EGraphicsPreset::Type> SelectedEnum)
|
|
{
|
|
TArray<SDecoratedEnumCombo<EGraphicsPreset::Type>::FComboOption> GraphicsPresetInfo;
|
|
GraphicsPresetInfo.Add(SDecoratedEnumCombo<EGraphicsPreset::Type>::FComboOption(
|
|
EGraphicsPreset::Unspecified, FSlateIcon(FEditorStyle::GetStyleSetName(), "HardwareTargeting.GraphicsUnspecified"), LOCTEXT("UnspecifiedCaption", "Unspecified"), false));
|
|
GraphicsPresetInfo.Add(SDecoratedEnumCombo<EGraphicsPreset::Type>::FComboOption(
|
|
EGraphicsPreset::Maximum, FSlateIcon(FEditorStyle::GetStyleSetName(), "HardwareTargeting.MaximumQuality"), LOCTEXT("MaximumCaption", "Maximum Quality")));
|
|
GraphicsPresetInfo.Add(SDecoratedEnumCombo<EGraphicsPreset::Type>::FComboOption(
|
|
EGraphicsPreset::Scalable, FSlateIcon(FEditorStyle::GetStyleSetName(), "HardwareTargeting.ScalableQuality"), LOCTEXT("ScalableCaption", "Scalable 3D or 2D")));
|
|
|
|
return SNew(SDecoratedEnumCombo<EGraphicsPreset::Type>, MoveTemp(GraphicsPresetInfo))
|
|
.SelectedEnum(SelectedEnum)
|
|
.OnEnumChanged(OnChanged)
|
|
.ToolTip(IDocumentation::Get()->CreateToolTip(LOCTEXT("GraphicsPresetTooltip", "Choose the graphical level to target (high-end only or scalable from low-end on up)."), NULL, TEXT("Shared/Editor/Settings/TargetHardware"), TEXT("GraphicalLevel")));
|
|
}
|
|
|
|
IHardwareTargetingModule& IHardwareTargetingModule::Get()
|
|
{
|
|
static FHardwareTargetingModule Instance;
|
|
return Instance;
|
|
}
|
|
|
|
IMPLEMENT_MODULE(FHardwareTargetingModule, HardwareTargeting);
|
|
|
|
#undef UE_META_SETTING_ENTRY
|
|
#undef LOCTEXT_NAMESPACE |