diff --git a/release/scripts/startup/bl_ui/properties_data_probe.py b/release/scripts/startup/bl_ui/properties_data_probe.py index 07151f9a743..794ec0c3cbd 100644 --- a/release/scripts/startup/bl_ui/properties_data_probe.py +++ b/release/scripts/startup/bl_ui/properties_data_probe.py @@ -62,23 +62,23 @@ class DATA_PT_probe(DataButtonsPanel, Panel): layout.prop(probe, "type", expand=True) - layout.label("Influence:") - layout.prop(probe, "influence_type", expand=True) + split = layout.split() + + col = split.column(align=True) + col.label("Influence:") + col.prop(probe, "influence_type", text="") if probe.influence_type == 'ELIPSOID': - layout.prop(probe, "influence_distance", "Radius") - layout.prop(probe, "falloff") + col.prop(probe, "influence_distance", "Radius") else: - layout.prop(probe, "influence_distance", "Size") - layout.prop(probe, "falloff") + col.prop(probe, "influence_distance", "Size") - layout.prop(probe, "show_influence") - layout.separator() + col.prop(probe, "falloff") - layout.label("Clipping:") - row = layout.row(align=True) - row.prop(probe, "clip_start", text="Start") - row.prop(probe, "clip_end", text="End") + col = split.column(align=True) + col.label("Clipping:") + col.prop(probe, "clip_start", text="Start") + col.prop(probe, "clip_end", text="End") class DATA_PT_parallax(DataButtonsPanel, Panel): @@ -104,13 +104,34 @@ class DATA_PT_parallax(DataButtonsPanel, Panel): else: col.prop(probe, "parallax_distance", "Size") + +class DATA_PT_display(DataButtonsPanel, Panel): + bl_label = "Display" + COMPAT_ENGINES = {'BLENDER_CLAY', 'BLENDER_EEVEE'} + + def draw(self, context): + layout = self.layout + + ob = context.object + probe = context.probe + + split = layout.split() + + col = split.column() + col.prop(probe, "show_influence") + + col = split.column() col.prop(probe, "show_parallax") + col = split.column() + col.prop(probe, "show_clip") + classes = ( DATA_PT_context_probe, DATA_PT_probe, DATA_PT_parallax, + DATA_PT_display, ) if __name__ == "__main__": # only for live edit. diff --git a/source/blender/blenkernel/intern/probe.c b/source/blender/blenkernel/intern/probe.c index c6449275aa9..143ecb23875 100644 --- a/source/blender/blenkernel/intern/probe.c +++ b/source/blender/blenkernel/intern/probe.c @@ -46,7 +46,7 @@ void BKE_probe_init(Probe *probe) probe->distinf = 5.0f; probe->distpar = 5.0f; - probe->falloff = 0.75f; + probe->falloff = 0.2f; probe->clipsta = 1.0f; probe->clipend = 40.0f; } diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index 0f91ae27903..e1bcb3bf147 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -1430,21 +1430,46 @@ static void DRW_shgroup_probe(OBJECT_StorageList *stl, Object *ob, SceneLayer *s } if ((prb->flag & PRB_SHOW_PARALLAX) != 0) { - if ((prb->flag & PRB_CUSTOM_PARALLAX) != 0) { - float (*obmat)[4]; + float (*obmat)[4], *dist; + + if ((prb->flag & PRB_CUSTOM_PARALLAX) != 0) { + dist = &prb->distpar; /* TODO object parallax */ obmat = ob->obmat; + } + else { + dist = &prb->distinf; + obmat = ob->obmat; + } - if (prb->parallax_type == PROBE_BOX) { - DRW_shgroup_call_dynamic_add(stl->g_data->cube, color, &prb->distpar, obmat); - } - else { - DRW_shgroup_call_dynamic_add(stl->g_data->sphere, color, &prb->distpar, obmat); - } + if (prb->parallax_type == PROBE_BOX) { + DRW_shgroup_call_dynamic_add(stl->g_data->cube, color, &dist, obmat); + } + else { + DRW_shgroup_call_dynamic_add(stl->g_data->sphere, color, &dist, obmat); } } + if ((prb->flag & PRB_SHOW_CLIP_DIST) != 0) { + static const float cubefacemat[6][4][4] = { + {{0.0, 0.0, -1.0, 0.0}, {0.0, -1.0, 0.0, 0.0}, {-1.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 1.0}}, + {{0.0, 0.0, 1.0, 0.0}, {0.0, -1.0, 0.0, 0.0}, {1.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 1.0}}, + {{1.0, 0.0, 0.0, 0.0}, {0.0, 0.0, -1.0, 0.0}, {0.0, 1.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 1.0}}, + {{1.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 1.0, 0.0}, {0.0, -1.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 1.0}}, + {{1.0, 0.0, 0.0, 0.0}, {0.0, -1.0, 0.0, 0.0}, {0.0, 0.0, -1.0, 0.0}, {0.0, 0.0, 0.0, 1.0}}, + {{-1.0, 0.0, 0.0, 0.0}, {0.0, -1.0, 0.0, 0.0}, {0.0, 0.0, 1.0, 0.0}, {0.0, 0.0, 0.0, 1.0}}, + }; + + for (int i = 0; i < 6; ++i) { + normalize_m4_m4(prb->clipmat[i], ob->obmat); + // invert_m4(prb->clipmat[i]); + mul_m4_m4m4(prb->clipmat[i], prb->clipmat[i], cubefacemat[i]); + + DRW_shgroup_call_dynamic_add(stl->g_data->lamp_buflimit, color, &prb->clipsta, &prb->clipend, prb->clipmat[i]); + DRW_shgroup_call_dynamic_add(stl->g_data->lamp_buflimit_points, color, &prb->clipsta, &prb->clipend, prb->clipmat[i]); + } + } DRW_shgroup_call_dynamic_add(stl->g_data->lamp_center_group, ob->obmat[3]); /* Line and point going to the ground */ diff --git a/source/blender/makesdna/DNA_probe_types.h b/source/blender/makesdna/DNA_probe_types.h index ce97a898ede..88a1ba9078f 100644 --- a/source/blender/makesdna/DNA_probe_types.h +++ b/source/blender/makesdna/DNA_probe_types.h @@ -59,6 +59,7 @@ typedef struct Probe { /* Runtime display data */ float distfalloff, pad; + float clipmat[6][4][4]; } Probe; /* Probe->type */ @@ -73,6 +74,7 @@ enum { PRB_CUSTOM_PARALLAX = (1 << 0), PRB_SHOW_INFLUENCE = (1 << 1), PRB_SHOW_PARALLAX = (1 << 2), + PRB_SHOW_CLIP_DIST = (1 << 3), }; /* Probe->display */ diff --git a/source/blender/makesrna/intern/rna_probe.c b/source/blender/makesrna/intern/rna_probe.c index c9c20282195..dae84a51494 100644 --- a/source/blender/makesrna/intern/rna_probe.c +++ b/source/blender/makesrna/intern/rna_probe.c @@ -97,6 +97,11 @@ static void rna_def_probe(BlenderRNA *brna) "Probe clip end, beyond which objects will not appear in reflections"); RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_Probe_recalc"); + prop = RNA_def_property(srna, "show_clip", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PRB_SHOW_CLIP_DIST); + RNA_def_property_ui_text(prop, "Clipping", "Show the clipping distances in the 3D view"); + RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL); + prop = RNA_def_property(srna, "influence_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "attenuation_type"); RNA_def_property_enum_items(prop, parallax_type_items); @@ -105,7 +110,7 @@ static void rna_def_probe(BlenderRNA *brna) 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_ui_text(prop, "Influence", "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); @@ -126,7 +131,7 @@ static void rna_def_probe(BlenderRNA *brna) 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_ui_text(prop, "Parallax", "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);