Files
UnrealEngineUWP/Engine/Source/Editor/DetailCustomizations/Private/DataTableCustomization.h
aurel cordonnier 8eebe8841f Merge UE5/RET @ 16305968 to UE5/Main
This represents UE4/Main @ 16261013 and Dev-PerfTest @ 16259937

[CL 16306996 by aurel cordonnier in ue5-main branch]
2021-05-12 18:10:03 -04:00

57 lines
1.9 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "IPropertyTypeCustomization.h"
#include "IDetailChildrenBuilder.h"
#include "Widgets/SToolTip.h"
#include "Engine/DataTable.h"
#include "IPropertyUtilities.h"
struct FAssetData;
/**
* Customizes a DataTable asset to use a dropdown
*/
class FDataTableCustomizationLayout : public IPropertyTypeCustomization
{
public:
static TSharedRef<IPropertyTypeCustomization> MakeInstance()
{
return MakeShareable( new FDataTableCustomizationLayout );
}
/** IPropertyTypeCustomization interface */
virtual void CustomizeHeader(TSharedRef<class IPropertyHandle> InStructPropertyHandle, class FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils) override;
virtual void CustomizeChildren(TSharedRef<class IPropertyHandle> InStructPropertyHandle, class IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils) override;
private:
/** Reads current value of handles */
bool GetCurrentValue(UDataTable*& OutDataTable, FName& OutName) const;
/** Returns true if we should hide asset due to wrong type */
bool ShouldFilterAsset(const FAssetData& AssetData);
/** Delegate to refresh the drop down when the datatable changes */
void OnDataTableChanged();
/** Open reference viewer */
void OnSearchForReferences();
/** Get list of all rows */
void OnGetRowStrings(TArray< TSharedPtr<FString> >& OutStrings, TArray<TSharedPtr<SToolTip>>& OutToolTips, TArray<bool>& OutRestrictedItems) const;
/** Gets currently selected row display string */
FString OnGetRowValueString() const;
/** Handle to the struct properties being customized */
TSharedPtr<IPropertyHandle> StructPropertyHandle;
TSharedPtr<IPropertyHandle> DataTablePropertyHandle;
TSharedPtr<IPropertyHandle> RowNamePropertyHandle;
/** The MetaData derived filter for the row type */
FName RowTypeFilter;
UScriptStruct* RowFilterStruct;
};