Commit: c02d428147c970a61f69ccd15c49b5fb650454ec
Author: Clément Foucault
Date:   Wed Jan 17 00:23:31 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBc02d428147c970a61f69ccd15c49b5fb650454ec

Eevee: Update lightprobes when deleting or linking a new world datablock

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

M       source/blender/draw/engines/eevee/eevee_lightprobes.c
M       source/blender/draw/engines/eevee/eevee_private.h

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

diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c 
b/source/blender/draw/engines/eevee/eevee_lightprobes.c
index 73a513d5794..8bfff35c77d 100644
--- a/source/blender/draw/engines/eevee/eevee_lightprobes.c
+++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c
@@ -374,7 +374,7 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData 
*sldata, EEVEE_Data *vedat
                float *col = ts.colorBackground;
                if (wo) {
                        col = &wo->horr;
-                       if (wo->update_flag != 0) {
+                       if (wo->update_flag != 0 || pinfo->prev_world != wo) {
                                e_data.update_world |= PROBE_UPDATE_ALL;
                                pinfo->updated_bounce = 0;
                                pinfo->grid_initialized = false;
@@ -396,6 +396,14 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData 
*sldata, EEVEE_Data *vedat
                                        col = pink;
                                }
                        }
+
+                       pinfo->prev_world = wo;
+               }
+               else if (pinfo->prev_world) {
+                       pinfo->prev_world = NULL;
+                       e_data.update_world |= PROBE_UPDATE_ALL;
+                       pinfo->updated_bounce = 0;
+                       pinfo->grid_initialized = false;
                }
 
                /* Fallback if shader fails or if not using nodetree. */
diff --git a/source/blender/draw/engines/eevee/eevee_private.h 
b/source/blender/draw/engines/eevee/eevee_private.h
index 3c3b495f95c..d56d5abc9ef 100644
--- a/source/blender/draw/engines/eevee/eevee_private.h
+++ b/source/blender/draw/engines/eevee/eevee_private.h
@@ -439,6 +439,7 @@ typedef struct EEVEE_LightProbesInfo {
        int target_size;
        int irradiance_vis_size;
        int grid_initialized;
+       struct World *prev_world;
        /* Actual number of probes that have datas. */
        int num_render_cube;
        int num_render_grid;

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

Reply via email to