Commit: a1549065f24d262cc07eee665e927ca4d87e16b4
Author: Clément Foucault
Date:   Tue Jun 26 12:37:34 2018 +0200
Branches: temp-eeveelightcache
https://developer.blender.org/rBa1549065f24d262cc07eee665e927ca4d87e16b4

Eevee: LightCache: Fix crash when baking with render result window open

===================================================================

M       source/blender/editors/render/render_shading.c
M       source/blender/windowmanager/WM_api.h

===================================================================

diff --git a/source/blender/editors/render/render_shading.c 
b/source/blender/editors/render/render_shading.c
index 6b5e86ca709..0d36ddb0ead 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -738,6 +738,9 @@ static int light_cache_bake_invoke(bContext *C, wmOperator 
*op, const wmEvent *U
        if (WM_jobs_test(wm, scene, WM_JOB_TYPE_RENDER))
                return OPERATOR_CANCELLED;
 
+       if (WM_jobs_test(wm, scene, WM_JOB_TYPE_LIGHT_BAKE))
+               return OPERATOR_CANCELLED;
+
        /* TODO abort if selected engine is not eevee. */
        void *rj = EEVEE_lightbake_job_data_alloc(bmain, view_layer, scene, 
true);
 
@@ -747,7 +750,7 @@ static int light_cache_bake_invoke(bContext *C, wmOperator 
*op, const wmEvent *U
        }
 
        wmJob *wm_job = WM_jobs_get(wm, CTX_wm_window(C), scene, "Bake 
Lighting",
-                                   WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | 
WM_JOB_PROGRESS, WM_JOB_TYPE_RENDER);
+                                   WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | 
WM_JOB_PROGRESS, WM_JOB_TYPE_LIGHT_BAKE);
        WM_jobs_customdata_set(wm_job, rj, EEVEE_lightbake_job_data_free);
        WM_jobs_timer(wm_job, 0.4, NC_OBJECT | ND_DRAW, 0);
        WM_jobs_callbacks(wm_job, EEVEE_lightbake_job, NULL, 
EEVEE_lightbake_update, NULL);
@@ -766,7 +769,6 @@ static int light_cache_bake_invoke(bContext *C, wmOperator 
*op, const wmEvent *U
        WM_jobs_start(CTX_wm_manager(C), wm_job);
 
        WM_cursor_wait(0);
-       WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, scene);
 
        return OPERATOR_RUNNING_MODAL;
 }
diff --git a/source/blender/windowmanager/WM_api.h 
b/source/blender/windowmanager/WM_api.h
index 6b1825edf3e..f73a1a1aeb2 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -521,6 +521,7 @@ enum {
        WM_JOB_TYPE_ALEMBIC,
        WM_JOB_TYPE_SHADER_COMPILATION,
        WM_JOB_TYPE_STUDIOLIGHT,
+       WM_JOB_TYPE_LIGHT_BAKE,
        /* add as needed, screencast, seq proxy build
         * if having hard coded values is a problem */
 };

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to