This commit makes it possible to select the sort mode whenever we invoke an operator.
authorThomas Beck <software@plasmasolutions.de>
Sun, 23 Aug 2015 10:40:21 +0000 (12:40 +0200)
committerThomas Beck <software@plasmasolutions.de>
Sun, 23 Aug 2015 10:40:21 +0000 (12:40 +0200)
It's needed especially for the menu entry "recover auto save" where you'd like to have the files sorted by date most of the time but it could be useful in other places too.
There should be no functional change in other areas, I just added the missing parameter (FILE_SORT_ALPHA).

Was a request from @sebastian_k at #BCon13, so at least one guy needs it ;)

Reviewers: mont29

Reviewed By: mont29

Subscribers: sebastian_k

Differential Revision: https://developer.blender.org/D1476

22 files changed:
source/blender/editors/curve/editfont.c
source/blender/editors/io/io_collada.c
source/blender/editors/object/object_modifier.c
source/blender/editors/physics/rigidbody_world.c
source/blender/editors/render/render_shading.c
source/blender/editors/screen/screendump.c
source/blender/editors/sound/sound_ops.c
source/blender/editors/space_buttons/buttons_ops.c
source/blender/editors/space_clip/clip_ops.c
source/blender/editors/space_file/filesel.c
source/blender/editors/space_graph/graph_edit.c
source/blender/editors/space_image/image_ops.c
source/blender/editors/space_info/info_ops.c
source/blender/editors/space_node/node_add.c
source/blender/editors/space_sequencer/sequencer_add.c
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/editors/space_text/text_ops.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/makesrna/RNA_enum_types.h
source/blender/makesrna/intern/rna_space.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm_operators.c

index dd807828d9d781520d19c823a54bafd8a72a5fbe..ea6b6154be8ec0cf365d64b0137d4fc1828a78b4 100644 (file)
@@ -450,7 +450,7 @@ void FONT_OT_text_paste_from_file(wmOperatorType *ot)
 
        /* properties */
        WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_TEXT, FILE_SPECIAL, FILE_OPENFILE,
-                                      WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
 }
 
 
@@ -508,7 +508,7 @@ void FONT_OT_text_paste_from_clipboard(wmOperatorType *ot)
 
        /* properties */
        WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_TEXT, FILE_SPECIAL, FILE_OPENFILE,
-                                      WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
 }
 
 /******************* text to object operator ********************/
@@ -1785,7 +1785,7 @@ void FONT_OT_open(wmOperatorType *ot)
        
        /* properties */
        WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_FTFONT, FILE_SPECIAL, FILE_OPENFILE,
-                                      WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
 }
 
 /******************* delete operator *********************/
index 63147b542e719f71054b92962f96e8a808269bf1..021b040fdd5f18e9a66dd80c886ab6abf5719431 100644 (file)
@@ -299,7 +299,7 @@ void WM_OT_collada_export(wmOperatorType *ot)
        ot->ui = wm_collada_export_draw;
 
        WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_COLLADA, FILE_BLENDER, FILE_SAVE,
-                                      WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
 
        RNA_def_boolean(ot->srna,
                        "apply_modifiers", 0, "Apply Modifiers",
@@ -445,7 +445,7 @@ void WM_OT_collada_import(wmOperatorType *ot)
        ot->ui = wm_collada_import_draw;
 
        WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_COLLADA, FILE_BLENDER, FILE_OPENFILE,
-                                      WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
 
        RNA_def_boolean(ot->srna,
                "import_units", 0, "Import Units",
index ce9693793a4652b96981e01bb92f33beefe14255..8ef2bd1b2af9089fefc808303df03984f539f4fc 100644 (file)
@@ -1356,7 +1356,7 @@ void OBJECT_OT_multires_external_save(wmOperatorType *ot)
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
 
        WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_BTX, FILE_SPECIAL, FILE_SAVE,
-                                      WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
        edit_modifier_properties(ot);
 }
 
index f7a2c83bc49f80d41dec3cb40f9c542ec0b57a8f..0bd9ec5f4cd0d2b44f4a9104d1d459ca86891932 100644 (file)
@@ -195,5 +195,5 @@ void RIGIDBODY_OT_world_export(wmOperatorType *ot)
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
        /* properties */
-       WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER, FILE_SPECIAL, FILE_SAVE, FILE_RELPATH, FILE_DEFAULTDISPLAY);
+       WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER, FILE_SPECIAL, FILE_SAVE, FILE_RELPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
 }
