diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-09-28 05:16:26 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-09-28 05:16:26 +0400 |
commit | 1418f69df3ff719be7e9d814149f18dddb56f8d3 (patch) | |
tree | a0883e8f629f3667605f09cceb0cec2d322ea5e9 /source/blender | |
parent | 46d82a2a1246c3a2497e591f604e4fc62c7b519d (diff) |
fix/workaround [#32679] Save a Copy during F12 Cycles Render produces black image
image-save now poll's for rendering while saving an image, this can't easily work in a reliable way (buffers are being written to), so disable and set the poll fail message so the tooltip explains why this tools disabled.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index cfb265433a9..e617daf6cf7 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1424,6 +1424,24 @@ static void image_save_as_draw(bContext *UNUSED(C), wmOperator *op) uiDefAutoButsRNA(layout, &ptr, image_save_as_draw_check_prop, '\0'); } +static int image_save_as_poll(bContext *C) +{ + if (space_image_buffer_exists_poll(C)) { + if (G.is_rendering) { + /* no need to NULL check here */ + SpaceImage *sima = CTX_wm_space_image(C); + Image *ima = ED_space_image(sima); + + if ((ima->source == IMA_SRC_VIEWER)) { + CTX_wm_operator_poll_msg_set(C, "can't save image while rendering"); + return FALSE; + } + } + return TRUE; + } + return FALSE; +} + void IMAGE_OT_save_as(wmOperatorType *ot) { // PropertyRNA *prop; @@ -1439,7 +1457,7 @@ void IMAGE_OT_save_as(wmOperatorType *ot) ot->invoke = image_save_as_invoke; ot->cancel = image_save_as_cancel; ot->ui = image_save_as_draw; - ot->poll = space_image_buffer_exists_poll; + ot->poll = image_save_as_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; |