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/makesdna/DNA_space_types.h | |
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/makesdna/DNA_space_types.h')
-rw-r--r-- | source/blender/makesdna/DNA_space_types.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 8eb52bb776b..95cc0317a46 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -760,7 +760,13 @@ typedef struct SpaceFile { /* FileSelectParams.display */ enum eFileDisplayType { + /** Internal (not exposed to users): Keep whatever display type was used during the last File + * Browser use, or the default if no such record is found. Use this unless there's a good reason + * to set a specific display type. */ FILE_DEFAULTDISPLAY = 0, + + /* User selectable choices. */ + FILE_VERTICALDISPLAY = 1, FILE_HORIZONTALDISPLAY = 2, FILE_IMGDISPLAY = 3, @@ -768,7 +774,13 @@ enum eFileDisplayType { /* FileSelectParams.sort */ enum eFileSortType { - FILE_SORT_NONE = 0, + /** Internal (not exposed to users): Sort by whatever was sorted by during the last File Browser + * use, or the default if no such record is found. Use this unless there's a good reason to set a + * specific sort order. */ + FILE_SORT_DEFAULT = 0, + + /* User selectable choices. */ + FILE_SORT_ALPHA = 1, FILE_SORT_EXTENSION = 2, FILE_SORT_TIME = 3, |