Fix related to #35681: avoid some unnecessary cycles updated when using exclude
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Sun, 9 Jun 2013 11:57:51 +0000 (11:57 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Sun, 9 Jun 2013 11:57:51 +0000 (11:57 +0000)
render layers.

intern/cycles/blender/blender_session.cpp

index e69cf6b1bbff285b99a144157e0070f53392ec3d..fdce4b16b57f20a30959caa79c1b306a21734d89 100644 (file)
@@ -101,12 +101,12 @@ void BlenderSession::create_session()
 
        /* create sync */
        sync = new BlenderSync(b_engine, b_data, b_scene, scene, !background, session->progress, session_params.device.type == DEVICE_CPU);
-       sync->sync_data(b_v3d, b_engine.camera_override());
 
-       if(b_rv3d)
+       /* for final render we will do sync per render layer */
+       if(b_v3d) {
+               sync->sync_data(b_v3d, b_engine.camera_override());
                sync->sync_view(b_v3d, b_rv3d, width, height);
-       else
-               sync->sync_camera(b_render, b_engine.camera_override(), width, height);
+       }
 
        /* set buffer parameters */
        BufferParams buffer_params = BlenderSync::get_buffer_params(b_render, b_scene, b_v3d, b_rv3d, scene->camera, width, height);
@@ -159,8 +159,11 @@ void BlenderSession::reset_session(BL::BlendData b_data_, BL::Scene b_scene_)
 
        /* sync object should be re-created */
        sync = new BlenderSync(b_engine, b_data, b_scene, scene, !background, session->progress, session_params.device.type == DEVICE_CPU);
-       sync->sync_data(b_v3d, b_engine.camera_override());
-       sync->sync_camera(b_render, b_engine.camera_override(), width, height);
+
+       if(b_rv3d) {
+               sync->sync_data(b_v3d, b_engine.camera_override());
+               sync->sync_camera(b_render, b_engine.camera_override(), width, height);
+       }
 
        BufferParams buffer_params = BlenderSync::get_buffer_params(b_render, b_scene, PointerRNA_NULL, PointerRNA_NULL, scene->camera, width, height);
        session->reset(buffer_params, session_params.samples);
@@ -368,6 +371,7 @@ void BlenderSession::render()
 
                /* update scene */
                sync->sync_data(b_v3d, b_engine.camera_override(), b_rlay_name.c_str());
+               sync->sync_camera(b_render, b_engine.camera_override(), width, height);
 
                /* update number of samples per layer */
                int samples = sync->get_layer_samples();
@@ -452,6 +456,10 @@ void BlenderSession::update_render_result(BL::RenderResult b_rr, BL::RenderLayer
 
 void BlenderSession::synchronize()
 {
+       /* only used for viewport render */
+       if(!b_v3d)
+               return;
+
        /* on session/scene parameter changes, we recreate session entirely */
        SceneParams scene_params = BlenderSync::get_scene_params(b_scene, background);
        SessionParams session_params = BlenderSync::get_session_params(b_engine, b_userpref, b_scene, background);