Fix T52109: Folder search won't work when selecting animation output folder.
Text search would not run in case there was no 'type' enabled in filter buttons. Now instead consider that no types enabled == all types enabled.
This commit is contained in:
parent
ecb5b55d7f
commit
3cfb248bb6
@ -277,9 +277,10 @@ typedef struct FileListFilter {
|
||||
|
||||
/* FileListFilter.flags */
|
||||
enum {
|
||||
FLF_HIDE_DOT = 1 << 0,
|
||||
FLF_HIDE_PARENT = 1 << 1,
|
||||
FLF_HIDE_LIB_DIR = 1 << 2,
|
||||
FLF_DO_FILTER = 1 << 0,
|
||||
FLF_HIDE_DOT = 1 << 1,
|
||||
FLF_HIDE_PARENT = 1 << 2,
|
||||
FLF_HIDE_LIB_DIR = 1 << 3,
|
||||
};
|
||||
|
||||
typedef struct FileList {
|
||||
@ -594,24 +595,27 @@ static bool is_filtered_file(FileListInternEntry *file, const char *UNUSED(root)
|
||||
{
|
||||
bool is_filtered = !is_hidden_file(file->relpath, filter);
|
||||
|
||||
if (is_filtered && filter->filter && !FILENAME_IS_CURRPAR(file->relpath)) {
|
||||
if (file->typeflag & FILE_TYPE_DIR) {
|
||||
if (file->typeflag & (FILE_TYPE_BLENDERLIB | FILE_TYPE_BLENDER | FILE_TYPE_BLENDER_BACKUP)) {
|
||||
if (!(filter->filter & (FILE_TYPE_BLENDER | FILE_TYPE_BLENDER_BACKUP))) {
|
||||
is_filtered = false;
|
||||
if (is_filtered && (filter->flags & FLF_DO_FILTER) && !FILENAME_IS_CURRPAR(file->relpath)) {
|
||||
/* We only check for types if some type are enabled in filtering. */
|
||||
if (filter->filter) {
|
||||
if (file->typeflag & FILE_TYPE_DIR) {
|
||||
if (file->typeflag & (FILE_TYPE_BLENDERLIB | FILE_TYPE_BLENDER | FILE_TYPE_BLENDER_BACKUP)) {
|
||||
if (!(filter->filter & (FILE_TYPE_BLENDER | FILE_TYPE_BLENDER_BACKUP))) {
|
||||
is_filtered = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!(filter->filter & FILE_TYPE_FOLDER)) {
|
||||
is_filtered = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!(filter->filter & FILE_TYPE_FOLDER)) {
|
||||
if (!(file->typeflag & filter->filter)) {
|
||||
is_filtered = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!(file->typeflag & filter->filter)) {
|
||||
is_filtered = false;
|
||||
}
|
||||
}
|
||||
if (is_filtered && (filter->filter_search[0] != '\0')) {
|
||||
if (fnmatch(filter->filter_search, file->relpath, FNM_CASEFOLD) != 0) {
|
||||
is_filtered = false;
|
||||
@ -631,27 +635,30 @@ static bool is_filtered_lib(FileListInternEntry *file, const char *root, FileLis
|
||||
|
||||
if (BLO_library_path_explode(path, dir, &group, &name)) {
|
||||
is_filtered = !is_hidden_file(file->relpath, filter);
|
||||
if (is_filtered && filter->filter && !FILENAME_IS_CURRPAR(file->relpath)) {
|
||||
if (file->typeflag & FILE_TYPE_DIR) {
|
||||
if (file->typeflag & (FILE_TYPE_BLENDERLIB | FILE_TYPE_BLENDER | FILE_TYPE_BLENDER_BACKUP)) {
|
||||
if (!(filter->filter & (FILE_TYPE_BLENDER | FILE_TYPE_BLENDER_BACKUP))) {
|
||||
is_filtered = false;
|
||||
if (is_filtered && (filter->flags & FLF_DO_FILTER) && !FILENAME_IS_CURRPAR(file->relpath)) {
|
||||
/* We only check for types if some type are enabled in filtering. */
|
||||
if (filter->filter || filter->filter_id) {
|
||||
if (file->typeflag & FILE_TYPE_DIR) {
|
||||
if (file->typeflag & (FILE_TYPE_BLENDERLIB | FILE_TYPE_BLENDER | FILE_TYPE_BLENDER_BACKUP)) {
|
||||
if (!(filter->filter & (FILE_TYPE_BLENDER | FILE_TYPE_BLENDER_BACKUP))) {
|
||||
is_filtered = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!(filter->filter & FILE_TYPE_FOLDER)) {
|
||||
is_filtered = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!(filter->filter & FILE_TYPE_FOLDER)) {
|
||||
if (is_filtered && group) {
|
||||
if (!name && (filter->flags & FLF_HIDE_LIB_DIR)) {
|
||||
is_filtered = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_filtered && group) {
|
||||
if (!name && (filter->flags & FLF_HIDE_LIB_DIR)) {
|
||||
is_filtered = false;
|
||||
}
|
||||
else {
|
||||
unsigned int filter_id = groupname_to_filter_id(group);
|
||||
if (!(filter_id & filter->filter_id)) {
|
||||
is_filtered = false;
|
||||
else {
|
||||
unsigned int filter_id = groupname_to_filter_id(group);
|
||||
if (!(filter_id & filter->filter_id)) {
|
||||
is_filtered = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -729,12 +736,17 @@ void filelist_filter(FileList *filelist)
|
||||
MEM_freeN(filtered_tmp);
|
||||
}
|
||||
|
||||
void filelist_setfilter_options(FileList *filelist, const bool hide_dot, const bool hide_parent,
|
||||
void filelist_setfilter_options(FileList *filelist, const bool do_filter,
|
||||
const bool hide_dot, const bool hide_parent,
|
||||
const unsigned int filter, const unsigned int filter_id,
|
||||
const char *filter_glob, const char *filter_search)
|
||||
{
|
||||
bool update = false;
|
||||
|
||||
if (((filelist->filter_data.flags & FLF_DO_FILTER) != 0) != (do_filter != 0)) {
|
||||
filelist->filter_data.flags ^= FLF_DO_FILTER;
|
||||
update = true;
|
||||
}
|
||||
if (((filelist->filter_data.flags & FLF_HIDE_DOT) != 0) != (hide_dot != 0)) {
|
||||
filelist->filter_data.flags ^= FLF_HIDE_DOT;
|
||||
update = true;
|
||||
|
@ -68,7 +68,8 @@ int folderlist_clear_next(struct SpaceFile *sfile);
|
||||
void filelist_setsorting(struct FileList *filelist, const short sort);
|
||||
void filelist_sort(struct FileList *filelist);
|
||||
|
||||
void filelist_setfilter_options(struct FileList *filelist, const bool hide_dot, const bool hide_parent,
|
||||
void filelist_setfilter_options(struct FileList *filelist, const bool do_filter,
|
||||
const bool hide_dot, const bool hide_parent,
|
||||
const unsigned int filter, const unsigned int filter_id,
|
||||
const char *filter_glob, const char *filter_search);
|
||||
void filelist_filter(struct FileList *filelist);
|
||||
|
@ -223,9 +223,10 @@ static void file_refresh(const bContext *C, ScrArea *sa)
|
||||
filelist_setdir(sfile->files, params->dir);
|
||||
filelist_setrecursion(sfile->files, params->recursion_level);
|
||||
filelist_setsorting(sfile->files, params->sort);
|
||||
filelist_setfilter_options(sfile->files, (params->flag & FILE_HIDE_DOT) != 0,
|
||||
filelist_setfilter_options(sfile->files, (params->flag & FILE_FILTER) != 0,
|
||||
(params->flag & FILE_HIDE_DOT) != 0,
|
||||
false, /* TODO hide_parent, should be controllable? */
|
||||
(params->flag & FILE_FILTER) ? params->filter : 0,
|
||||
params->filter,
|
||||
params->filter_id,
|
||||
params->filter_glob,
|
||||
params->filter_search);
|
||||
|
Loading…
Reference in New Issue
Block a user