I have a plugin that creates copies of blueprint .uasset files in a temporary directory. I’d like to delete them but I haven’t yet found a good way to know when those files are no longer referenced. So instead I delete the directory when the editor starts. However, while the editor is running after any files have been copied, these temporary files show up in the Open Asset dialog (Alt + Shift + O) when I don’t want them to.
I found FBlacklistPaths which looked like it would hide folders from the asset dialogs which is what I wanted, however it did not behave how I expected.
I have code like the following in a plugin:
const FString Path = FPackageName::FilenameToLongPackageName(FPaths::DiffDir()); FModuleManager::GetModuleChecked<FAssetToolsModule>("AssetTools").Get().GetFolderBlacklist()->AddBlacklistItem(TEXT("MyPluginName"), Path);
This code correctly hides the folder from the Open Asset dialog IF a class filter (such as Blueprint) is selected in the Open Asset dialog. If no class filter is selected, nothing will show in the dialog no matter what is in the search bar. This is different from the default behavior before this code is run where if no class filters are selected and nothing is in the search bar, the Open Asset dialog will show all assets.
If I’m reading SAssetView::RefreshSourceItems() correctly, this is a bug. If any blacklist is provided, bShowAll is false, so the code proceeds to the lower section where it calls AssetRegistryModule.Get().GetAssets(Filter, Assets), but in this case our Filter is empty (it doesn’t reference the blacklist) and UAssetRegistryImpl::GetAssets() returns early with no assets if the filter is empty. However when a class filter is selected, Filter is no longer empty and GetAssets() returns an asset list as expected.
Is this a bug or am I just using some interface incorrectly? There is nearly no documentation on how to use FBlacklistPaths. Are there any workarounds to achieve what I’m looking for?