Fix T53182: cancelling save buffers + denoising render clears image.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Thu, 2 Nov 2017 13:29:42 +0000 (14:29 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Thu, 2 Nov 2017 13:31:05 +0000 (14:31 +0100)
intern/cycles/blender/blender_session.cpp
source/blender/render/intern/include/render_types.h
source/blender/render/intern/source/external_engine.c
source/blender/render/intern/source/pipeline.c
source/blender/render/intern/source/render_result.c

index 2377c987b38826a8a4d705aa34f3672c8921dfee..73383ad5080aab39f50a1e6ea33cc662e7ac30a0 100644 (file)
@@ -340,7 +340,7 @@ void BlenderSession::do_write_update_render_tile(RenderTile& rtile, bool do_upda
                        update_render_result(b_rr, b_rlay, rtile);
                }
 
-               end_render_result(b_engine, b_rr, true, highlight, true);
+               end_render_result(b_engine, b_rr, true, highlight, false);
        }
        else {
                /* write result */
index f9942bef61f43645eb75e7ea100471e702201bbf..45206f21ae44d1aad986cb1c80ccb9a67b897205 100644 (file)
@@ -118,7 +118,8 @@ typedef struct RenderPart {
 enum {
        PART_STATUS_NONE        = 0,
        PART_STATUS_IN_PROGRESS = 1,
-       PART_STATUS_READY       = 2
+       PART_STATUS_RENDERED    = 2,
+       PART_STATUS_MERGED      = 3
 };
 
 /* controls state of render, everything that's read-only during render stage */
index 3358d7a855be8333509a0bf85e5e3959ee78ae63..b1cd23d082785a4fe0845c05040c4e004aacee79 100644 (file)
@@ -273,7 +273,7 @@ void RE_engine_end_result(RenderEngine *engine, RenderResult *result, int cancel
                RenderPart *pa = get_part_from_result(re, result);
 
                if (pa) {
-                       pa->status = PART_STATUS_READY;
+                       pa->status = (merge_results)? PART_STATUS_MERGED: PART_STATUS_RENDERED;
                }
                else if (re->result->do_exr_tile) {
                        /* if written result does not match any tile and we are using save
@@ -284,7 +284,7 @@ void RE_engine_end_result(RenderEngine *engine, RenderResult *result, int cancel
 
        if (!cancel || merge_results) {
                if (re->result->do_exr_tile) {
-                       if (!cancel) {
+                       if (!cancel && merge_results) {
                                render_result_exr_file_merge(re->result, result, re->viewname);
                        }
                }
index a0ebe24156944198d77ed761a1a22fc3fc24359a..ce2fd3a1a48503d420e2631cd2b506a5226cd516 100644 (file)
@@ -1133,7 +1133,7 @@ static void *do_part_thread(void *pa_v)
                BLI_rw_mutex_unlock(&R.resultmutex);
        }
        
-       pa->status = PART_STATUS_READY;
+       pa->status = PART_STATUS_MERGED;
        
        return NULL;
 }
@@ -1239,7 +1239,7 @@ static int sort_and_queue_parts(Render *re, int minx, ThreadQueue *workqueue)
        
        /* find center of rendered parts, image center counts for 1 too */
        for (pa = re->parts.first; pa; pa = pa->next) {
-               if (pa->status == PART_STATUS_READY) {
+               if (pa->status >= PART_STATUS_RENDERED) {
                        centx += BLI_rcti_cent_x(&pa->disprect);
                        centy += BLI_rcti_cent_y(&pa->disprect);
                        tot++;
index df51cd3c2e60c538922dcd8060eb2697f9328ef2..aa0c7357302635c93df3b381d8a6819994423737 100644 (file)
@@ -1063,7 +1063,7 @@ void render_result_save_empty_result_tiles(Render *re)
                        IMB_exr_clear_channels(rl->exrhandle);
                
                        for (pa = re->parts.first; pa; pa = pa->next) {
-                               if (pa->status != PART_STATUS_READY) {
+                               if (pa->status != PART_STATUS_MERGED) {
                                        int party = pa->disprect.ymin - re->disprect.ymin + pa->crop;
                                        int partx = pa->disprect.xmin - re->disprect.xmin + pa->crop;
                                        IMB_exrtile_write_channels(rl->exrhandle, partx, party, 0, re->viewname);