ATOM-15372 Restoring material browser filter logic
Restoring material browser filter logic to only show folders with content that matches the filter. This change was originally introduced with the functionality to create a new folder within the material browser. Creating a new, empty folder would not display the folder in the browser because it did not have any content that matched the filter. While that makes sense to address the issue with the create folder command, it makes it extremely difficult and navigate the browser to find assets that match the filter because every folder that does not match the filter is also displayed in the tree. We can revisit issues with the create folder action later. https://jira.agscollab.com/browse/ATOM-15372
This commit is contained in:
@@ -110,30 +110,19 @@ namespace MaterialEditor
|
||||
{
|
||||
using namespace AzToolsFramework::AssetBrowser;
|
||||
|
||||
// Material Browser uses the following filters:
|
||||
// 1. [All source files (no products) that contain products matching the assetType specified by searchWidget (default is materials and textures)]
|
||||
// 2. [All folders (including empty folders)]
|
||||
// 3. [All Sources and folders matching the search text typed in search widget]
|
||||
// Final filter = ((1 OR 2) AND 3)
|
||||
|
||||
QSharedPointer<EntryTypeFilter> sourceFilter(new EntryTypeFilter);
|
||||
sourceFilter->SetEntryType(AssetBrowserEntry::AssetEntryType::Source);
|
||||
|
||||
QSharedPointer<CompositeFilter> assetTypeFilter(new CompositeFilter(CompositeFilter::LogicOperatorType::AND));
|
||||
assetTypeFilter->AddFilter(sourceFilter);
|
||||
assetTypeFilter->AddFilter(m_ui->m_searchWidget->GetTypesFilter());
|
||||
|
||||
QSharedPointer<EntryTypeFilter> folderFilter(new EntryTypeFilter);
|
||||
folderFilter->SetEntryType(AssetBrowserEntry::AssetEntryType::Folder);
|
||||
|
||||
QSharedPointer<CompositeFilter> sourceOrFolderFilter(new CompositeFilter(CompositeFilter::LogicOperatorType::OR));
|
||||
sourceOrFolderFilter->AddFilter(assetTypeFilter);
|
||||
sourceOrFolderFilter->AddFilter(sourceFilter);
|
||||
sourceOrFolderFilter->AddFilter(folderFilter);
|
||||
|
||||
QSharedPointer<CompositeFilter> finalFilter(new CompositeFilter(CompositeFilter::LogicOperatorType::AND));
|
||||
finalFilter->AddFilter(sourceOrFolderFilter);
|
||||
finalFilter->AddFilter(m_ui->m_searchWidget->GetStringFilter());
|
||||
finalFilter->SetFilterPropagation(AssetBrowserEntryFilter::PropagateDirection::Down);
|
||||
finalFilter->AddFilter(m_ui->m_searchWidget->GetFilter());
|
||||
|
||||
return finalFilter;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user