Files
UnrealEngineUWP/Engine/Source/Editor/BlueprintGraph/Private/BlueprintEditorSettings.cpp
phillip kavan 4249ae08aa More groundwork for namespaces.
Change summary:
- Consolidated transient setting flags into UBlueprintEditorSettings; no longer dependent on UEditorExperimentalSettings. These continue to mirror the CVars for now. Also restored the sink function so that changing options will refresh the UI.
- Compiling a Blueprint will now inject the namespace into the class metadata if it is set on the UBlueprint asset.
- Added IsImportedType()/IsImportedObject() helper methods to FBlueprintNamepaceHelper.
- Added a CVar to provide a way to test the inclusion of parent class namespaces when checking scope; disabled by default for now to preserve current behavior.

#jira UE-108316

#ROBOMERGE-SOURCE: CL 15558978 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)

[CL 15558982 by phillip kavan in ue5-main branch]
2021-03-01 13:21:24 -04:00

120 lines
4.3 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "BlueprintEditorSettings.h"
#include "Misc/ConfigCacheIni.h"
#include "Editor/EditorPerProjectUserSettings.h"
#include "Settings/EditorExperimentalSettings.h"
#include "BlueprintActionDatabase.h"
#include "FindInBlueprintManager.h"
#include "Subsystems/AssetEditorSubsystem.h"
#include "Editor.h"
#include "BlueprintTypePromotion.h"
UBlueprintEditorSettings::UBlueprintEditorSettings(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
// Style Settings
, bDrawMidpointArrowsInBlueprints(false)
, bShowGraphInstructionText(true)
, bHideUnrelatedNodes(false)
, bShowShortTooltips(true)
// Workflow Settings
, bSplitContextTargetSettings(true)
, bExposeAllMemberComponentFunctions(true)
, bShowContextualFavorites(false)
, bExposeDeprecatedFunctions(false)
, bCompactCallOnMemberNodes(false)
, bFlattenFavoritesMenus(true)
, bAutoCastObjectConnections(false)
, bShowViewportOnSimulate(false)
, bSpawnDefaultBlueprintNodes(true)
, bHideConstructionScriptComponentsInDetailsView(true)
, bHostFindInBlueprintsInGlobalTab(true)
, bNavigateToNativeFunctionsFromCallNodes(true)
, bDoubleClickNavigatesToParent(false)
, bEnableTypePromotion(true)
// Experimental
, bEnableNamespaceFilteringFeatures(false)
, bEnableNamespaceImportingFeatures(false)
, bFavorPureCastNodes(false)
// Compiler Settings
, SaveOnCompile(SoC_Never)
, bJumpToNodeErrors(false)
, bAllowExplicitImpureNodeDisabling(false)
// Developer Settings
, bShowActionMenuItemSignatures(false)
// Perf Settings
, bShowDetailedCompileResults(false)
, CompileEventDisplayThresholdMs(5)
, NodeTemplateCacheCapMB(20.f)
// No category
, bShowInheritedVariables(false)
, bAlwaysShowInterfacesInOverrides(true)
, bShowParentClassInOverrides(true)
, bShowEmptySections(true)
, bShowAccessSpecifier(false)
, bIncludeCommentNodesInBookmarksTab(true)
, bShowBookmarksForCurrentDocumentOnlyInTab(false)
{
// settings that were moved out of experimental...
UEditorExperimentalSettings const* ExperimentalSettings = GetDefault<UEditorExperimentalSettings>();
bDrawMidpointArrowsInBlueprints = ExperimentalSettings->bDrawMidpointArrowsInBlueprints;
// settings that were moved out of editor-user settings...
UEditorPerProjectUserSettings const* UserSettings = GetDefault<UEditorPerProjectUserSettings>();
bShowActionMenuItemSignatures = UserSettings->bDisplayActionListItemRefIds;
FString const ClassConfigKey = GetClass()->GetPathName();
bool bOldSaveOnCompileVal = false;
// backwards compatibility: handle the case where users have already switched this on
if (GConfig->GetBool(*ClassConfigKey, TEXT("bSaveOnCompile"), bOldSaveOnCompileVal, GEditorPerProjectIni) && bOldSaveOnCompileVal)
{
SaveOnCompile = SoC_SuccessOnly;
}
}
void UBlueprintEditorSettings::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
{
const FName PropertyName = (PropertyChangedEvent.Property != nullptr) ? PropertyChangedEvent.Property->GetFName() : NAME_None;
if (PropertyName == GET_MEMBER_NAME_CHECKED(UBlueprintEditorSettings, bHostFindInBlueprintsInGlobalTab))
{
// Close all open Blueprint editors to reset associated FiB states.
UAssetEditorSubsystem* AssetEditorSubsystem = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();
TArray<UObject*> EditedAssets = AssetEditorSubsystem->GetAllEditedAssets();
for (UObject* EditedAsset : EditedAssets)
{
if (EditedAsset->IsA<UBlueprint>())
{
AssetEditorSubsystem->CloseAllEditorsForAsset(EditedAsset);
}
}
// Enable or disable the feature through the FiB manager.
FFindInBlueprintSearchManager::Get().EnableGlobalFindResults(bHostFindInBlueprintsInGlobalTab);
}
bool bShouldRebuildRegistry = false;
if (PropertyName == GET_MEMBER_NAME_CHECKED(UBlueprintEditorSettings, bExposeDeprecatedFunctions))
{
bShouldRebuildRegistry = true;
}
// Refresh type promotion when the preference gets changed so that we can correctly rebuild the action database
if (PropertyName == GET_MEMBER_NAME_CHECKED(UBlueprintEditorSettings, bEnableTypePromotion))
{
FTypePromotion::ClearNodeSpawners();
bShouldRebuildRegistry = true;
}
if (bShouldRebuildRegistry)
{
FBlueprintActionDatabase::Get().RefreshAll();
}
Super::PostEditChangeProperty(PropertyChangedEvent);
OnSettingsChange.Broadcast(this, PropertyChangedEvent.ChangeType);
}