[Bf-blender-cvs] [1ad0cc6bde4] blender2.8: Eevee: Hide lightprobe data when using "Only Render"

Dalai Felinto noreply at git.blender.org
Mon Jul 3 16:17:54 CEST 2017


Commit: 1ad0cc6bde4746949eee7a9babb97178a05816c3
Author: Dalai Felinto
Date:   Mon Jul 3 16:16:24 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB1ad0cc6bde4746949eee7a9babb97178a05816c3

Eevee: Hide lightprobe data when using "Only Render"

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

M	source/blender/draw/engines/eevee/eevee_lightprobes.c
M	source/blender/draw/intern/DRW_render.h
M	source/blender/draw/intern/draw_manager.c

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

diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c
index 9622a5fa7fb..ee518cc268c 100644
--- a/source/blender/draw/engines/eevee/eevee_lightprobes.c
+++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c
@@ -582,7 +582,7 @@ static void EEVEE_planar_reflections_updates(EEVEE_SceneLayerData *sldata, EEVEE
 		eplanar->attenuation_bias = max_dist * -eplanar->attenuation_scale;
 
 		/* Debug Display */
-		if ((probe->flag & LIGHTPROBE_FLAG_SHOW_DATA) != 0) {
+		if (DRW_state_draw_support() && (probe->flag & LIGHTPROBE_FLAG_SHOW_DATA)) {
 			DRWShadingGroup *grp = DRW_shgroup_create(e_data.probe_planar_display_sh, psl->probe_display);
 
 			DRW_shgroup_uniform_int(grp, "probeIdx", &ped->probe_id, 1);
@@ -635,7 +635,7 @@ static void EEVEE_lightprobes_updates(EEVEE_SceneLayerData *sldata, EEVEE_PassLi
 		invert_m4(eprobe->parallaxmat);
 
 		/* Debug Display */
-		if ((probe->flag & LIGHTPROBE_FLAG_SHOW_DATA) != 0) {
+		if (DRW_state_draw_support() && (probe->flag & LIGHTPROBE_FLAG_SHOW_DATA)) {
 			DRW_shgroup_call_dynamic_add(stl->g_data->cube_display_shgrp, &ped->probe_id, ob->obmat[3], &probe->data_draw_size);
 		}
 	}
@@ -693,7 +693,7 @@ static void EEVEE_lightprobes_updates(EEVEE_SceneLayerData *sldata, EEVEE_PassLi
 		copy_v3_v3_int(egrid->resolution, &probe->grid_resolution_x);
 
 		/* Debug Display */
-		if ((probe->flag & LIGHTPROBE_FLAG_SHOW_DATA) != 0) {
+		if (DRW_state_draw_support() && (probe->flag & LIGHTPROBE_FLAG_SHOW_DATA)) {
 			struct Gwn_Batch *geom = DRW_cache_sphere_get();
 			DRWShadingGroup *grp = DRW_shgroup_instance_create(e_data.probe_grid_display_sh, psl->probe_display, geom);
 			DRW_shgroup_set_instance_count(grp, ped->num_cell);
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h
index 48017cfb960..75608debaac 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -386,6 +386,7 @@ bool DRW_state_is_depth(void);
 bool DRW_state_is_image_render(void);
 bool DRW_state_is_scene_render(void);
 bool DRW_state_show_text(void);
+bool DRW_state_draw_support(void);
 
 struct DRWTextStore *DRW_state_text_cache_get(void);
 
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 97563a4b5d4..6125aa9bf1a 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -2749,14 +2749,12 @@ static void DRW_engines_enable_external(void)
 	use_drw_engine(DRW_engine_viewport_external_type.draw_engine);
 }
 
-static void DRW_engines_enable(const Scene *scene, SceneLayer *sl, const View3D *v3d)
+static void DRW_engines_enable(const Scene *scene, SceneLayer *sl)
 {
 	const int mode = CTX_data_mode_enum_ex(scene->obedit, OBACT_NEW);
 	DRW_engines_enable_from_engine(scene);
 
-	if ((DRW_state_is_scene_render() == false) &&
-	    (v3d->flag2 & V3D_RENDER_OVERRIDE) == 0)
-	{
+	if (DRW_state_draw_support()) {
 		DRW_engines_enable_from_object_mode();
 		DRW_engines_enable_from_mode(mode);
 	}
@@ -2976,7 +2974,7 @@ void DRW_draw_render_loop_ex(
 	v3d->zbuf = true;
 
 	/* Get list of enabled engines */
-	DRW_engines_enable(scene, sl, v3d);
+	DRW_engines_enable(scene, sl);
 
 	/* Setup viewport */
 	cache_is_dirty = GPU_viewport_cache_validate(DST.viewport, DRW_engines_get_hash());
@@ -3366,6 +3364,18 @@ bool DRW_state_show_text(void)
 	       (DST.options.is_scene_render) == 0;
 }
 
+/**
+ * Should draw support elements
+ * Objects center, selection outline, probe data, ...
+ */
+bool DRW_state_draw_support(void)
+{
+	View3D *v3d = DST.draw_ctx.v3d;
+	return (DRW_state_is_scene_render() == false) &&
+	        (v3d != NULL) &&
+	        ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0);
+}
+
 /** \} */




More information about the Bf-blender-cvs mailing list