SAssetFilterBar

An Asset Filter Bar widget, which can be used to filter items of type [FilterType] given a list of custom filters along with built in support for AssetType filters

Unreal Engine C++ API Reference > Editor > EditorWidgets > Filters

Inheritance Hierarchy

References

   
Module EditorWidgets
Header /Engine/Source/Editor/EditorWidgets/Public/Filters/SAssetFilterBar.h
Include #include "Filters/SAssetFilterBar.h"

Syntax

template<typename FilterType>  
class SAssetFilterBar :  
    public [SBasicFilterBar< FilterType >](API\Developer\ToolWidgets\Filters\SBasicFilterBar),  
    public [FFilterBarBase](API\Editor\EditorWidgets\Filters\FFilterBarBase)  

Remarks

An Asset Filter Bar widget, which can be used to filter items of type [FilterType] given a list of custom filters along with built in support for AssetType filters Use the GetAllActiveFilters() and GetCombinedBackendFilter() functions to get all the custom and asset filters respectively NOTE: GetCombinedBackendFilter returns an FARFilter, and it is on the user of this widget to compile it/use it to filter their items. If you want more straightforward filtering, look at SFilterBar which streamlines this Use MakeAddFilterButton() to make the button that summons the dropdown showing all the filters Sample Usage: void OnFilterChangedDelegate() { TSharedPtr< TFilterCollection > ActiveFilters = MyFilterBar->GetAllActiveFilters(); FARFilter CombinedBackEndFilter = MyFilterBar->GetCombinedBackendFilter() TArray MyUnfilteredItems; TArray FilteredItems;

for(FilterType& MyItem : MyUnfilteredItems) { if(CompileAndRunFARFilter(CombinedBackEndFilter, MyItem) && ActiveFilters.PassesAllFilters(MyItem)) { FilteredItems.Add(MyItem); } } }

Variables

Type Name Description
EAssetClassActi... AssetClassAction The AssetClassAction used to get the permission list from the Asset Tools Module
TMap< FName, TS... AssetFilterCategories  
TArray< TShared... AssetFilters A copy of all AssetFilters in this->Filters for convenient access
bool bUseDefaultAssetFilters Whether the filter bar provides the default Asset Filters
TSharedPtr< FFi... CategoryToExpand The category to expand in the filter menu
TArray< TShared... CustomClassFilters List of custom Class Filters that will be shown in the filter bar
TMap< FString, ... UnknownTypeFilters A map of any type filters we encounter while calling LoadSettings(), but don't have in this instance of the filter bar.
TArray< TShared... UserCustomClassFilters Copy of Custom Class Filters that were provided by the user, and not autopopulated from AssetTypeActions

Functions