index 5ccf7fc71a80cd42054ac2ae6c1842aac517c20b..563f134a85a17929e37fb31448c21d621a1896bd 100644 (file)
@@ -1620,7 +1620,7 @@ void TEXTURE_OT_envmap_save(wmOperatorType *ot)
        RNA_def_property_flag(prop, PROP_HIDDEN);
 
        WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_IMAGE | FILE_TYPE_MOVIE, FILE_SPECIAL, FILE_SAVE,
-                                      WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
 }
 
 static int envmap_clear_exec(bContext *C, wmOperator *UNUSED(op))
index 3f66d84c18557691faa8b2ef78a7a294fa5d7326..e23ac1710e3a3db4eb5e42506afbad1572566eed 100644 (file)
@@ -287,7 +287,7 @@ void SCREEN_OT_screenshot(wmOperatorType *ot)
        ot->flag = 0;
        
        WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_IMAGE, FILE_SPECIAL, FILE_SAVE,
-                                      WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
        RNA_def_boolean(ot->srna, "full", 1, "Full Screen",
                        "Capture the whole window (otherwise only capture the active area)");
 }
index c081539df411f506300bdc38e262b43b6f80e9cf..f8d84cc0276c1ac4fd9800642202b951fa509db2 100644 (file)
@@ -186,7 +186,7 @@ static void SOUND_OT_open(wmOperatorType *ot)
 
        /* properties */
        WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_SOUND | FILE_TYPE_MOVIE, FILE_SPECIAL, FILE_OPENFILE,
-                                      WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
        RNA_def_boolean(ot->srna, "cache", false, "Cache", "Cache the sound in memory");
        RNA_def_boolean(ot->srna, "mono", false, "Mono", "Mixdown the sound to mono");
 }
@@ -208,7 +208,7 @@ static void SOUND_OT_open_mono(wmOperatorType *ot)
 
        /* properties */
        WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_SOUND | FILE_TYPE_MOVIE, FILE_SPECIAL, FILE_OPENFILE,
-                                      WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
        RNA_def_boolean(ot->srna, "cache", false, "Cache", "Cache the sound in memory");
        RNA_def_boolean(ot->srna, "mono", true, "Mono", "Mixdown the sound to mono");
 }
@@ -653,7 +653,7 @@ static void SOUND_OT_mixdown(wmOperatorType *ot)
 
        /* properties */
        WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_SOUND, FILE_SPECIAL, FILE_SAVE,
-                                      WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
 #ifdef WITH_AUDASPACE
        RNA_def_int(ot->srna, "accuracy", 1024, 1, 16777216, "Accuracy", "Sample accuracy, important for animation data (the lower the value, the more accurate)", 1, 16777216);
        RNA_def_enum(ot->srna, "container", container_items, AUD_CONTAINER_FLAC, "Container", "File format");
index 3af1d0689808d464c0e778c0523bcb938c4b1819..b8b56f8f8483d804e6978a94d740189a8645517f 100644 (file)
@@ -253,7 +253,7 @@ void BUTTONS_OT_file_browse(wmOperatorType *ot)
 
        /* properties */
        WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE,
-                                      WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
 }
 
 /* second operator, only difference from BUTTONS_OT_file_browse is WM_FILESEL_DIRECTORY */
@@ -274,5 +274,5 @@ void BUTTONS_OT_directory_browse(wmOperatorType *ot)
 
        /* properties */
        WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE,
-                                      WM_FILESEL_DIRECTORY | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_DIRECTORY | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
 }
index 460bad13b8e8bc07d928d65aafb392cd3209fe23..55805e0b9076ea7baa4409f76b9a86607da58423 100644 (file)
@@ -300,7 +300,7 @@ void CLIP_OT_open(wmOperatorType *ot)
 
        /* properties */
        WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_IMAGE | FILE_TYPE_MOVIE, FILE_SPECIAL, FILE_OPENFILE,
-                                      WM_FILESEL_RELPATH | WM_FILESEL_FILES | WM_FILESEL_DIRECTORY, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_RELPATH | WM_FILESEL_FILES | WM_FILESEL_DIRECTORY, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
 }
 
 /******************* reload clip operator *********************/
