[Bf-blender-cvs] [85990343f63] blender2.8: Probe: Remove Bounding Box parameter.

Clément Foucault noreply at git.blender.org
Fri Jun 9 23:28:34 CEST 2017


Commit: 85990343f631e78ef62980f20a372907ce344e2f
Author: Clément Foucault
Date:   Fri Jun 9 23:21:23 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB85990343f631e78ef62980f20a372907ce344e2f

Probe: Remove Bounding Box parameter.

After using it for like 30 sec, the min max bound box is absolutely not practical. Reverting into using a unit cube with object transform.
This also simplify the code.
In the future of center probes will be implemented using another object matrix (via an object pointer).

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

M	release/scripts/startup/bl_ui/properties_data_probe.py
M	source/blender/blenkernel/intern/probe.c
M	source/blender/draw/engines/eevee/eevee_probes.c
M	source/blender/makesdna/DNA_probe_types.h
M	source/blender/makesrna/intern/rna_probe.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_probe.py b/release/scripts/startup/bl_ui/properties_data_probe.py
index 2f515d71ddf..07151f9a743 100644
--- a/release/scripts/startup/bl_ui/properties_data_probe.py
+++ b/release/scripts/startup/bl_ui/properties_data_probe.py
@@ -69,14 +69,10 @@ class DATA_PT_probe(DataButtonsPanel, Panel):
             layout.prop(probe, "influence_distance", "Radius")
             layout.prop(probe, "falloff")
         else:
-            split = layout.split()
-            col = split.column(align=True)
-            col.prop(probe, "influence_minimum", text="Min:")
-            col = split.column(align=True)
-            col.prop(probe, "influence_maximum", text="Max:")
-
+            layout.prop(probe, "influence_distance", "Size")
             layout.prop(probe, "falloff")
 
+        layout.prop(probe, "show_influence")
         layout.separator()
 
         layout.label("Clipping:")
@@ -106,11 +102,9 @@ class DATA_PT_parallax(DataButtonsPanel, Panel):
         if probe.parallax_type == 'ELIPSOID':
             col.prop(probe, "parallax_distance", "Radius")
         else:
-            split = col.split()
-            col = split.column(align=True)
-            col.prop(probe, "parallax_minimum", text="Min:")
-            col = split.column(align=True)
-            col.prop(probe, "parallax_maximum", text="Max:")
+            col.prop(probe, "parallax_distance", "Size")
+
+        col.prop(probe, "show_parallax")
 
 
 classes = (
diff --git a/source/blender/blenkernel/intern/probe.c b/source/blender/blenkernel/intern/probe.c
index c5282e90366..c6449275aa9 100644
--- a/source/blender/blenkernel/intern/probe.c
+++ b/source/blender/blenkernel/intern/probe.c
@@ -46,11 +46,7 @@ void BKE_probe_init(Probe *probe)
 
 	probe->distinf = 5.0f;
 	probe->distpar = 5.0f;
-	copy_v3_fl(probe->mininf, -5.0f);
-	copy_v3_fl(probe->maxinf, 5.0f);
-	copy_v3_fl(probe->minpar, -5.0f);
-	copy_v3_fl(probe->maxpar, 5.0f);
-	probe->falloff = 0.25f;
+	probe->falloff = 0.75f;
 	probe->clipsta = 1.0f;
 	probe->clipend = 40.0f;
 }
diff --git a/source/blender/draw/engines/eevee/eevee_probes.c b/source/blender/draw/engines/eevee/eevee_probes.c
index bdddcfffed3..62cc437d396 100644
--- a/source/blender/draw/engines/eevee/eevee_probes.c
+++ b/source/blender/draw/engines/eevee/eevee_probes.c
@@ -279,63 +279,29 @@ static void EEVEE_probes_updates(EEVEE_SceneLayerData *sldata)
 		Probe *probe = (Probe *)ob->data;
 		EEVEE_Probe *eprobe = &pinfo->probe_data[i];
 
