Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-09-17 13:27:31 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-09-17 13:27:31 +0400
commit5452f335d7fd768fda7320419e3581e5309529fe (patch)
treef80553108d8541e2d070c02fe86778494f31c188 /source/blender/editors/space_file/file_draw.c
parent945ae254092dcbb284072fd4ffcc80b33bff27f6 (diff)
New optional operator function, check(), it takes the same arguments as execute().
This runs after changing a property and allows correcting incompatible options. Returning True will redraw the UI. Currently this is used for setting the write extension when saving files, so changing the image format also corrects the extension. The same is accessible from python where its used when saving SVG/EPS/PNG files. This fixes: [#23828] obj export problems, [#23760] Exporting OBJ and filetype ending also fixed document submission operator. Now the filename in the file selector is the one used for writing this means we remove the "Save Over" popup which could be overlooked too easily. Instead display the filename field with red tint, and a note in the tooltip.
Diffstat (limited to 'source/blender/editors/space_file/file_draw.c')
-rw-r--r--source/blender/editors/space_file/file_draw.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 5f435aa0cbe..0f627bda3dc 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -172,6 +172,10 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
/* Text input fields for directory and file. */
if (available_w > 0) {
+ int overwrite_alert= file_draw_check_exists(sfile);
+ /* callbacks for operator check functions */
+ uiBlockSetFunc(block, file_draw_check_cb, NULL, NULL);
+
but = uiDefBut(block, TEX, B_FS_DIRNAME, "",
min_x, line1_y, line1_w-chan_offs, btn_h,
params->dir, 0.0, (float)FILE_MAX-1, 0, 0,
@@ -182,9 +186,17 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
but = uiDefBut(block, TEX, B_FS_FILENAME, "",
min_x, line2_y, line2_w-chan_offs, btn_h,
params->file, 0.0, (float)FILE_MAXFILE-1, 0, 0,
- "File name.");
+ overwrite_alert ?"File name, overwrite existing." : "File name.");
uiButSetCompleteFunc(but, autocomplete_file, NULL);
uiButSetFlag(but, UI_BUT_NO_UTF8);
+
+ /* check if this overrides a file and if the operator option is used */
+ if(overwrite_alert) {
+ uiButSetFlag(but, UI_BUT_REDALERT);
+ }
+
+ /* clear func */
+ uiBlockSetFunc(block, NULL, NULL, NULL);
}
/* Filename number increment / decrement buttons. */