index c71f7dbc207de9c00b26de5e756ad88e3a1e420a..da24f1ce95d889567da6d224d026d0e900450e73 100644 (file)
@@ -227,6 +227,13 @@ short ED_fileselect_set_params(SpaceFile *sfile)
                        params->display = RNA_property_enum_get(op->ptr, prop);
                }
 
+               if ((prop = RNA_struct_find_property(op->ptr, "sort_method"))) {
+                       params->sort = RNA_property_enum_get(op->ptr, prop);
+               }
+               else {
+                       params->sort = FILE_SORT_ALPHA;
+               }
+
                if (params->display == FILE_DEFAULTDISPLAY) {
                        if (U.uiflag & USER_SHOW_THUMBNAILS) {
                                if (params->filter & (FILE_TYPE_IMAGE | FILE_TYPE_MOVIE))
@@ -258,7 +265,6 @@ short ED_fileselect_set_params(SpaceFile *sfile)
        }
 
        /* operator has no setting for this */
-       params->sort = FILE_SORT_ALPHA;
        params->active_file = -1;
 
 
index 02001491f31605d8f9b0a3f31c3bb1ed8a044dcc..ca5d2db80e71de7aabc48f3effdca214180542ef 100644 (file)
@@ -1276,7 +1276,7 @@ void GRAPH_OT_sound_bake(wmOperatorType *ot)
 
        /* properties */
        WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_SOUND | FILE_TYPE_MOVIE, FILE_SPECIAL, FILE_OPENFILE,
-                                      WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
        RNA_def_float(ot->srna, "low", 0.0f, 0.0, 100000.0, "Lowest frequency",
                      "Cutoff frequency of a high-pass filter that is applied to the audio data", 0.1, 1000.00);
        RNA_def_float(ot->srna, "high", 100000.0, 0.0, 100000.0, "Highest frequency",
index e94dd1d4864ec55937329387bad7a91a26b41eda..db0fc2d34b6d7f52ff78b9573d9cbaa52ccc360a 100644 (file)
@@ -1307,7 +1307,7 @@ void IMAGE_OT_open(wmOperatorType *ot)
 
        /* properties */
        WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_IMAGE | FILE_TYPE_MOVIE, FILE_SPECIAL, FILE_OPENFILE,
-                                      WM_FILESEL_FILEPATH | WM_FILESEL_DIRECTORY | WM_FILESEL_FILES | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_FILEPATH | WM_FILESEL_DIRECTORY | WM_FILESEL_FILES | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
 }
 
 /******************** Match movie length operator ********************/
@@ -1426,7 +1426,7 @@ void IMAGE_OT_replace(wmOperatorType *ot)
 
        /* properties */
        WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_IMAGE | FILE_TYPE_MOVIE, FILE_SPECIAL, FILE_OPENFILE,
-                                      WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
 }
 
 /******************** save image as operator ********************/
@@ -2035,7 +2035,7 @@ void IMAGE_OT_save_as(wmOperatorType *ot)
        RNA_def_boolean(ot->srna, "copy", 0, "Copy", "Create a new image file without modifying the current image in blender");
 
        WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_IMAGE | FILE_TYPE_MOVIE, FILE_SPECIAL, FILE_SAVE,
-                                      WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
 }
 
 /******************** save image operator ********************/
index 8afb0cd34ea6a1500d6b13ed9c9b18ad831cf9b6..2bcd56a3ced61c63ebcdc4dd5ac62cd7ae59b4e8 100644 (file)
@@ -485,7 +485,7 @@ void FILE_OT_find_missing_files(wmOperatorType *ot)
        RNA_def_boolean(ot->srna, "find_all", false, "Find All", "Find all files in the search path (not just missing)");
 
        WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE,
-                                      WM_FILESEL_DIRECTORY, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_DIRECTORY, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
 }
 
 /********************* report box operator *********************/
index 9790e308424e0955a633a61082a5811c5a7da345..ab7fa51856acb96829832ee14aaefb90776d5e01 100644 (file)
@@ -380,7 +380,7 @@ void NODE_OT_add_file(wmOperatorType *ot)
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_IMAGE | FILE_TYPE_MOVIE, FILE_SPECIAL, FILE_OPENFILE,
-                                      WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
        RNA_def_string(ot->srna, "name", "Image", MAX_ID_NAME - 2, "Name", "Datablock name to assign");
 }
 
