Files
UnrealEngineUWP/Engine/Source/Editor/DetailCustomizations/Private/SoftObjectPathCustomization.cpp
sebastian nordgren 594a347d48 SPropertyEditorAsset now requests additional width based on the number of additional buttons it has (if it doesn't have a thumbnail).
#jira UETOOL-2815
#rb lauren.barnes

#ROBOMERGE-SOURCE: CL 15889436 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v786-15839533)

[CL 15890450 by sebastian nordgren in ue5-main branch]
2021-04-01 12:15:43 -04:00

48 lines
1.7 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "SoftObjectPathCustomization.h"
#include "Widgets/DeclarativeSyntaxSupport.h"
#include "Engine/GameViewportClient.h"
#include "AssetData.h"
#include "EditorClassUtils.h"
#include "PropertyHandle.h"
#include "PropertyCustomizationHelpers.h"
void FSoftObjectPathCustomization::CustomizeHeader( TSharedRef<IPropertyHandle> InStructPropertyHandle, FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils )
{
StructPropertyHandle = InStructPropertyHandle;
const FString& MetaClassName = InStructPropertyHandle->GetMetaData("MetaClass");
UClass* MetaClass = !MetaClassName.IsEmpty()
? FEditorClassUtils::GetClassFromString(MetaClassName)
: UObject::StaticClass();
TSharedRef<SObjectPropertyEntryBox> ObjectPropertyEntryBox = SNew(SObjectPropertyEntryBox)
.AllowedClass(MetaClass)
.PropertyHandle(InStructPropertyHandle)
.ThumbnailPool(StructCustomizationUtils.GetThumbnailPool());
float MinDesiredWidth, MaxDesiredWidth;
ObjectPropertyEntryBox->GetDesiredWidth(MinDesiredWidth, MaxDesiredWidth);
HeaderRow
.NameContent()
[
InStructPropertyHandle->CreatePropertyNameWidget()
]
.ValueContent()
.MinDesiredWidth(MinDesiredWidth)
.MaxDesiredWidth(MaxDesiredWidth)
[
// Add an object entry box. Even though this isn't an object entry, we will simulate one
ObjectPropertyEntryBox
];
// This avoids making duplicate reset boxes
StructPropertyHandle->MarkResetToDefaultCustomized();
}
void FSoftObjectPathCustomization::CustomizeChildren(TSharedRef<IPropertyHandle> InStructPropertyHandle, IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
{
}