diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2019-09-16 19:14:23 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2019-09-16 19:25:31 +0300 |
commit | 8d6b0eda5db45b63de8fccea1e3af41bf0bf09e0 (patch) | |
tree | 2f49c918125a63460b3878346425efcd44b799c4 /source/blender/editors/space_file | |
parent | 3618b2c3599d172cad3e0ee3fa7bd0eb886771a2 (diff) |
UI: Show in-/decrement buttons for exporters
As per Brecht's suggestion, use the check_existing property to control
visibility of the '+' and '-' icons. It is typically set for save
operations.
Adds another FileSelectParams flag (to avoid duplicated propertie
lookups) and removes the recently introduced
FileSelectParams.action_type again.
Fixes T69881.
Diffstat (limited to 'source/blender/editors/space_file')
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 15 | ||||
-rw-r--r-- | source/blender/editors/space_file/file_panels.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_file/filesel.c | 7 |
3 files changed, 10 insertions, 14 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 127196cca74..b741a255383 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -1506,14 +1506,11 @@ void file_draw_check_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)) bool file_draw_check_exists(SpaceFile *sfile) { if (sfile->op) { /* fails on reload */ - PropertyRNA *prop; - if ((prop = RNA_struct_find_property(sfile->op->ptr, "check_existing"))) { - if (RNA_property_boolean_get(sfile->op->ptr, prop)) { - char filepath[FILE_MAX]; - BLI_join_dirfile(filepath, sizeof(filepath), sfile->params->dir, sfile->params->file); - if (BLI_is_file(filepath)) { - return true; - } + if (sfile->params && (sfile->params->flag & FILE_CHECK_EXISTING)) { + char filepath[FILE_MAX]; + BLI_join_dirfile(filepath, sizeof(filepath), sfile->params->dir, sfile->params->file); + if (BLI_is_file(filepath)) { + return true; } } } @@ -2398,7 +2395,7 @@ static bool file_filenum_poll(bContext *C) return false; } - return sfile->params && (sfile->params->action_type == FILE_SAVE); + return sfile->params && (sfile->params->flag & FILE_CHECK_EXISTING); } /** diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c index b0fed1fafd4..8b83b5e1b05 100644 --- a/source/blender/editors/space_file/file_panels.c +++ b/source/blender/editors/space_file/file_panels.c @@ -176,7 +176,7 @@ static void file_panel_execution_buttons_draw(const bContext *C, Panel *pa) * immediate ui_apply_but_func but only after button deactivates */ UI_but_funcN_set(but, file_filename_enter_handle, NULL, but); - if (params->action_type == FILE_SAVE) { + if (params->flag & FILE_CHECK_EXISTING) { but_extra_rna_ptr = UI_but_extra_operator_icon_add( but, "FILE_OT_filenum", WM_OP_EXEC_REGION_WIN, ICON_ADD); RNA_int_set(but_extra_rna_ptr, "increment", 1); diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index e54f13e9356..6e576006332 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -167,6 +167,9 @@ short ED_fileselect_set_params(SpaceFile *sfile) params->flag &= ~FILE_DIRSEL_ONLY; } + if ((prop = RNA_struct_find_property(op->ptr, "check_existing"))) { + params->flag |= RNA_property_boolean_get(op->ptr, prop) ? FILE_CHECK_EXISTING : 0; + } if ((prop = RNA_struct_find_property(op->ptr, "hide_props_region"))) { params->flag |= RNA_property_boolean_get(op->ptr, prop) ? FILE_HIDE_TOOL_PROPS : 0; } @@ -274,10 +277,6 @@ short ED_fileselect_set_params(SpaceFile *sfile) params->sort = FILE_SORT_ALPHA; } - if ((prop = RNA_struct_find_property(op->ptr, "action_type"))) { - params->action_type = RNA_property_enum_get(op->ptr, prop); - } - if (params->display == FILE_DEFAULTDISPLAY) { if (params->display_previous == FILE_DEFAULTDISPLAY) { if (U.uiflag & USER_SHOW_THUMBNAILS) { |