You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
[Backout] - CL31459949 [FYI] bob.tellez Original CL Desc ----------------------------------------------------------------- [Backout] - CL31443953 [FYI] Josh.Adams Original CL Desc ----------------------------------------------------------------- Phase 1 of the FConfigBranch changes: Introduced FConfigBranch which maintains logic and data for each individual branch of GConfig (Engine, Game, Input, DeviceProfiles, etc), with static and dynamic layers Introduced FConfigCommandStream which is how each layer is loaded, and Apply'd to an FConfigFile Added a new way of making a "diff" of in-memory vs what's loaded, which creates an FConfigCommandStream that can be re-applied (more useful in Phase 2, see below) Expectation is no visible differences from before this change, as it's mostly internal data structure changes Phase 2 is where the functional changes will happen, with the dynamic layers being able to be removed at runtime, and the state of GConfig is maintained as expdected The editor does maintain full state of where config values come from, so the "getini" command in the editor will show a lot more information now Runtime will not keep any state, so unloading dynamic layers is not supported by default (running with -ConfigReplayMethod=1 or 2 will allow for it, but will use more memory) #rb david.harvey #jira UE-201472 [CL 31470013 by josh adams in ue5-main branch]
120 lines
3.5 KiB
C++
120 lines
3.5 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "SConfigEditor.h"
|
|
|
|
#include "ConfigPropertyHelper.h"
|
|
#include "Containers/Array.h"
|
|
#include "Containers/Map.h"
|
|
#include "Containers/UnrealString.h"
|
|
#include "DetailsViewArgs.h"
|
|
#include "HAL/Platform.h"
|
|
#include "HAL/PlatformCrt.h"
|
|
#include "IDetailsView.h"
|
|
#include "Layout/Children.h"
|
|
#include "Misc/ConfigCacheIni.h"
|
|
#include "Misc/ConfigTypes.h"
|
|
#include "Modules/ModuleManager.h"
|
|
#include "PropertyEditorModule.h"
|
|
#include "STargetPlatformSelector.h"
|
|
#include "SlateOptMacros.h"
|
|
#include "SlotBase.h"
|
|
#include "Templates/Tuple.h"
|
|
#include "UObject/Class.h"
|
|
#include "UObject/FieldPath.h"
|
|
#include "UObject/NameTypes.h"
|
|
#include "UObject/ObjectPtr.h"
|
|
#include "UObject/Package.h"
|
|
#include "UObject/UObjectGlobals.h"
|
|
#include "UObject/UnrealType.h"
|
|
#include "Widgets/SBoxPanel.h"
|
|
|
|
|
|
#define LOCTEXT_NAMESPACE "ConfigEditor"
|
|
|
|
|
|
BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
|
|
void SConfigEditor::Construct(const FArguments& InArgs, TWeakFieldPtr<FProperty> InEditProperty)
|
|
{
|
|
TargetPlatformSelection = SNew(STargetPlatformSelector)
|
|
.OnTargetPlatformChanged(this, &SConfigEditor::HandleTargetPlatformChanged);
|
|
|
|
EditProperty = InEditProperty;
|
|
|
|
LocalConfigCache = MakeShareable(new FConfigCacheIni(EConfigCacheType::Temporary));
|
|
|
|
// initialize details view
|
|
FDetailsViewArgs DetailsViewArgs;
|
|
{
|
|
DetailsViewArgs.bAllowSearch = false;
|
|
DetailsViewArgs.bHideSelectionTip = true;
|
|
DetailsViewArgs.bLockable = false;
|
|
DetailsViewArgs.bSearchInitialKeyFocus = true;
|
|
DetailsViewArgs.bUpdatesFromSelection = false;
|
|
DetailsViewArgs.bShowOptions = false;
|
|
DetailsViewArgs.bShowModifiedPropertiesOption = false;
|
|
}
|
|
|
|
DetailsView = FModuleManager::GetModuleChecked<FPropertyEditorModule>("PropertyEditor").CreateDetailView(DetailsViewArgs);
|
|
|
|
CreateDisplayObjectForSelectedTargetPlatform();
|
|
|
|
////
|
|
// Our Widget setup is complete.
|
|
PropertyValueEditor = DetailsView.ToSharedRef();
|
|
|
|
ChildSlot
|
|
[
|
|
SNew(SVerticalBox)
|
|
+ SVerticalBox::Slot()
|
|
.AutoHeight()
|
|
[
|
|
TargetPlatformSelection.ToSharedRef()
|
|
]
|
|
+ SVerticalBox::Slot()
|
|
[
|
|
PropertyValueEditor.ToSharedRef()
|
|
]
|
|
];
|
|
}
|
|
END_SLATE_FUNCTION_BUILD_OPTIMIZATION
|
|
|
|
void SConfigEditor::CreateDisplayObjectForSelectedTargetPlatform()
|
|
{
|
|
// Get the ini file and hierarchy linked with this property
|
|
FString SelectedTargetPlatform = *TargetPlatformSelection->GetSelectedTargetPlatform().Get();
|
|
|
|
FString ConfigHelperName(TEXT("ConfigEditorPropertyHelper_"));
|
|
ConfigHelperName += SelectedTargetPlatform;
|
|
|
|
PropHelper = FindObject<UConfigHierarchyPropertyView>(GetTransientPackage(), *ConfigHelperName);
|
|
if (!PropHelper.IsValid())
|
|
{
|
|
PropHelper = NewObject<UConfigHierarchyPropertyView>(GetTransientPackage(), *ConfigHelperName);
|
|
PropHelper->AddToRoot();
|
|
}
|
|
|
|
PropHelper->EditProperty = EditProperty.Get();
|
|
FString ClassConfigName = PropHelper->EditProperty->GetOwnerClass()->ClassConfigName.ToString();
|
|
|
|
FConfigFile PlatformIniFile;
|
|
LocalConfigCache->LoadLocalIniFile(PlatformIniFile, *ClassConfigName, true, *SelectedTargetPlatform);
|
|
|
|
for (const auto& IniFile : PlatformIniFile.Branch->Hierarchy)
|
|
{
|
|
UPropertyConfigFileDisplayRow* ConfigFilePropertyObj = NewObject<UPropertyConfigFileDisplayRow>(GetTransientPackage(), *IniFile.Value);
|
|
ConfigFilePropertyObj->InitWithConfigAndProperty(IniFile.Value, PropHelper->EditProperty.Get());
|
|
|
|
PropHelper->ConfigFilePropertyObjects.Add(ConfigFilePropertyObj);
|
|
}
|
|
|
|
DetailsView->SetObject(PropHelper.Get());
|
|
}
|
|
|
|
void SConfigEditor::HandleTargetPlatformChanged()
|
|
{
|
|
CreateDisplayObjectForSelectedTargetPlatform();
|
|
}
|
|
|
|
|
|
#undef LOCTEXT_NAMESPACE
|