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/makesrna/intern | |
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/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 70c7bf0a81e..203b8459ae6 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -308,6 +308,22 @@ static const EnumPropertyItem multiview_camera_items[] = { #undef V3D_S3D_CAMERA_S3D #undef V3D_S3D_CAMERA_VIEWS +const EnumPropertyItem rna_enum_fileselect_params_sort_items[] = { + {FILE_SORT_ALPHA, "FILE_SORT_ALPHA", ICON_NONE, "Name", "Sort the file list alphabetically"}, + {FILE_SORT_EXTENSION, + "FILE_SORT_EXTENSION", + ICON_NONE, + "Extension", + "Sort the file list by extension/type"}, + {FILE_SORT_TIME, + "FILE_SORT_TIME", + ICON_NONE, + "Modified Date", + "Sort files by modification time"}, + {FILE_SORT_SIZE, "FILE_SORT_SIZE", ICON_NONE, "Size", "Sort files by size"}, + {0, NULL, 0, NULL, NULL}, +}; + #ifndef RNA_RUNTIME static const EnumPropertyItem stereo3d_eye_items[] = { {STEREO_LEFT_ID, "LEFT_EYE", ICON_NONE, "Left Eye"}, @@ -464,22 +480,6 @@ static const EnumPropertyItem fileselectparams_recursion_level_items[] = { {0, NULL, 0, NULL, NULL}, }; -const EnumPropertyItem rna_enum_file_sort_items[] = { - {FILE_SORT_ALPHA, "FILE_SORT_ALPHA", ICON_NONE, "Name", "Sort the file list alphabetically"}, - {FILE_SORT_EXTENSION, - "FILE_SORT_EXTENSION", - ICON_NONE, - "Extension", - "Sort the file list by extension/type"}, - {FILE_SORT_TIME, - "FILE_SORT_TIME", - ICON_NONE, - "Modified Date", - "Sort files by modification time"}, - {FILE_SORT_SIZE, "FILE_SORT_SIZE", ICON_NONE, "Size", "Sort files by size"}, - {0, NULL, 0, NULL, NULL}, -}; - static const EnumPropertyItem rna_enum_curve_display_handle_items[] = { {CURVE_HANDLE_NONE, "NONE", 0, "None", ""}, {CURVE_HANDLE_SELECTED, "SELECTED", 0, "Selected", ""}, @@ -5827,7 +5827,7 @@ static void rna_def_fileselect_params(BlenderRNA *brna) prop = RNA_def_property(srna, "sort_method", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "sort"); - RNA_def_property_enum_items(prop, rna_enum_file_sort_items); + RNA_def_property_enum_items(prop, rna_enum_fileselect_params_sort_items); RNA_def_property_ui_text(prop, "Sort", ""); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL); |