diff options
author | Patrick Mours <pmours@nvidia.com> | 2019-08-26 18:09:26 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-08-26 18:12:45 +0300 |
commit | 8f8e6a7c7b6f0d2697509b874c8f01d4a4a90c3e (patch) | |
tree | 2710799b3713447df7913b6144633d29bea5ba68 /intern/cycles/blender | |
parent | 2b55f621fe20389b73e8f913e8d867e31bfaacff (diff) |
Fix Cycles session being (re)created twice
In most cases this only makes a small startup time difference, but there is
no reason to do this.
Ref D5363
Diffstat (limited to 'intern/cycles/blender')
-rw-r--r-- | intern/cycles/blender/blender_session.cpp | 19 | ||||
-rw-r--r-- | intern/cycles/blender/blender_session.h | 2 |
2 files changed, 10 insertions, 11 deletions
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp index 9a798a4f979..8923450c469 100644 --- a/intern/cycles/blender/blender_session.cpp +++ b/intern/cycles/blender/blender_session.cpp @@ -114,11 +114,6 @@ BlenderSession::~BlenderSession() free_session(); } -void BlenderSession::create() -{ - create_session(); -} - void BlenderSession::create_session() { SessionParams session_params = BlenderSync::get_session_params( @@ -199,8 +194,12 @@ void BlenderSession::reset_session(BL::BlendData &b_data, BL::Depsgraph &b_depsg height = render_resolution_y(b_render); } - if (session == NULL) { - create(); + bool is_new_session = (session == NULL); + if (is_new_session) { + /* Initialize session and remember it was just created so not to + * re-create it below. + */ + create_session(); } if (b_v3d) { @@ -219,8 +218,10 @@ void BlenderSession::reset_session(BL::BlendData &b_data, BL::Depsgraph &b_depsg /* if scene or session parameters changed, it's easier to simply re-create * them rather than trying to distinguish which settings need to be updated */ - free_session(); - create_session(); + if (!is_new_session) { + free_session(); + create_session(); + } return; } diff --git a/intern/cycles/blender/blender_session.h b/intern/cycles/blender/blender_session.h index d57ebe76b82..7445fb53458 100644 --- a/intern/cycles/blender/blender_session.h +++ b/intern/cycles/blender/blender_session.h @@ -49,8 +49,6 @@ class BlenderSession { ~BlenderSession(); - void create(); - /* session */ void create_session(); void free_session(); |