// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "Containers/Array.h" #include "Containers/UnrealString.h" #include "IPropertyTypeCustomization.h" #include "Templates/SharedPointer.h" #include "UObject/NameTypes.h" class IPropertyHandle; class SToolTip; class UDataTable; class UScriptStruct; struct FAssetData; /** * Customizes a DataTable asset to use a dropdown */ class FDataTableCustomizationLayout : public IPropertyTypeCustomization { public: static TSharedRef MakeInstance() { return MakeShareable( new FDataTableCustomizationLayout ); } /** IPropertyTypeCustomization interface */ virtual void CustomizeHeader(TSharedRef InStructPropertyHandle, class FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils) override; virtual void CustomizeChildren(TSharedRef 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 >& OutStrings, TArray>& OutToolTips, TArray& OutRestrictedItems) const; /** Gets currently selected row display string */ FString OnGetRowValueString() const; /** Handle to the struct properties being customized */ TSharedPtr StructPropertyHandle; TSharedPtr DataTablePropertyHandle; TSharedPtr RowNamePropertyHandle; /** The MetaData derived filter for the row type */ FName RowTypeFilter; UScriptStruct* RowFilterStruct; };