From c67f463c73e194f2f4618bc8cb543830dd5f3cd7 Mon Sep 17 00:00:00 2001 From: empty2fill Date: Mon, 18 Apr 2022 16:17:12 +0900 Subject: [PATCH] Add Removes Element button on Class Naming Conventions (cherry picked from commit 796330b17594e15ba57ed505a8e6c3108f1bee51) --- .../Source/Linter/Private/LinterNamingConvention.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Plugins/Linter/Source/Linter/Private/LinterNamingConvention.cpp b/Plugins/Linter/Source/Linter/Private/LinterNamingConvention.cpp index 8ed5a9c..bf59fd2 100644 --- a/Plugins/Linter/Source/Linter/Private/LinterNamingConvention.cpp +++ b/Plugins/Linter/Source/Linter/Private/LinterNamingConvention.cpp @@ -25,10 +25,21 @@ void FLinterNamingConventionDetails::CustomizeDetails(class IDetailLayoutBuilder void FLinterNamingConventionDetails::OnGenerateElementForDetails(TSharedRef StructProperty, int32 ElementIndex, IDetailChildrenBuilder& ChildrenBuilder, IDetailLayoutBuilder* DetailLayout) { + TSharedRef RemoveButton = PropertyCustomizationHelpers::MakeRemoveButton(FSimpleDelegate::CreateLambda([this, DetailLayout, ElementIndex] { + TSharedRef NamingConventionsProperty = DetailLayout->GetProperty(GET_MEMBER_NAME_CHECKED(ULinterNamingConvention, ClassNamingConventions), ULinterNamingConvention::StaticClass()); + TSharedPtr NamingConventionsPropertyHandle = NamingConventionsProperty->AsArray(); + NamingConventionsPropertyHandle->DeleteItem(ElementIndex); + })); + ChildrenBuilder.AddCustomRow(FText::GetEmpty()) [ SNew(SHorizontalBox) + SHorizontalBox::Slot() + .AutoWidth() + [ + RemoveButton + ] + + SHorizontalBox::Slot() .FillWidth(1.0f) [ SNew(SProperty, StructProperty->GetChildHandle("SoftClassPtr"))