[Bf-blender-cvs] [0996ee3] master: Fix: Don't show filesel buttons when no operators running
Campbell Barton
noreply at git.blender.org
Mon Jan 12 16:09:01 CET 2015
Commit: 0996ee3bb81bd3b9e68b34f75590699a6908d7a0
Author: Campbell Barton
Date: Tue Jan 13 02:05:21 2015 +1100
Branches: master
https://developer.blender.org/rB0996ee3bb81bd3b9e68b34f75590699a6908d7a0
Fix: Don't show filesel buttons when no operators running
===================================================================
M source/blender/editors/space_file/file_draw.c
===================================================================
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 5d0734d..3f3c14d 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -111,6 +111,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
SpaceFile *sfile = CTX_wm_space_file(C);
FileSelectParams *params = ED_fileselect_get_params(sfile);
ARegion *artmp;
+ const bool is_browse_only = (sfile->op == NULL);
/* Initialize UI block. */
BLI_snprintf(uiblockstr, sizeof(uiblockstr), "win %p", (void *)ar);
@@ -124,15 +125,22 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
available_w -= chan_offs;
}
}
-
+
/* Is there enough space for the execute / cancel buttons? */
- loadbutton = UI_fontstyle_string_width(params->title) + btn_margin;
- CLAMP_MIN(loadbutton, btn_minw);
- if (available_w <= loadbutton + separator + input_minw || params->title[0] == 0) {
+
+ if (is_browse_only) {
loadbutton = 0;
}
else {
+ loadbutton = UI_fontstyle_string_width(params->title) + btn_margin;
+ CLAMP_MIN(loadbutton, btn_minw);
+ if (available_w <= loadbutton + separator + input_minw) {
+ loadbutton = 0;
+ }
+ }
+
+ if (loadbutton) {
line1_w -= (loadbutton + separator);
line2_w = line1_w;
}
@@ -145,7 +153,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
else {
line2_w -= (fnumbuttons + separator);
}
-
+
/* Text input fields for directory and file. */
if (available_w > 0) {
int overwrite_alert = file_draw_check_exists(sfile);
More information about the Bf-blender-cvs
mailing list