Type Name Description
TSharedRef< ... AddAssetFilterToBar ( const TSharedPtr< FCustomClassFilte... ) Add an AssetFilter to the toolbar, making it "Active" but not enabled
void Construct ( const FArguments& InArgs ) Constructs this widget with InArgs
void CreateAssetTypeActionFilters () Create the default set of IAssetTypeActions Filters provided with the widget if requested
void CreateFiltersMenuCategory ( FToolMenuSection& Section, const TArray< TSharedPtr< FCustomCl... ) Handler for when the add filter menu is populated by a category
void CreateFiltersMenuCategory ( UToolMenu* InMenu, const TArray< TSharedPtr< FCustomCl... )  
bool DoesAssetTypeFilterExist ( const FTopLevelAssetPath& InClassP... ) Check if there is a filter associated with the given class represented by FTopLevelAssetPath in the filter bar
void FilterByTypeCategoryClicked ( TSharedPtr< FFilterCategory > TypeC..., TArray< TSharedPtr< FCustomClassFil... ) Handler for when filter by type category is selected
void FilterByTypeClicked ( TSharedPtr< FCustomClassFilterData ... ) Handler for when filter by type is selected
ECheckBoxSta... GetAssetTypeFilterCheckState ( const FTopLevelAssetPath& InClassP... ) Returns the check box state of the specified filter (in the filter drop down).
FARFilter GetCombinedBackendFilter () Use this function to get an FARFilter that represents all the AssetType filters that are currently active
bool IsAssetTypeFilterActive ( const FTopLevelAssetPath& InClassP... ) Returns true if the specified filter is both checked (pinned on the filter bar) and active (contributing to filter the result).
bool IsClassTypeInUse ( TSharedPtr< FCustomClassFilterData ... ) Handler to determine the "checked" state of class filter in the filter dropdown
ECheckBoxSta... IsTypeCategoryChecked ( TSharedPtr< FFilterCategory > TypeC..., TArray< TSharedPtr< FCustomClassFil... ) Handler to determine the "checked" state of an type category in the filter dropdown
bool IsTypeCategoryInUse ( TSharedPtr< FFilterCategory > TypeC..., TArray< TSharedPtr< FCustomClassFil... ) Function to check if a given type category is in use
void LoadCustomTextFilters ( const FFilterBarSettings* Filt... ) Load all the custom class filters (created by the user) from the specified config
void LoadFilters ( const FFilterBarSettings* Filt... ) Load all the custom filters (created programatically) from the specified config
void LoadSettings ()  
void PopulateAddFilterMenu ( UToolMenu* Menu, TSharedPtr< FFilterCategory > MenuE..., FOnFilterAssetType OnFilterAssetTyp... ) Handler to Populate the Add Filter Menu.
void RemoveAssetFilter ( const TSharedPtr< FCustomClassFilte..., bool ExecuteOnFilterChanged ) Handler for when the remove filter button was clicked on a filter
void SaveCustomTextFilters ( FFilterBarSettings* FilterBarC... ) Save all the custom class filters (created by the user) into the specified config
void SaveFilters ( FFilterBarSettings* FilterBarC... ) Save all the custom filters (created programatically) into the specified config
void SaveSettings ()  
void SetAssetTypeFilterCheckState ( const FTopLevelAssetPath& InClassP..., ECheckBoxState InCheckState, bool bEnableFilter ) Set the check box state of the specified filter (in the filter drop down) and pin/unpin a filter widget on/from the filter bar.
void ToggleAssetTypeFilterEnabled ( const FTopLevelAssetPath& InClassP..., bool bEnable ) If a filter with the input class name is Checked (i.e visible in the bar), enable/disable it

Overridden from SBasicFilterBar

Type Name Description
TSharedRef< ... MakeAddFilterMenu () Handler for when the add filter button was clicked
void RemoveAllButThis ( const TSharedRef< SFilter >& Filte... ) AssetFilter specific override to SBasicFilterBar::RemoveAllButThis
void RemoveAllFilters () Remove all filters from the filter bar, while disabling any active ones
void RemoveFilter ( const TSharedRef< SFilter >& Filte... ) Remove a filter from the filter bar

Classes

Type Name Description
Public struct FArguments  
Protected class SAssetFilter A subclass of SFilter in SBasicFilterBar to add functionality for Asset Filters

Typedefs

See Also

SFilterBar in EditorWidgets

which is a simplified version of this widget for most use cases which is probably what you want to use

SBasicFilterBar in ToolWidgets if you want a simple FilterBar without AssetType Filters (usable in non editor builds)

SFilterList in ContentBrowserfor an extremely complex example of how to usethis widget

though for most cases you probably want to useSFilterBar NOTE: The filter functions create copies

so you want to useSAssetFilterBar<TSharedPtr> etc instead of SAssetFilterBar when possible NOTE: You will need to also add "ToolWidgets" as a dependency to your module to usethis widget Sample Usage: SAssignNew(MyFilterBar

SAssetFilterBar) .OnFilterChanged() // A delegate for when the list of filters changes .CustomFilters() // An array of filters available to this FilterBar (

FGenericFilter to create simple delegate based filters)


Ask questions and help your peers Developer Forums

Write your own tutorials or read those from others Learning Library