index 2039358b772cabecc095f9df608e8a16030e98ad..ce03c24e2ab94d66fe7aa7b65cef850c68da4d66 100644 (file)
@@ -698,7 +698,7 @@ void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot)
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
        
        WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_MOVIE, FILE_SPECIAL, FILE_OPENFILE,
-                                      WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH | WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH | WM_FILESEL_FILES, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
        sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
        RNA_def_boolean(ot->srna, "sound", true, "Sound", "Load sound with the movie");
 }
@@ -747,7 +747,7 @@ void SEQUENCER_OT_sound_strip_add(struct wmOperatorType *ot)
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
        
        WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_SOUND, FILE_SPECIAL, FILE_OPENFILE,
-                                      WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH | WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH | WM_FILESEL_FILES, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
        sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
        RNA_def_boolean(ot->srna, "cache", false, "Cache", "Cache the sound in memory");
 }
@@ -933,7 +933,7 @@ void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot)
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
        
        WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_IMAGE, FILE_SPECIAL, FILE_OPENFILE,
-                                      WM_FILESEL_DIRECTORY | WM_FILESEL_RELPATH | WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_DIRECTORY | WM_FILESEL_RELPATH | WM_FILESEL_FILES, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
        sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME | SEQPROP_ENDFRAME);
 
        RNA_def_boolean(ot->srna, "use_placeholders", false, "Use Placeholders", "Use placeholders for missing frames of the strip");
@@ -1083,7 +1083,7 @@ void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot)
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
        
        WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE,
-                                      WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
        sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME | SEQPROP_ENDFRAME);
        RNA_def_enum(ot->srna, "type", sequencer_prop_effect_types, SEQ_TYPE_CROSS, "Type", "Sequencer effect type");
        RNA_def_float_vector(ot->srna, "color", 3, NULL, 0.0f, 1.0f, "Color",
index 3eec7944c6713560fe866952fec44175fd9a6584..3cc0276104eefa4cf26a725cb8320d9858d20302 100644 (file)
@@ -3832,7 +3832,7 @@ void SEQUENCER_OT_change_path(struct wmOperatorType *ot)
 
        WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_IMAGE | FILE_TYPE_MOVIE, FILE_SPECIAL, FILE_OPENFILE,
                                       WM_FILESEL_DIRECTORY | WM_FILESEL_RELPATH | WM_FILESEL_FILEPATH | WM_FILESEL_FILES,
-                                      FILE_DEFAULTDISPLAY);
+                                      FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
        RNA_def_boolean(ot->srna, "use_placeholders", false, "Use Placeholders", "Use placeholders for missing frames of the strip");
 }
 
@@ -3942,5 +3942,5 @@ void SEQUENCER_OT_export_subtitles(struct wmOperatorType *ot)
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        WM_operator_properties_filesel(ot,  FILE_TYPE_FOLDER, FILE_BLENDER, FILE_SAVE,
-                                      WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
 }
index 2d4805488981792957b1227e356e61501b5a2180..a2fae2d5667bd255bc9e7d2b1ecfda4bb4e51b08 100644 (file)
@@ -301,7 +301,7 @@ void TEXT_OT_open(wmOperatorType *ot)
        
        /* properties */
        WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_TEXT | FILE_TYPE_PYSCRIPT, FILE_SPECIAL, FILE_OPENFILE,
-                                      WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);  //XXX TODO, relative_path
+                                      WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);  //XXX TODO, relative_path
        RNA_def_boolean(ot->srna, "internal", 0, "Make internal", "Make text file internal after loading");
 }
 
@@ -578,7 +578,7 @@ void TEXT_OT_save_as(wmOperatorType *ot)
 
        /* properties */
        WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_TEXT | FILE_TYPE_PYSCRIPT, FILE_SPECIAL, FILE_SAVE,
-                                      WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);  //XXX TODO, relative_path
+                                      WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);  //XXX TODO, relative_path
 }
 
 /******************* run script operator *********************/
index b330831ba9e20e52094746f87a6b64e6ce070849..e5b39f190e35230bdf338abdec9babb97b60ac2a 100644 (file)
@@ -4475,7 +4475,7 @@ void VIEW3D_OT_background_image_add(wmOperatorType *ot)
        /* properties */
        RNA_def_string(ot->srna, "name", "Image", MAX_ID_NAME - 2, "Name", "Image name to assign");
        WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_IMAGE | FILE_TYPE_MOVIE, FILE_SPECIAL, FILE_OPENFILE,