-
 		/* Attenuation */
 		eprobe->attenuation_type = probe->attenuation_type;
 		eprobe->attenuation_fac = 1.0f / max_ff(1e-8f, probe->falloff);
 
 		unit_m4(eprobe->attenuationmat);
-		if (probe->attenuation_type == PROBE_BOX) {
-			BoundBox bb;
-			float bb_center[3], bb_size[3];
-
-			BKE_boundbox_init_from_minmax(&bb, probe->mininf, probe->maxinf);
-			BKE_boundbox_calc_center_aabb(&bb, bb_center);
-			BKE_boundbox_calc_size_aabb(&bb, bb_size);
-
-			eprobe->attenuationmat[0][0] = bb_size[0];
-			eprobe->attenuationmat[1][1] = bb_size[1];
-			eprobe->attenuationmat[2][2] = bb_size[2];
-			copy_v3_v3(eprobe->attenuationmat[3], bb_center);
-			mul_m4_m4m4(eprobe->attenuationmat, ob->obmat, eprobe->attenuationmat);
-		}
-		else {
-			scale_m4_fl(eprobe->attenuationmat, probe->distinf);
-			mul_m4_m4m4(eprobe->attenuationmat, ob->obmat, eprobe->attenuationmat);
-		}
+		scale_m4_fl(eprobe->attenuationmat, probe->distinf);
+		mul_m4_m4m4(eprobe->attenuationmat, ob->obmat, eprobe->attenuationmat);
 		invert_m4(eprobe->attenuationmat);
 
 		/* Parallax */
-		BoundBox parbb;
 		float dist;
 		if ((probe->flag & PRB_CUSTOM_PARALLAX) != 0) {
 			eprobe->parallax_type = probe->parallax_type;
-			BKE_boundbox_init_from_minmax(&parbb, probe->minpar, probe->maxpar);
 			dist = probe->distpar;
 		}
 		else {
 			eprobe->parallax_type = probe->attenuation_type;
-			BKE_boundbox_init_from_minmax(&parbb, probe->mininf, probe->maxinf);
 			dist = probe->distinf;
 		}
 
 		unit_m4(eprobe->parallaxmat);
-		if (eprobe->parallax_type == PROBE_BOX) {
-			float bb_center[3], bb_size[3];
-
-			BKE_boundbox_calc_center_aabb(&parbb, bb_center);
-			BKE_boundbox_calc_size_aabb(&parbb, bb_size);
-
-			eprobe->parallaxmat[0][0] = bb_size[0];
-			eprobe->parallaxmat[1][1] = bb_size[1];
-			eprobe->parallaxmat[2][2] = bb_size[2];
-			copy_v3_v3(eprobe->parallaxmat[3], bb_center);
-			mul_m4_m4m4(eprobe->parallaxmat, ob->obmat, eprobe->parallaxmat);
-		}
-		else {
-			scale_m4_fl(eprobe->parallaxmat, dist);
-			mul_m4_m4m4(eprobe->parallaxmat, ob->obmat, eprobe->parallaxmat);
-		}
+		scale_m4_fl(eprobe->parallaxmat, dist);
+		mul_m4_m4m4(eprobe->parallaxmat, ob->obmat, eprobe->parallaxmat);
 		invert_m4(eprobe->parallaxmat);
 	}
 }
