Commit: 8fb9dfbec5fa5b6ed1f94494b6972988605e5c14
Author: Clément Foucault
Date:   Tue Apr 24 12:15:25 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB8fb9dfbec5fa5b6ed1f94494b6972988605e5c14

EEVEE: LightProbes: Add Visibility Group to DNA/RNA/UI.

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

M       release/scripts/startup/bl_ui/properties_data_lightprobe.py
M       source/blender/blenkernel/intern/library_query.c
M       source/blender/blenloader/intern/readfile.c
M       source/blender/makesdna/DNA_lightprobe_types.h
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 e01ca88b587..5bb327f3a05 100644
--- a/release/scripts/startup/bl_ui/properties_data_lightprobe.py
+++ b/release/scripts/startup/bl_ui/properties_data_lightprobe.py
@@ -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'}
diff --git a/source/blender/blenkernel/intern/library_query.c 
b/source/blender/blenkernel/intern/library_query.c
index ebf286c29ca..efc550ac64c 100644
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@ -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;
                        }
 
diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index e8c96cb7d1b..c1539d7edf1 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -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;
                }
        }
diff --git a/source/blender/makesdna/DNA_lightprobe_types.h 
b/source/blender/makesdna/DNA_lightprobe_types.h
index 649df714457..3eee6d4b192 100644
--- a/source/blender/makesdna/DNA_lightprobe_types.h
+++ b/source/blender/makesdna/DNA_lightprobe_types.h
@@ -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 */
diff --git a/source/blender/makesrna/intern/rna_lightprobe.c 
b/source/blender/makesrna/intern/rna_lightprobe.c
index 6586b456960..675615d6c1f 100644
--- a/source/blender/makesrna/intern/rna_lightprobe.c
+++ b/source/blender/makesrna/intern/rna_lightprobe.c
@@ -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);

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

Reply via email to