Commit: 4cd9a3e3375e396dc0c09a492633be9ad4774b09
Author: Dalai Felinto
Date:   Thu Jun 22 17:20:39 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB4cd9a3e3375e396dc0c09a492633be9ad4774b09

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).

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

M       release/scripts/startup/bl_ui/properties_data_lightprobe.py
M       release/scripts/startup/bl_ui/space_view3d.py
M       source/blender/editors/object/object_add.c
M       source/blender/makesrna/intern/rna_lightprobe.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_lightprobe.py 
b/release/scripts/startup/bl_ui/properties_data_lightprobe.py
index af6a1affd69..f56ee24fdc0 100644
--- a/release/scripts/startup/bl_ui/properties_data_lightprobe.py
+++ b/release/scripts/startup/bl_ui/properties_data_lightprobe.py
@@ -60,8 +60,6 @@ class DATA_PT_lightprobe(DataButtonsPanel, Panel):
         ob = context.object
         probe = context.lightprobe
 
-        layout.prop(probe, "type", expand=True)
-
         split = layout.split()
 
         if probe.type == 'GRID':
@@ -76,11 +74,13 @@ class DATA_PT_lightprobe(DataButtonsPanel, Panel):
             col.label("Influence:")
             col.prop(probe, "influence_distance", "Distance")
             col.prop(probe, "falloff")
-        elif probe.type == "PLANAR":
+
+        elif probe.type == 'PLANAR':
             col = split.column(align=True)
             col.label("Influence:")
             col.prop(probe, "influence_distance", "Distance")
             col.prop(probe, "falloff")
+
         else:
             col = split.column(align=True)
             col.label("Influence:")
@@ -96,6 +96,7 @@ class DATA_PT_lightprobe(DataButtonsPanel, Panel):
         col = split.column(align=True)
         col.label("Clipping:")
         col.prop(probe, "clip_start", text="Start")
+
         if probe.type != "PLANAR":
             col.prop(probe, "clip_end", text="End")
 
diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 0e1a142a41f..b3792686fc4 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -1263,6 +1263,7 @@ class INFO_MT_add(Menu):
             INFO_MT_camera_add.draw(self, context)
 
         layout.menu("INFO_MT_lamp_add", icon='OUTLINER_OB_LAMP')
+        layout.separator()
         layout.menu("INFO_MT_lightprobe_add")
         layout.separator()
 
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");

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to