Added config migration path for newer versions of the engine.

Newly installed versions of the engine will now attempt to copy the project-agnostic config settings from a previous engine installation. This happens by way of a versioned manifest that copies old versions when the manifest does not exist, or is a different version. This code path is benign for non-installed versions of the engine (or FPaths::ShouldSaveToUserDir() is false).

EditorGameAgnosticSettings and EditorUserSettings ini paths have been renamed to EditorSettings and EditorPerProjectUserSettings respectively to better convey their purpose. In general, most settings should be saved in EditorSettings (project-agnostic) so that they apply regardless of which project is open. We have some way to go migrating existing settings for this to be the case, however.

Some previously per-project configuration files are now project-agnostic (such as Editor.ini, EditorKeyBindings.ini, and EditorLayout.ini)

GEditor->Access...Settings and GEditor->Get...Settings have been removed in favor of direct access of the CDO through GetMutableDefault<> and GetDefault<> respectively. Global config ini filenames that are not set up are now neither loaded nor saved on build machines, to handle the problem of indeterminate state more generically.

This addresses UETOOL-270 (Most editor preferences should be project-agnostic)

[CL 2517558 by Andrew Rodham in Main branch]
This commit is contained in:
Andrew Rodham
2015-04-20 10:12:55 -04:00
committed by Andrew.Rodham@epicgames.com
parent 4daae26e88
commit 8ff0d8b98b
179 changed files with 1146 additions and 900 deletions

View File

