Fix T38726: missing rendered viewport update when removing render layer.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Wed, 26 Feb 2014 16:29:50 +0000 (17:29 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Wed, 26 Feb 2014 16:29:50 +0000 (17:29 +0100)
source/blender/render/intern/source/pipeline.c

index adb8100517dad2e8a9bbc0ccb5d008e3d6ee2be7..50fc9df0d36b92916a6eb90296dfe0520a1e4f23 100644 (file)
@@ -505,7 +505,6 @@ static int check_mode_full_sample(RenderData *rd)
 void RE_InitState(Render *re, Render *source, RenderData *rd, SceneRenderLayer *srl, int winx, int winy, rcti *disprect)
 {
        bool had_freestyle = (re->r.mode & R_EDGE_FRS) != 0;
-       int prev_actlay = re->r.actlay;
 
        re->ok = TRUE;   /* maybe flag */
        
@@ -609,8 +608,16 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, SceneRenderLayer *
                        re->result = NULL;
                }
                else if (re->result) {
+                       SceneRenderLayer *actsrl = BLI_findlink(&re->r.layers, re->r.actlay);
+                       RenderLayer *rl;
+                       bool have_layer = false;
+
+                       for (rl = re->result->layers.first; rl; rl = rl->next)
+                               if (STREQ(rl->name, actsrl->name))
+                                       have_layer = true;
+
                        if (re->result->rectx == re->rectx && re->result->recty == re->recty &&
-                           prev_actlay == re->r.actlay)
+                           have_layer)
                        {
                                /* keep render result, this avoids flickering black tiles
                                 * when the preview changes */