Probes: Modify Add Menu and change defaults.
authorClément Foucault <foucault.clem@gmail.com>
Wed, 14 Jun 2017 22:53:11 +0000 (00:53 +0200)
committerClément Foucault <foucault.clem@gmail.com>
Wed, 14 Jun 2017 22:57:16 +0000 (00:57 +0200)
source/blender/blenkernel/intern/lightprobe.c
source/blender/editors/object/object_add.c

index 97e1ff2733e06899c1d70eae3c706539359ed85b..a1fa266512b7a4b618c19c9e7633c541e153bb98 100644 (file)
@@ -45,12 +45,14 @@ void BKE_lightprobe_init(LightProbe *probe)
        BLI_assert(MEMCMP_STRUCT_OFS_IS_ZERO(probe, id));
 
        probe->grid_resolution_x = probe->grid_resolution_y = probe->grid_resolution_z = 4;
-       probe->distinf = 5.0f;
-       probe->distpar = 5.0f;
+       probe->distinf = 2.5f;
+       probe->distpar = 2.5f;
        probe->falloff = 0.2f;
-       probe->clipsta = 1.0f;
+       probe->clipsta = 0.8f;
        probe->clipend = 40.0f;
        probe->data_draw_size = 1.0f;
+
+       probe->flag = LIGHTPROBE_FLAG_SHOW_INFLUENCE | LIGHTPROBE_FLAG_SHOW_DATA;
 }
 
 void *BKE_lightprobe_add(Main *bmain, const char *name)
index 2649a6d6d69b202f72f41d5579feb9b232b841f9..33af8f94d048771ddf0a24075aa39743659f699e 100644 (file)
@@ -152,11 +152,12 @@ static EnumPropertyItem field_type_items[] = {
        {0, NULL, 0, NULL, NULL}
 };
 
-/* copy from rna_lightprobe.c */
 static EnumPropertyItem lightprobe_type_items[] = {
-       {LIGHTPROBE_TYPE_CUBE, "CUBE", ICON_MESH_UVSPHERE, "Sphere", ""},
+       {0, "SPHERE", ICON_MESH_UVSPHERE, "Sphere", "Reflection probe with sphere attenuation"},
+       {1, "CUBE", ICON_MESH_CUBE, "Cube", "Reflection probe with cube attenuation"},
        // {LIGHTPROBE_TYPE_PLANAR, "PLANAR", ICON_MESH_PLANE, "Planar", ""},
        // {LIGHTPROBE_TYPE_IMAGE, "IMAGE", ICON_NONE, "Image", ""},
+       {2, "GRID", ICON_MESH_GRID, "Grid", "Irradiance probe to capture diffuse indirect lighting"},
        {0, NULL, 0, NULL, NULL}
 };
 
@@ -534,7 +535,16 @@ static int lightprobe_add_exec(bContext *C, wmOperator *op)
        BKE_object_obdata_size_init(ob, dia);
 
        probe = (LightProbe *)ob->data;
-       probe->type = type;
+
+       if (type == 2) {
+               probe->type = LIGHTPROBE_TYPE_GRID;
+               probe->distinf = 0.3f;
+               probe->falloff = 1.0f;
+       }
+       else {
+               probe->type = LIGHTPROBE_TYPE_CUBE;
+               probe->attenuation_type = (type == 1) ? LIGHTPROBE_SHAPE_BOX : LIGHTPROBE_SHAPE_ELIPSOID;
+       }
 
        DEG_relations_tag_update(CTX_data_main(C));