Files
UnrealEngineUWP/Engine/Source/Editor/DetailCustomizations/Private/SoftObjectPathCustomization.cpp
Matt Peters 7ad238a806 AssetRegistry includes (Engine/Source): change #include "AssetData.h" -> #include "AssetRegistry/AssetData.h", and similar for the other moved AssetRegistry headers.
#rb Zousar.Shaker
#rnx
#preflight 6270509a220f89f0ad573030

[CL 20016982 by Matt Peters in ue5-main branch]
2022-05-02 18:06:48 -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 "AssetRegistry/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)
{
}