diff options
-rw-r--r-- | intern/cycles/blender/blender_session.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp index e69cf6b1bbf..fdce4b16b57 100644 --- a/intern/cycles/blender/blender_session.cpp +++ b/intern/cycles/blender/blender_session.cpp @@ -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); |