From 4cd9a3e3375e396dc0c09a492633be9ad4774b09 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Thu, 22 Jun 2017 17:20:39 +0200 Subject: Light Probes: interface changes, and renames Although we are calling all of them light probes, there are a lot of differences between them. This commit does the following: * Prevent user from changing the probe type once added * Unify "sphere" and "cube" probes into reflection cubemap (as before you can switch between them from the probe UI) To be done ========== * Don't show add probe menus unless we are on Eevee * Light probes panels should not be visible in Clay. Light probe objects should not be visible in Clay viewport (nor on Cycles). Notes ===== * We need icons for the different light probes, and for lightprobes as a whole (we are using RADIO for now). --- source/blender/editors/object/object_add.c | 52 +++++++++++++------------ source/blender/makesrna/intern/rna_lightprobe.c | 11 +++--- 2 files changed, 33 insertions(+), 30 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 0dc91f6d615..daa76413b25 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -153,11 +153,12 @@ static EnumPropertyItem field_type_items[] = { }; static EnumPropertyItem lightprobe_type_items[] = { - {0, "SPHERE", ICON_MESH_UVSPHERE, "Sphere", "Reflection probe with sphere attenuation"}, - {1, "CUBE", ICON_MESH_CUBE, "Cube", "Reflection probe with cube attenuation"}, - {2, "PLANAR", ICON_MESH_PLANE, "Planar", "Planar reflection probe"}, - // {LIGHTPROBE_TYPE_IMAGE, "IMAGE", ICON_NONE, "Image", ""}, - {3, "GRID", ICON_MESH_GRID, "Grid", "Irradiance probe to capture diffuse indirect lighting"}, + {LIGHTPROBE_TYPE_CUBE, "SPHERE", ICON_MESH_UVSPHERE, "Reflection Cubemap", + "Reflection probe with spherical or cubic attenuation"}, + {LIGHTPROBE_TYPE_PLANAR, "PLANAR", ICON_MESH_PLANE, "Reflection Plane", + "Planar reflection probe"}, + {LIGHTPROBE_TYPE_GRID, "GRID", ICON_MESH_GRID, "Irradiance Volume", + "Irradiance probe to capture diffuse indirect lighting"}, {0, NULL, 0, NULL, NULL} }; @@ -521,36 +522,39 @@ static int lightprobe_add_exec(bContext *C, wmOperator *op) bool enter_editmode; unsigned int layer; float loc[3], rot[3]; - float dia; + float radius; WM_operator_view3d_unit_defaults(C, op); if (!ED_object_add_generic_get_opts(C, op, 'Z', loc, rot, &enter_editmode, &layer, NULL)) return OPERATOR_CANCELLED; type = RNA_enum_get(op->ptr, "type"); - dia = RNA_float_get(op->ptr, "radius"); + radius = RNA_float_get(op->ptr, "radius"); - const char *name = CTX_DATA_(BLT_I18NCONTEXT_ID_OBJECT, "LightProbe"); + const char *name = CTX_DATA_(BLT_I18NCONTEXT_ID_OBJECT, "Light Probe"); ob = ED_object_add_type(C, OB_LIGHTPROBE, name, loc, rot, false, layer); - BKE_object_obdata_size_init(ob, dia); + BKE_object_obdata_size_init(ob, radius); probe = (LightProbe *)ob->data; + probe->type = type; - if (type == 3) { - probe->type = LIGHTPROBE_TYPE_GRID; - probe->distinf = 0.3f; - probe->falloff = 1.0f; - } - else if (type == 2) { - probe->type = LIGHTPROBE_TYPE_PLANAR; - probe->distinf = 0.1f; - probe->falloff = 0.5f; - probe->clipsta = 0.001f; - ob->empty_drawsize = 0.5f; - } - else { - probe->type = LIGHTPROBE_TYPE_CUBE; - probe->attenuation_type = (type == 1) ? LIGHTPROBE_SHAPE_BOX : LIGHTPROBE_SHAPE_ELIPSOID; + switch (type) { + case LIGHTPROBE_TYPE_GRID: + probe->distinf = 0.3f; + probe->falloff = 1.0f; + break; + case LIGHTPROBE_TYPE_PLANAR: + probe->distinf = 0.1f; + probe->falloff = 0.5f; + probe->clipsta = 0.001f; + ob->empty_drawsize = 0.5f; + break; + case LIGHTPROBE_TYPE_CUBE: + probe->attenuation_type = LIGHTPROBE_SHAPE_ELIPSOID; + break; + default: + BLI_assert(!"Lightprobe type not configured."); + break; } DEG_relations_tag_update(CTX_data_main(C)); diff --git a/source/blender/makesrna/intern/rna_lightprobe.c b/source/blender/makesrna/intern/rna_lightprobe.c index 5daaf7c67d4..fb00cdca2f9 100644 --- a/source/blender/makesrna/intern/rna_lightprobe.c +++ b/source/blender/makesrna/intern/rna_lightprobe.c @@ -63,10 +63,9 @@ static EnumPropertyItem parallax_type_items[] = { }; static EnumPropertyItem lightprobe_type_items[] = { - {LIGHTPROBE_TYPE_CUBE, "CUBEMAP", ICON_NONE, "Cubemap", "Capture reflections"}, - {LIGHTPROBE_TYPE_PLANAR, "PLANAR", ICON_NONE, "Planar", ""}, - // {LIGHTPROBE_TYPE_IMAGE, "IMAGE", ICON_NONE, "Image", ""}, - {LIGHTPROBE_TYPE_GRID, "GRID", ICON_NONE, "Grid", "Volume used for precomputing indirect lighting"}, + {LIGHTPROBE_TYPE_CUBE, "CUBEMAP", ICON_NONE, "Reflection Cubemap", "Capture reflections"}, + {LIGHTPROBE_TYPE_PLANAR, "PLANAR", ICON_NONE, "Reflection Plane", ""}, + {LIGHTPROBE_TYPE_GRID, "GRID", ICON_NONE, "Irradiance Volume", "Volume used for precomputing indirect lighting"}, {0, NULL, 0, NULL, NULL} }; @@ -81,8 +80,8 @@ static void rna_def_lightprobe(BlenderRNA *brna) prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, lightprobe_type_items); - RNA_def_property_ui_text(prop, "Type", "Type of probe"); - RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc"); + RNA_def_property_ui_text(prop, "Type", "Type of light probe"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "clipsta"); -- cgit v1.2.3