EEVEE: LightProbes: Add Visibility Group to DNA/RNA/UI.
authorClément Foucault <foucault.clem@gmail.com>
Tue, 24 Apr 2018 10:15:25 +0000 (12:15 +0200)
committerClément Foucault <foucault.clem@gmail.com>
Tue, 24 Apr 2018 10:48:43 +0000 (12:48 +0200)
release/scripts/startup/bl_ui/properties_data_lightprobe.py
source/blender/blenkernel/intern/library_query.c
source/blender/blenloader/intern/readfile.c
source/blender/makesdna/DNA_lightprobe_types.h
source/blender/makesrna/intern/rna_lightprobe.c

index e01ca88b5878f0361ddb257795fedde5ca890cb1..5bb327f3a053a3605da0f6012ca1ed8e9f17db24 100644 (file)
@@ -104,12 +104,18 @@ class DATA_PT_lightprobe(DataButtonsPanel, Panel):
         if probe.type == 'GRID':
             col.separator()
 
-            col.label("Visibily:")
+            col.label("Visibility:")
             col.prop(probe, "visibility_buffer_bias", "Bias")
             col.prop(probe, "visibility_bleed_bias", "Bleed Bias")
             col.prop(probe, "visibility_blur", "Blur")
 
 
+        col.label("Visibility Group:")
+        row = col.row(align=True)
+        row.prop(probe, "visibility_group", text="")
+        row.prop(probe, "invert_visibility_group", text="", icon='ARROW_LEFTRIGHT')
+
+
 class DATA_PT_lightprobe_parallax(DataButtonsPanel, Panel):
     bl_label = "Parallax"
     COMPAT_ENGINES = {'BLENDER_CLAY', 'BLENDER_EEVEE'}
index ebf286c29caf17d0687258e9a0c15de4b0dd7fbe..efc550ac64cade870262116af21a90338cc69345 100644 (file)
@@ -696,6 +696,7 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
                        {
                                LightProbe *probe = (LightProbe *) id;
                                CALLBACK_INVOKE(probe->image, IDWALK_CB_USER);
+                               CALLBACK_INVOKE(probe->visibility_grp, IDWALK_CB_NOP);
                                break;
                        }
 
index e8c96cb7d1b650fa90a4fc80bc2f3da5d1871841..c1539d7edf174f51682fb99e393e001c95522202 100644 (file)
@@ -7492,11 +7492,13 @@ static void fix_relpaths_library(const char *basepath, Main *main)
 
 static void lib_link_lightprobe(FileData *fd, Main *main)
 {
-       for (LightProbe *prb = main->speaker.first; prb; prb = prb->id.next) {
+       for (LightProbe *prb = main->lightprobe.first; prb; prb = prb->id.next) {
                if (prb->id.tag & LIB_TAG_NEED_LINK) {
                        IDP_LibLinkProperty(prb->id.properties, fd);
                        lib_link_animdata(fd, &prb->id, prb->adt);
 
+                       prb->visibility_grp = newlibadr(fd, prb->id.lib, prb->visibility_grp);
+
                        prb->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
index 649df71445707e0f5992468c6eec39225c22b069..3eee6d4b192467f6029822884280889a1173f90f 100644 (file)
@@ -66,6 +66,7 @@ typedef struct LightProbe {
 
        struct Object *parallax_ob;    /* Object to use as a parallax origin */
        struct Image *image;           /* Image to use on as lighting data */
+       struct Group *visibility_grp;  /* Object visibility group, inclusive or exclusive */
 
        float data_draw_size;
 
@@ -88,6 +89,7 @@ enum {
        LIGHTPROBE_FLAG_SHOW_PARALLAX   = (1 << 2),
        LIGHTPROBE_FLAG_SHOW_CLIP_DIST  = (1 << 3),
        LIGHTPROBE_FLAG_SHOW_DATA       = (1 << 4),
+       LIGHTPROBE_FLAG_INVERT_GROUP    = (1 << 5),
 };
 
 /* Probe->display */
index 6586b4569605626bac0304099f7da203de1e4aed..675615d6c1fa8251f5920ad3249d87956453e5f1 100644 (file)
@@ -43,6 +43,7 @@
 #include "DEG_depsgraph.h"
 
 #include "DNA_object_types.h"
+#include "DNA_group_types.h"
 
 #include "WM_api.h"
 
@@ -186,6 +187,18 @@ static void rna_def_lightprobe(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Intensity", "Modify the intensity of the lighting captured by this probe");
        RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
 
+       prop = RNA_def_property(srna, "visibility_group", PROP_POINTER, PROP_NONE);
+       RNA_def_property_pointer_sdna(prop, NULL, "visibility_grp");
+       RNA_def_property_flag(prop, PROP_EDITABLE);
+       RNA_def_property_ui_text(prop, "Visibility Group", "Restrict objects visible for this probe");
+       RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
+
+       prop = RNA_def_property(srna, "invert_visibility_group", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", LIGHTPROBE_FLAG_INVERT_GROUP);
+       RNA_def_property_flag(prop, PROP_EDITABLE);
+       RNA_def_property_ui_text(prop, "Invert Group", "Invert visibility group");
+       RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
+
        /* Data preview */
        prop = RNA_def_property(srna, "show_data", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", LIGHTPROBE_FLAG_SHOW_DATA);