diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-09-24 11:05:43 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-09-24 11:05:43 +0400 |
commit | 6a4b9298c80d0f27637f88cca0ad9f05040608d3 (patch) | |
tree | b53d155d0339d16b743ae1ed483786ab79393788 /source/blender/editors/space_file/filelist.c | |
parent | 99643037caef3539fdac807b22431bd6cc5deba7 (diff) |
patch [#23968] filter_filetypes property to allow operators to filter by file extensions in the file selector
modified the patch to store the string internally rather then an array of allocated string pointers, less hassle with memory allocation.
changed to use fnmatch, so *.foo is needed (not .foo as with the patch)
Diffstat (limited to 'source/blender/editors/space_file/filelist.c')
-rw-r--r-- | source/blender/editors/space_file/filelist.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index c3bea2a5bea..eba0df9f963 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -108,6 +108,7 @@ typedef struct FileList short prv_h; short hide_dot; unsigned int filter; + char filter_glob[64]; short changed; struct BlendHandle *libfiledata; @@ -547,6 +548,7 @@ void filelist_free(struct FileList* filelist) free(filelist->filelist); filelist->filelist = 0; filelist->filter = 0; + filelist->filter_glob[0] = '\0'; filelist->numfiltered =0; filelist->hide_dot =0; } @@ -713,6 +715,11 @@ void filelist_setfilter(struct FileList* filelist, unsigned int filter) filelist->filter = filter; } +void filelist_setfilter_types(struct FileList* filelist, const char *filter_glob) +{ + BLI_strncpy(filelist->filter_glob, filter_glob, sizeof(filelist->filter_glob)); +} + static void filelist_read_dir(struct FileList* filelist) { char wdir[FILE_MAX]; @@ -824,6 +831,9 @@ void filelist_setfiletypes(struct FileList* filelist, short has_quicktime) file->flags |= MOVIEFILE; } else if(BLI_testextensie_array(file->relname, imb_ext_audio)) { file->flags |= SOUNDFILE; + } else if(filelist->filter_glob + && BLI_testextensie_glob(file->relname, filelist->filter_glob)) { + file->flags |= OPERATORFILE; } } } |