-                                      WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
 }
 
 
index 061133a9fcf714c84acc02a97e3c15ee22270d14..b1a631cc610996ab36f7daeafd3438fa562a4200 100644 (file)
@@ -154,6 +154,8 @@ extern EnumPropertyItem viewport_shade_items[];
 
 extern EnumPropertyItem navigation_mode_items[];
 
+extern EnumPropertyItem file_sort_items[];
+
 int rna_node_tree_type_to_enum(struct bNodeTreeType *typeinfo);
 int rna_node_tree_idname_to_enum(const char *idname);
 struct bNodeTreeType *rna_node_tree_type_from_enum(int value);
index d7af1f6e5ac3044c832a0d06a22a1d0f3e712059..cc92f7cd6a95da8cf4b41b5548053fbc04d278c7 100644 (file)
@@ -229,6 +229,14 @@ static EnumPropertyItem fileselectparams_recursion_level_items[] = {
        {0, NULL, 0, NULL, NULL}
 };
 
+EnumPropertyItem file_sort_items[] = {
+       {FILE_SORT_ALPHA, "FILE_SORT_ALPHA", ICON_SORTALPHA, "Sort alphabetically", "Sort the file list alphabetically"},
+       {FILE_SORT_EXTENSION, "FILE_SORT_EXTENSION", ICON_SORTBYEXT, "Sort by extension", "Sort the file list by extension/type"},
+       {FILE_SORT_TIME, "FILE_SORT_TIME", ICON_SORTTIME, "Sort by time", "Sort files by modification time"},
+       {FILE_SORT_SIZE, "FILE_SORT_SIZE", ICON_SORTSIZE, "Sort by size", "Sort files by size"},
+       {0, NULL, 0, NULL, NULL}
+};
+
 #ifdef RNA_RUNTIME
 
 #include "DNA_anim_types.h"
@@ -3733,16 +3741,6 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
                {0, NULL, 0, NULL, NULL}
        };
 
-       static EnumPropertyItem file_sort_items[] = {
-               {FILE_SORT_ALPHA, "FILE_SORT_ALPHA", ICON_SORTALPHA, "Sort alphabetically",
-                                 "Sort the file list alphabetically"},
-               {FILE_SORT_EXTENSION, "FILE_SORT_EXTENSION", ICON_SORTBYEXT, "Sort by extension",
-                                     "Sort the file list by extension"},
-               {FILE_SORT_TIME, "FILE_SORT_TIME", ICON_SORTTIME, "Sort by time", "Sort files by modification time"},
-               {FILE_SORT_SIZE, "FILE_SORT_SIZE", ICON_SORTSIZE, "Sort by size", "Sort files by size"},
-               {0, NULL, 0, NULL, NULL}
-       };
-
        static EnumPropertyItem thumbnail_size_items[] = {
            {32,    "TINY",     0,      "Tiny", ""},
            {64,    "SMALL",    0,      "Small", ""},
index 745f211a0da583a494b95b72d3788178c2b17471..a4c4dbfa67f604fd872747b991179106563e0ca7 100644 (file)
@@ -278,7 +278,7 @@ void                WM_operator_properties_create(struct PointerRNA *ptr, const char *opstring
 void           WM_operator_properties_create_ptr(struct PointerRNA *ptr, struct wmOperatorType *ot);
 void        WM_operator_properties_clear(struct PointerRNA *ptr);
 void           WM_operator_properties_free(struct PointerRNA *ptr);
-void           WM_operator_properties_filesel(struct wmOperatorType *ot, int filter, short type, short action, short flag, short display);
+void           WM_operator_properties_filesel(struct wmOperatorType *ot, int filter, short type, short action, short flag, short display, short sort);
 void        WM_operator_properties_border(struct wmOperatorType *ot);
 void        WM_operator_properties_border_to_rcti(struct wmOperator *op, struct rcti *rect);
 void        WM_operator_properties_border_to_rctf(struct wmOperator *op, rctf *rect);
index 516164b540a87f9baea7c8448455a43d5e3b87d8..3115b4f7512280c1d954c87a203b7906e08c3ca8 100644 (file)
@@ -1207,7 +1207,7 @@ bool WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const struct ImageFor
 }
 
 /* default properties for fileselect */
-void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type, short action, short flag, short display)
+void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type, short action, short flag, short display, short sort)
 {
        PropertyRNA *prop;
 
@@ -1219,7 +1219,6 @@ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type,
                {0, NULL, 0, NULL, NULL}
        };
 
