Fix part of #25040: rendering multiple scenes from compositing nodes didn't
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Sun, 5 Dec 2010 10:14:34 +0000 (10:14 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Sun, 5 Dec 2010 10:14:34 +0000 (10:14 +0000)
restore current scene properly afterwards.

source/blender/render/intern/source/pipeline.c

index 9c333b2d8c277778bcf27c69b8ba2b60e09985e0..15fa70ef823fceb13a293a954e79df8e72b3a06b 100644 (file)
@@ -2205,6 +2205,7 @@ static void ntree_render_scenes(Render *re)
 {
        bNode *node;
        int cfra= re->scene->r.cfra;
+       int restore_scene= 0;
        
        if(re->scene->nodetree==NULL) return;
        
@@ -2216,12 +2217,19 @@ static void ntree_render_scenes(Render *re)
                if(node->type==CMP_NODE_R_LAYERS) {
                        if(node->id && node->id != (ID *)re->scene) {
                                if(node->id->flag & LIB_DOIT) {
-                                       render_scene(re, (Scene *)node->id, cfra);
+                                       Scene *scene = (Scene*)node->id;
+
+                                       render_scene(re, scene, cfra);
+                                       restore_scene= (scene != re->scene);
                                        node->id->flag &= ~LIB_DOIT;
                                }
                        }
                }
        }
+
+       /* restore scene if we rendered another last */
+       if(restore_scene)
+               set_scene_bg(re->main, re->scene);
 }
 
 /* helper call to detect if theres a composite with render-result node */