diff options
author | Julian Eisel <julian@blender.org> | 2020-11-03 01:55:59 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-11-03 02:00:41 +0300 |
commit | c067b7460a1fb54dc6b21c3cbc2819d9398392ef (patch) | |
tree | f1c2c50728f1b222acf291fda719f438b1adbfbc /source/blender/editors/space_file/filelist.c | |
parent | a750acab78cf38ca8f010c4ac81ec948faa79dd5 (diff) |
Fix C operators can't set default display or sort type for File Browser
`WM_operator_properties_filesel()` allows C operators to set a display or sort
type for the File Browser to use. But the File Browser would always override
that because of an invalid `_is_set()` check. (The operators don't actually set
the value, they only set the property's default value.)
The only operator affected by this is "Recover Auto Save". It is supposed to
show a vertical list ordered chronologically. It used settings from the
previous File Browser usage before this patch.
Operators using the File Browser should generally use
`FILE_DEFAULTDISPLAY`/`FILE_SORT_DEFAULT` now, except if they have a reason not
to. See comments at their definition.
----
This makes it so operators that set a different display or sort type
don't change the sort or display type for the next File Browser operation.
So using "Recover Auto Save" entirely isolates display and sort type from other
operations.
Differential Revision: https://developer.blender.org/D8598
Reviewed by: Bastien Montagne
Diffstat (limited to 'source/blender/editors/space_file/filelist.c')
-rw-r--r-- | source/blender/editors/space_file/filelist.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 465f05246ca..24b8d4deca0 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -583,7 +583,7 @@ static int compare_extension(void *user_data, const void *a1, const void *a2) void filelist_sort(struct FileList *filelist) { - if ((filelist->flags & FL_NEED_SORTING) && (filelist->sort != FILE_SORT_NONE)) { + if (filelist->flags & FL_NEED_SORTING) { void *sort_cb = NULL; switch (filelist->sort) { @@ -599,7 +599,7 @@ void filelist_sort(struct FileList *filelist) case FILE_SORT_EXTENSION: sort_cb = compare_extension; break; - case FILE_SORT_NONE: /* Should never reach this point! */ + case FILE_SORT_DEFAULT: default: BLI_assert(0); break; @@ -1562,7 +1562,6 @@ void filelist_free(struct FileList *filelist) memset(&filelist->filter_data, 0, sizeof(filelist->filter_data)); filelist->flags &= ~(FL_NEED_SORTING | FL_NEED_FILTERING); - filelist->sort = FILE_SORT_NONE; } void filelist_freelib(struct FileList *filelist) |