-
        if (flag & WM_FILESEL_FILEPATH)
                RNA_def_string_file_path(ot->srna, "filepath", NULL, FILE_MAX, "File Path", "Path to file");
 
@@ -1282,6 +1281,10 @@ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type,
 
        prop = RNA_def_enum(ot->srna, "display_type", file_display_items, display, "Display Type", "");
        RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+
+       prop = RNA_def_enum(ot->srna, "sort_method", file_sort_items, sort, "File sorting mode", "");
+       RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+
 }
 
 static void wm_operator_properties_select_action_ex(wmOperatorType *ot, int default_action,
@@ -2494,7 +2497,7 @@ static void WM_OT_open_mainfile(wmOperatorType *ot)
        /* omit window poll so this can work in background mode */
 
        WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_BLENDER, FILE_BLENDER, FILE_OPENFILE,
-                                      WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
 
        RNA_def_boolean(ot->srna, "load_ui", true, "Load UI", "Load user interface setup in the .blend file");
        RNA_def_boolean(ot->srna, "use_scripts", true, "Trusted Source",
@@ -2829,7 +2832,7 @@ static void WM_OT_link(wmOperatorType *ot)
        WM_operator_properties_filesel(
                ot, FILE_TYPE_FOLDER | FILE_TYPE_BLENDER | FILE_TYPE_BLENDERLIB, FILE_LOADLIB, FILE_OPENFILE,
                WM_FILESEL_FILEPATH | WM_FILESEL_DIRECTORY | WM_FILESEL_FILENAME | WM_FILESEL_RELPATH | WM_FILESEL_FILES,
-               FILE_DEFAULTDISPLAY);
+               FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
        
        wm_link_append_properties_common(ot, true);
 }
@@ -2849,7 +2852,7 @@ static void WM_OT_append(wmOperatorType *ot)
        WM_operator_properties_filesel(
                ot, FILE_TYPE_FOLDER | FILE_TYPE_BLENDER | FILE_TYPE_BLENDERLIB, FILE_LOADLIB, FILE_OPENFILE,
                WM_FILESEL_FILEPATH | WM_FILESEL_DIRECTORY | WM_FILESEL_FILENAME | WM_FILESEL_FILES,
-               FILE_DEFAULTDISPLAY);
+               FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
 
        wm_link_append_properties_common(ot, false);
 }
@@ -2940,7 +2943,7 @@ static void WM_OT_recover_auto_save(wmOperatorType *ot)
        ot->invoke = wm_recover_auto_save_invoke;
 
        WM_operator_properties_filesel(ot, FILE_TYPE_BLENDER, FILE_BLENDER, FILE_OPENFILE,
-                                      WM_FILESEL_FILEPATH, FILE_LONGDISPLAY);
+                                      WM_FILESEL_FILEPATH, FILE_LONGDISPLAY, FILE_SORT_TIME);
 }
 
 /* *************** save file as **************** */
@@ -3073,7 +3076,7 @@ static void WM_OT_save_as_mainfile(wmOperatorType *ot)
        /* omit window poll so this can work in background mode */
 
        WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_BLENDER, FILE_BLENDER, FILE_SAVE,
-                                      WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
        RNA_def_boolean(ot->srna, "compress", false, "Compress", "Write compressed .blend file");
        RNA_def_boolean(ot->srna, "relative_remap", true, "Remap Relative",
                        "Remap relative paths when saving in a different directory");
@@ -3140,7 +3143,7 @@ static void WM_OT_save_mainfile(wmOperatorType *ot)
        /* omit window poll so this can work in background mode */
        
        WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_BLENDER, FILE_BLENDER, FILE_SAVE,
-                                      WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
+                                      WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
        RNA_def_boolean(ot->srna, "compress", false, "Compress", "Write compressed .blend file");
        RNA_def_boolean(ot->srna, "relative_remap", false, "Remap Relative",
                        "Remap relative paths when saving in a different directory");