@@ -3137,7 +3137,7 @@ GameProjectUtils::EAddCodeToProjectResult GameProjectUtils::AddCodeToProject_Int
// Notify that we've created a brand new module
FSourceCodeNavigation::AccessOnNewModuleAdded().Broadcast(*GameModuleName);
}
else if (GEditor->AccessEditorUserSettings().bAutomaticallyHotReloadNewClasses)
else if (GetDefault<UEditorPerProjectUserSettings>()->bAutomaticallyHotReloadNewClasses)
{
FModuleStatus ModuleStatus;
const FName ModuleFName = *ModuleInfo.ModuleName;

View File

@@ -1172,7 +1172,7 @@ void SNewClassDialog::FinishClicked()
bPreventPeriodicValidityChecksUntilNextChange = true;
// Display a nag if we didn't automatically hot-reload for the newly added class
const bool bWasHotReloaded = GEditor->AccessEditorUserSettings().bAutomaticallyHotReloadNewClasses;
const bool bWasHotReloaded = GetDefault<UEditorPerProjectUserSettings>()->bAutomaticallyHotReloadNewClasses;
if( bWasHotReloaded )
{
FNotificationInfo Notification( FText::Format( LOCTEXT("AddedClassSuccessNotification", "Added new class {0}"), FText::FromString(NewClassName) ) );

View File

@@ -16,6 +16,8 @@
#include "SHyperlink.h"
#include "SOutputLogDialog.h"
#include "Settings/EditorSettings.h"
#define LOCTEXT_NAMESPACE "NewProjectWizard"
FName SNewProjectWizard::TemplatePageName = TEXT("Template");
@@ -300,7 +302,7 @@ void SNewProjectWizard::Construct( const FArguments& InArgs )
bLastGlobalValidityCheckSuccessful = true;
bLastNameAndLocationValidityCheckSuccessful = true;
bPreventPeriodicValidityChecksUntilNextChange = false;
bCopyStarterContent = GEditor ? GEditor->AccessGameAgnosticSettings().bCopyStarterContentPreference : true;
bCopyStarterContent = GEditor ? GetDefault<UEditorSettings>()->bCopyStarterContentPreference : true;
IHardwareTargetingModule& HardwareTargeting = IHardwareTargetingModule::Get();
@@ -1288,7 +1290,7 @@ void SNewProjectWizard::SetDefaultProjectLocation( )
FString DefaultProjectFilePath;
// First, try and use the first previously used path that still exists
for ( const FString& CreatedProjectPath : GEditor->GetGameAgnosticSettings().CreatedProjectPaths )
for ( const FString& CreatedProjectPath : GetDefault<UEditorSettings>()->CreatedProjectPaths )
{
if ( IFileManager::Get().DirectoryExists(*CreatedProjectPath) )
{
@@ -1458,10 +1460,11 @@ bool SNewProjectWizard::CreateProject( const FString& ProjectFile )
CreatedProjectPath.AppendChar('/');
}
GEditor->AccessGameAgnosticSettings().CreatedProjectPaths.Remove(CreatedProjectPath);
GEditor->AccessGameAgnosticSettings().CreatedProjectPaths.Insert(CreatedProjectPath, 0);
GEditor->AccessGameAgnosticSettings().bCopyStarterContentPreference = bCopyStarterContent;
GEditor->AccessGameAgnosticSettings().PostEditChange();
auto* Settings = GetMutableDefault<UEditorSettings>();
Settings->CreatedProjectPaths.Remove(CreatedProjectPath);
Settings->CreatedProjectPaths.Insert(CreatedProjectPath, 0);
Settings->bCopyStarterContentPreference = bCopyStarterContent;
Settings->PostEditChange();
return true;
}

View File

@@ -10,6 +10,7 @@
#include "TargetPlatform.h"
#include "PlatformInfo.h"
#include "SSearchBox.h"
#include "Settings/EditorSettings.h"
#define LOCTEXT_NAMESPACE "ProjectBrowser"
@@ -262,7 +263,7 @@ void SProjectBrowser::Construct( const FArguments& InArgs )
.VAlign(VAlign_Center)
[
SNew(SCheckBox)
.IsChecked(GEditor->GetGameAgnosticSettings().bLoadTheMostRecentlyLoadedProjectAtStartup ? ECheckBoxState::Checked : ECheckBoxState::Unchecked)
.IsChecked(GetDefault<UEditorSettings>()->bLoadTheMostRecentlyLoadedProjectAtStartup ? ECheckBoxState::Checked : ECheckBoxState::Unchecked)
.OnCheckStateChanged(this, &SProjectBrowser::OnAutoloadLastProjectChanged)
.Content()
[
@@ -1142,7 +1143,7 @@ FReply SProjectBrowser::OnBrowseToProjectClicked()
// Find the first valid project file to select by default
FString DefaultFolder = FEditorDirectories::Get().GetLastDirectory(ELastDirectory::PROJECT);
for ( auto ProjectIt = GEditor->GetGameAgnosticSettings().RecentlyOpenedProjectFiles.CreateConstIterator(); ProjectIt; ++ProjectIt )
for ( auto ProjectIt = GetDefault<UEditorSettings>()->RecentlyOpenedProjectFiles.CreateConstIterator(); ProjectIt; ++ProjectIt )
{
if ( IFileManager::Get().FileSize(**ProjectIt) > 0 )
{
@@ -1269,14 +1270,14 @@ void SProjectBrowser::OnFilterTextChanged(const FText& InText)
void SProjectBrowser::OnAutoloadLastProjectChanged(ECheckBoxState NewState)
{
UEditorGameAgnosticSettings &Settings = GEditor->AccessGameAgnosticSettings();
Settings.bLoadTheMostRecentlyLoadedProjectAtStartup = (NewState == ECheckBoxState::Checked);
UEditorSettings *Settings = GetMutableDefault<UEditorSettings>();
Settings->bLoadTheMostRecentlyLoadedProjectAtStartup = (NewState == ECheckBoxState::Checked);
UProperty* AutoloadProjectProperty = FindField<UProperty>(Settings.GetClass(), "bLoadTheMostRecentlyLoadedProjectAtStartup");
UProperty* AutoloadProjectProperty = FindField<UProperty>(Settings->GetClass(), "bLoadTheMostRecentlyLoadedProjectAtStartup");
if (AutoloadProjectProperty != NULL)
{
FPropertyChangedEvent PropertyUpdateStruct(AutoloadProjectProperty);
Settings.PostEditChangeProperty(PropertyUpdateStruct);
Settings->PostEditChangeProperty(PropertyUpdateStruct);
}
}