You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Change summary: - Moved base "managed list" customization out into its own class so that it can be shared with editor/project settings customization. - Refactored Blueprint global options (i.e. Class Settings) details customization to utilize the new "managed list" base class. - Removed filter text as a customizable managed list display option and redefined it to be more consistent with property editor nodes. - Fixed the "Imports" display in Class Settings to no longer list global imports in the non-default section. - Added a new details customization for UBlueprintEditorSettings. - Added a customized editor for the 'NamespacesToAlwaysInclude' property for both local user settings and shared project settings. - Moved the "Add" button for imports and interfaces to be on the same line as the header row (eliminates some wasted space in the details view). - Fixed up global import property display names and tooltips to be more descriptive. - Fixed an issue that prevented reselection of the previous namespace setting in the Blueprint namespace entry combo box after clearing it. - Fixed the incorrect vertical alignment of import/interface item rows. #jira UE-143552, UE-133369, UE-136904, UE-142557 #rb Ben.Hoffman #preflight 622ba26c46679d56c31dddda [CL 19365260 by Phillip Kavan in ue5-main branch]
128 lines
5.0 KiB
C++
128 lines
5.0 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "BlueprintEditorProjectSettingsCustomization.h"
|
|
#include "BlueprintEditorSettings.h"
|
|
#include "Settings/BlueprintEditorProjectSettings.h"
|
|
#include "PropertyHandle.h"
|
|
#include "DetailLayoutBuilder.h"
|
|
#include "IDetailPropertyRow.h"
|
|
#include "DetailWidgetRow.h"
|
|
#include "PropertyCustomizationHelpers.h"
|
|
#include "BlueprintManagedListDetails.h"
|
|
#include "SBlueprintNamespaceEntry.h"
|
|
#include "ScopedTransaction.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "FBlueprintEditorProjectSettingsCustomization"
|
|
|
|
namespace UE::Editor::BlueprintEditorProjectSettingsCustomization::Private
|
|
{
|
|
class FBlueprintGlobalProjectImportsLayout : public FBlueprintManagedListDetails, public TSharedFromThis<FBlueprintGlobalProjectImportsLayout>
|
|
{
|
|
public:
|
|
FBlueprintGlobalProjectImportsLayout(TSharedRef<IPropertyHandle> InPropertyHandle)
|
|
: FBlueprintManagedListDetails()
|
|
, PropertyHandle(InPropertyHandle)
|
|
{
|
|
DisplayOptions.TitleText = PropertyHandle->GetPropertyDisplayName();
|
|
DisplayOptions.TitleTooltipText = PropertyHandle->GetToolTipText();
|
|
|
|
DisplayOptions.NoItemsLabelText = LOCTEXT("NoGlobalImports", "None");
|
|
|
|
// Add a custom edit condition to link it to the editor's namespace feature toggle flag (for consistency w/ the editor-specific set).
|
|
DisplayOptions.EditCondition = TAttribute<bool>::CreateLambda([]()
|
|
{
|
|
return GetDefault<UBlueprintEditorSettings>()->bEnableNamespaceEditorFeatures;
|
|
});
|
|
}
|
|
|
|
protected:
|
|
/** FBlueprintManagedListDetails interface*/
|
|
virtual TSharedPtr<SWidget> MakeAddItemWidget() override
|
|
{
|
|
return SNew(SBlueprintNamespaceEntry)
|
|
.AllowTextEntry(false)
|
|
.OnNamespaceSelected(this, &FBlueprintGlobalProjectImportsLayout::OnNamespaceSelected)
|
|
.OnFilterNamespaceList(this, &FBlueprintGlobalProjectImportsLayout::OnFilterNamespaceList)
|
|
.ButtonContent()
|
|
[
|
|
SNew(STextBlock)
|
|
.Text(LOCTEXT("BlueprintAddGlobalImportButton", "Add"))
|
|
.ToolTipText(LOCTEXT("BlueprintAddGlobalImportButton_Tooltip", "Choose a namespace that all Blueprints in this project should import by default (applies to all users)."))
|
|
];
|
|
}
|
|
|
|
virtual void GetManagedListItems(TArray<FManagedListItem>& OutListItems) const override
|
|
{
|
|
for(const FString& GlobalNamespace : GetDefault<UBlueprintEditorProjectSettings>()->NamespacesToAlwaysInclude)
|
|
{
|
|
FManagedListItem ItemDesc;
|
|
ItemDesc.ItemName = GlobalNamespace;
|
|
ItemDesc.DisplayName = FText::FromString(GlobalNamespace);
|
|
ItemDesc.bIsRemovable = true;
|
|
|
|
OutListItems.Add(MoveTemp(ItemDesc));
|
|
}
|
|
}
|
|
|
|
virtual void OnRemoveItem(const FManagedListItem& Item)
|
|
{
|
|
FScopedTransaction Transaction(LOCTEXT("RemoveGlobalImport_Transaction", "Remove Global Import"));
|
|
|
|
UBlueprintEditorProjectSettings* BlueprintEditorProjectSettings = GetMutableDefault<UBlueprintEditorProjectSettings>();
|
|
check(BlueprintEditorProjectSettings);
|
|
|
|
PropertyHandle->NotifyPreChange();
|
|
BlueprintEditorProjectSettings->NamespacesToAlwaysInclude.Remove(Item.ItemName);
|
|
PropertyHandle->NotifyPostChange(EPropertyChangeType::ArrayRemove);
|
|
PropertyHandle->NotifyFinishedChangingProperties();
|
|
|
|
RegenerateChildContent();
|
|
}
|
|
/** END FBlueprintManagedListDetails interface */
|
|
|
|
void OnNamespaceSelected(const FString& InNamespace)
|
|
{
|
|
FScopedTransaction Transaction(LOCTEXT("AddGlobalImport_Transaction", "Add Global Import"));
|
|
|
|
UBlueprintEditorProjectSettings* BlueprintEditorProjectSettings = GetMutableDefault<UBlueprintEditorProjectSettings>();
|
|
check(BlueprintEditorProjectSettings);
|
|
|
|
PropertyHandle->NotifyPreChange();
|
|
BlueprintEditorProjectSettings->NamespacesToAlwaysInclude.AddUnique(InNamespace);
|
|
PropertyHandle->NotifyPostChange(EPropertyChangeType::ArrayAdd);
|
|
PropertyHandle->NotifyFinishedChangingProperties();
|
|
|
|
RegenerateChildContent();
|
|
}
|
|
|
|
void OnFilterNamespaceList(TArray<FString>& InOutNamespaceList)
|
|
{
|
|
for (const FString& GlobalNamespace : GetDefault<UBlueprintEditorProjectSettings>()->NamespacesToAlwaysInclude)
|
|
{
|
|
InOutNamespaceList.RemoveSwap(GlobalNamespace);
|
|
}
|
|
}
|
|
|
|
private:
|
|
TSharedRef<IPropertyHandle> PropertyHandle;
|
|
};
|
|
}
|
|
|
|
TSharedRef<IDetailCustomization> FBlueprintEditorProjectSettingsCustomization::MakeInstance()
|
|
{
|
|
return MakeShared<FBlueprintEditorProjectSettingsCustomization>();
|
|
}
|
|
|
|
void FBlueprintEditorProjectSettingsCustomization::CustomizeDetails(IDetailLayoutBuilder& LayoutBuilder)
|
|
{
|
|
static FName PropertyName_NamespacesToAlwaysInclude = GET_MEMBER_NAME_CHECKED(UBlueprintEditorProjectSettings, NamespacesToAlwaysInclude);
|
|
TSharedRef<IPropertyHandle> PropertyHandle_NamespacesToAlwaysInclude = LayoutBuilder.GetProperty(PropertyName_NamespacesToAlwaysInclude);
|
|
|
|
PropertyHandle_NamespacesToAlwaysInclude->MarkHiddenByCustomization();
|
|
|
|
IDetailCategoryBuilder& CategoryBuilder = LayoutBuilder.EditCategory(PropertyHandle_NamespacesToAlwaysInclude->GetDefaultCategoryName());
|
|
CategoryBuilder.AddCustomBuilder(MakeShared<UE::Editor::BlueprintEditorProjectSettingsCustomization::Private::FBlueprintGlobalProjectImportsLayout>(PropertyHandle_NamespacesToAlwaysInclude));
|
|
}
|
|
|
|
#undef LOCTEXT_NAMESPACE
|