diff --git a/source/blender/makesdna/DNA_probe_types.h b/source/blender/makesdna/DNA_probe_types.h
index 8fb2c61e1c7..ce97a898ede 100644
--- a/source/blender/makesdna/DNA_probe_types.h
+++ b/source/blender/makesdna/DNA_probe_types.h
@@ -49,14 +49,8 @@ typedef struct Probe {
 	char parallax_type;    /* Parallax type */
 
 	float distinf;    /* Influence Radius */
-	float mininf[3];  /* Influence Bound Box */
-	float maxinf[3];
-
-	float falloff;    /* Influence falloff */
-
 	float distpar;    /* Parallax Radius */
-	float minpar[3];  /* Parallax Bound Box */
-	float maxpar[3];
+	float falloff;    /* Influence falloff */
 
 	float clipsta, clipend;
 
@@ -77,6 +71,8 @@ enum {
 /* Probe->flag */
 enum {
 	PRB_CUSTOM_PARALLAX = (1 << 0),
+	PRB_SHOW_INFLUENCE  = (1 << 1),
+	PRB_SHOW_PARALLAX   = (1 << 2),
 };
 
 /* Probe->display */
diff --git a/source/blender/makesrna/intern/rna_probe.c b/source/blender/makesrna/intern/rna_probe.c
index a025acf3b8a..c9c20282195 100644
--- a/source/blender/makesrna/intern/rna_probe.c
+++ b/source/blender/makesrna/intern/rna_probe.c
@@ -103,21 +103,17 @@ static void rna_def_probe(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Type", "Type of parallax volume");
 	RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
 
+	prop = RNA_def_property(srna, "show_influence", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", PRB_SHOW_INFLUENCE);
+	RNA_def_property_ui_text(prop, "Show Influence Volume", "Show the influence volume in the 3D view");
+	RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
+
 	prop = RNA_def_property(srna, "influence_distance", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "distinf");
+	RNA_def_property_range(prop, 0.0f, 99999.f);
 	RNA_def_property_ui_text(prop, "Influence Distance", "Influence distance of the probe");
 	RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
 
-	prop = RNA_def_property(srna, "influence_minimum", PROP_FLOAT, PROP_TRANSLATION);
-	RNA_def_property_float_sdna(prop, NULL, "mininf");
-	RNA_def_property_ui_text(prop, "Influence Min", "Lowest corner of the influence bounding box");
-	RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
-
-	prop = RNA_def_property(srna, "influence_maximum", PROP_FLOAT, PROP_TRANSLATION);
-	RNA_def_property_float_sdna(prop, NULL, "maxinf");
-	RNA_def_property_ui_text(prop, "Influence Max", "Highest corner of the influence bounding box");
-	RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
-
 	prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Falloff", "Control how fast the probe influence decreases");
@@ -128,6 +124,11 @@ static void rna_def_probe(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Use Custom Parallax", "Enable custom settings for the parallax correction volume");
 	RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
 
+	prop = RNA_def_property(srna, "show_parallax", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", PRB_SHOW_PARALLAX);
+	RNA_def_property_ui_text(prop, "Show Parallax Volume", "Show the parallax correction volume in the 3D view");
+	RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
+
 	prop = RNA_def_property(srna, "parallax_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, parallax_type_items);
 	RNA_def_property_ui_text(prop, "Type", "Type of parallax volume");
@@ -135,19 +136,10 @@ static void rna_def_probe(BlenderRNA *brna)
 
 	prop = RNA_def_property(srna, "parallax_distance", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "distpar");
+	RNA_def_property_range(prop, 0.0f, 99999.f);
 	RNA_def_property_ui_text(prop, "Parallax Radius", "Lowest corner of the parallax bounding box");
 	RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
 
-	prop = RNA_def_property(srna, "parallax_minimum", PROP_FLOAT, PROP_TRANSLATION);
-	RNA_def_property_float_sdna(prop, NULL, "minpar");
-	RNA_def_property_ui_text(prop, "Parallax Min", "Lowest corner of the parallax bounding box");
-	RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
-
-	prop = RNA_def_property(srna, "parallax_maximum", PROP_FLOAT, PROP_TRANSLATION);
-	RNA_def_property_float_sdna(prop, NULL, "maxpar");
-	RNA_def_property_ui_text(prop, "Parallax Max", "Highest corner of the parallax bounding box");
-	RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
-
 	/* common */
 	rna_def_animdata_common(srna);
 }




More information about the Bf-blender-cvs mailing list