@@ -19,7 +19,8 @@ namespace
1919 const std::filesystem::path& p_directory,
2020 bool p_isEngine,
2121 PathParser::EFileType p_fileType,
22- const std::function<void (std::string)>& p_onSelected)
22+ const std::function<void (std::string)>& p_onSelected,
23+ const std::function<bool(const std::string&)>& p_filter)
2324 {
2425 if (!std::filesystem::exists (p_directory))
2526 return ;
@@ -41,6 +42,10 @@ namespace
4142 continue ;
4243
4344 const std::string resourcePath = EDITOR_EXEC (GetResourcePath (path, p_isEngine));
45+
46+ if (p_filter && !p_filter (resourcePath))
47+ continue ;
48+
4449 const std::string filename = PathParser::GetElementName (resourcePath);
4550 const std::string friendlyPath = PathParser::GetFriendlyPath (resourcePath);
4651 const uint32_t iconID = EDITOR_CONTEXT (editorResources)->GetFileIcon (path)->GetTexture ().GetID ();
@@ -61,11 +66,12 @@ void OvEditor::Helpers::PickerHelpers::AddFileItems(
6166 PathParser::EFileType p_fileType,
6267 std::function<void (std::string)> p_onSelected,
6368 bool p_searchProject,
64- bool p_searchEngine)
69+ bool p_searchEngine,
70+ std::function<bool(const std::string&)> p_filter)
6571{
6672 if (p_searchProject)
67- CollectFromDirectory (p_list, EDITOR_CONTEXT (projectAssetsPath), false , p_fileType, p_onSelected);
73+ CollectFromDirectory (p_list, EDITOR_CONTEXT (projectAssetsPath), false , p_fileType, p_onSelected, p_filter );
6874
6975 if (p_searchEngine)
70- CollectFromDirectory (p_list, EDITOR_CONTEXT (engineAssetsPath), true , p_fileType, p_onSelected);
76+ CollectFromDirectory (p_list, EDITOR_CONTEXT (engineAssetsPath), true , p_fileType, p_onSelected, p_filter );
7177}
0 commit comments