Commit: f6898f9ae519f4b8cf25c6e31bdb1754670015ff
Author: Clément Foucault
Date:   Wed Jun 7 15:23:58 2017 +0200
Branches: blender2.8
https://developer.blender.org/rBf6898f9ae519f4b8cf25c6e31bdb1754670015ff

Probe: fix some missing bits / errors in RNA ...

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

M       source/blender/blenkernel/intern/library_query.c
M       source/blender/blenkernel/intern/probe.c
M       source/blender/editors/space_buttons/buttons_context.c
M       source/blender/editors/space_outliner/outliner_tree.c
M       source/blender/makesdna/DNA_object_types.h
M       source/blender/makesdna/DNA_probe_types.h
M       source/blender/makesrna/RNA_access.h
M       source/blender/makesrna/intern/rna_ID.c
M       source/blender/makesrna/intern/rna_object.c
M       source/blender/makesrna/intern/rna_probe.c

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

diff --git a/source/blender/blenkernel/intern/library_query.c 
b/source/blender/blenkernel/intern/library_query.c
index d2ee11cc397..ef0ec4312f7 100644
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@ -52,6 +52,7 @@
 #include "DNA_mask_types.h"
 #include "DNA_node_types.h"
 #include "DNA_object_force.h"
+#include "DNA_probe_types.h"
 #include "DNA_rigidbody_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_sensor_types.h"
@@ -771,6 +772,13 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, 
LibraryIDLinkCallback call
                                break;
                        }
 
+                       case ID_PRB:
+                       {
+                               Probe *probe = (Probe *) id;
+                               CALLBACK_INVOKE(probe->image, IDWALK_CB_USER);
+                               break;
+                       }
+
                        case ID_GR:
                        {
                                Group *group = (Group *) id;
@@ -1134,6 +1142,8 @@ bool BKE_library_id_can_use_idtype(ID *id_owner, const 
short id_type_used)
                        return ELEM(id_type_used, ID_MC);  /* WARNING! 
mask->parent.id, not typed. */
                case ID_LS:
                        return (ELEM(id_type_used, ID_TE, ID_OB));
+               case ID_PRB:
+                       return ELEM(id_type_used, ID_IM);
                case ID_WS:
                case ID_IM:
                case ID_VF:
diff --git a/source/blender/blenkernel/intern/probe.c 
b/source/blender/blenkernel/intern/probe.c
index 48f6c12dc87..8f26ae9d8f7 100644
--- a/source/blender/blenkernel/intern/probe.c
+++ b/source/blender/blenkernel/intern/probe.c
@@ -44,7 +44,7 @@ void BKE_probe_init(Probe *probe)
 {
        BLI_assert(MEMCMP_STRUCT_OFS_IS_ZERO(probe, id));
 
-       probe->influence = 0.5f;
+       probe->dist = 1.5f;
 }
 
 void *BKE_probe_add(Main *bmain, const char *name)
diff --git a/source/blender/editors/space_buttons/buttons_context.c 
b/source/blender/editors/space_buttons/buttons_context.c
index deaa2885ea3..6dce22d8553 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -211,6 +211,7 @@ static int buttons_context_path_data(ButsContextPath *path, 
int type)
        else if (RNA_struct_is_a(ptr->type, &RNA_Camera) && (type == -1 || type 
== OB_CAMERA)) return 1;
        else if (RNA_struct_is_a(ptr->type, &RNA_Lamp) && (type == -1 || type 
== OB_LAMP)) return 1;
        else if (RNA_struct_is_a(ptr->type, &RNA_Speaker) && (type == -1 || 
type == OB_SPEAKER)) return 1;
+       else if (RNA_struct_is_a(ptr->type, &RNA_Probe) && (type == -1 || type 
== OB_PROBE)) return 1;
        /* try to get an object in the path, no pinning supported here */
        else if (buttons_context_path_object(path)) {
                ob = path->ptr[path->len - 1].data;
@@ -778,7 +779,7 @@ void buttons_context_compute(const bContext *C, SpaceButs 
*sbuts)
 
 const char *buttons_context_dir[] = {
        "texture_slot", "scene", "world", "object", "mesh", "armature", 
"lattice", "curve",
-       "meta_ball", "lamp", "speaker", "camera", "material", "material_slot",
+       "meta_ball", "lamp", "speaker", "probe", "camera", "material", 
"material_slot",
        "texture", "texture_user", "texture_user_property", "bone", "edit_bone",
        "pose_bone", "particle_system", "particle_system_editable", 
"particle_settings",
        "cloth", "soft_body", "fluid", "smoke", "collision", "brush", 
"dynamic_paint",
@@ -847,6 +848,10 @@ int buttons_context(const bContext *C, const char *member, 
bContextDataResult *r
                set_pointer_type(path, result, &RNA_Speaker);
                return 1;
        }
+       else if (CTX_data_equals(member, "probe")) {
+               set_pointer_type(path, result, &RNA_Probe);
+               return 1;
+       }
        else if (CTX_data_equals(member, "material")) {
                set_pointer_type(path, result, &RNA_Material);
                return 1;
diff --git a/source/blender/editors/space_outliner/outliner_tree.c 
b/source/blender/editors/space_outliner/outliner_tree.c
index ef208eaba58..15bac69b6bd 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -46,6 +46,7 @@
 #include "DNA_material_types.h"
 #include "DNA_mesh_types.h"
 #include "DNA_meta_types.h"
+#include "DNA_probe_types.h"
 #include "DNA_particle_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_world_types.h"
@@ -730,6 +731,14 @@ static void outliner_add_id_contents(SpaceOops *soops, 
TreeElement *te, TreeStor
                                outliner_add_element(soops, &te->subtree, spk, 
te, TSE_ANIM_DATA, 0);
                        break;
                }
+               case ID_PRB:
+               {
+                       Probe *prb = (Probe *)id;
+
+                       if (outliner_animdata_test(prb->adt))
+                               outliner_add_element(soops, &te->subtree, prb, 
te, TSE_ANIM_DATA, 0);
+                       break;
+               }
                case ID_WO:
                {
                        World *wrld = (World *)id;
diff --git a/source/blender/makesdna/DNA_object_types.h 
b/source/blender/makesdna/DNA_object_types.h
index b0ee2332b89..a747bba8e12 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -406,10 +406,10 @@ enum {
 
 /* is this ID type used as object data */
 #define OB_DATA_SUPPORT_ID(_id_type) \
-       (ELEM(_id_type, ID_ME, ID_CU, ID_MB, ID_LA, ID_SPK, ID_CA, ID_LT, 
ID_AR))
+       (ELEM(_id_type, ID_ME, ID_CU, ID_MB, ID_LA, ID_SPK, ID_PRB, ID_CA, 
ID_LT, ID_AR))
 
 #define OB_DATA_SUPPORT_ID_CASE \
-       ID_ME: case ID_CU: case ID_MB: case ID_LA: case ID_SPK: case ID_CA: 
case ID_LT: case ID_AR
+       ID_ME: case ID_CU: case ID_MB: case ID_LA: case ID_SPK: case ID_PRB: 
case ID_CA: case ID_LT: case ID_AR
 
 /* partype: first 4 bits: type */
 enum {
diff --git a/source/blender/makesdna/DNA_probe_types.h 
b/source/blender/makesdna/DNA_probe_types.h
index f50dbf599fb..0ade10282f6 100644
--- a/source/blender/makesdna/DNA_probe_types.h
+++ b/source/blender/makesdna/DNA_probe_types.h
@@ -48,18 +48,19 @@ typedef struct Probe {
        char display;     /* Probe visual appearance in the viewport */
        char parallax;    /* Parallax type */
 
-       float influence;  /* Influence radius or distance */
+       float dist;       /* Influence radius or distance */
        float falloff;    /* Influence falloff */
        float pad;
 
        struct Object *parallax_ob;    /* Object to use as a parallax volume */
+       struct Image *image;           /* Image to use on as lighting data */
 } Probe;
 
 /* Probe->type */
 enum {
-       PROBE_CAPTURE   = (1 << 0),
-       PROBE_PLANAR    = (1 << 1),
-       PROBE_CUSTOM    = (1 << 2),
+       PROBE_CAPTURE   = 0,
+       PROBE_PLANAR    = 1,
+       PROBE_CUSTOM    = 2,
 };
 
 /* Probe->display */
diff --git a/source/blender/makesrna/RNA_access.h 
b/source/blender/makesrna/RNA_access.h
index b11cc7134c4..c0c2caa3f4c 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -488,6 +488,7 @@ extern StructRNA RNA_PointLamp;
 extern StructRNA RNA_PointerProperty;
 extern StructRNA RNA_Pose;
 extern StructRNA RNA_PoseBone;
+extern StructRNA RNA_Probe;
 extern StructRNA RNA_Property;
 extern StructRNA RNA_PropertyGroup;
 extern StructRNA RNA_PropertyGroupItem;
diff --git a/source/blender/makesrna/intern/rna_ID.c 
b/source/blender/makesrna/intern/rna_ID.c
index a247184174b..f4ecde913b5 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -166,6 +166,7 @@ short RNA_type_to_ID_code(const StructRNA *type)
        if (RNA_struct_is_a(type, &RNA_ParticleSettings)) return ID_PA;
        if (RNA_struct_is_a(type, &RNA_Palette)) return ID_PAL;
        if (RNA_struct_is_a(type, &RNA_PaintCurve)) return ID_PC;
+       if (RNA_struct_is_a(type, &RNA_Probe)) return ID_PRB;
        if (RNA_struct_is_a(type, &RNA_Scene)) return ID_SCE;
        if (RNA_struct_is_a(type, &RNA_Screen)) return ID_SCR;
        if (RNA_struct_is_a(type, &RNA_Sound)) return ID_SO;
@@ -207,6 +208,7 @@ StructRNA *ID_code_to_RNA_type(short idcode)
                case ID_PA: return &RNA_ParticleSettings;
                case ID_PAL: return &RNA_Palette;
                case ID_PC: return &RNA_PaintCurve;
+               case ID_PRB: return &RNA_Probe;
                case ID_SCE: return &RNA_Scene;
                case ID_SCR: return &RNA_Screen;
                case ID_SO: return &RNA_Sound;
diff --git a/source/blender/makesrna/intern/rna_object.c 
b/source/blender/makesrna/intern/rna_object.c
index f9786bc7366..c799bfc749c 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -419,6 +419,7 @@ static StructRNA *rna_Object_data_typef(PointerRNA *ptr)
                case OB_LATTICE: return &RNA_Lattice;
                case OB_ARMATURE: return &RNA_Armature;
                case OB_SPEAKER: return &RNA_Speaker;
+               case OB_PROBE: return &RNA_Probe;
                default: return &RNA_ID;
        }
 }
diff --git a/source/blender/makesrna/intern/rna_probe.c 
b/source/blender/makesrna/intern/rna_probe.c
index 0f4b44d6b66..b8dced149ca 100644
--- a/source/blender/makesrna/intern/rna_probe.c
+++ b/source/blender/makesrna/intern/rna_probe.c
@@ -45,6 +45,13 @@
 
 #else
 
+static EnumPropertyItem probe_type_items[] = {
+       {PROBE_CAPTURE, "CAPTURE", ICON_NONE, "Capture", ""},
+       {PROBE_PLANAR, "PLANAR", ICON_NONE, "Planar", ""},
+       {PROBE_CUSTOM, "CUSTOM", ICON_NONE, "Custom", ""},
+       {0, NULL, 0, NULL, NULL}
+};
+
 static void rna_def_probe(BlenderRNA *brna)
 {
        StructRNA *srna;
@@ -54,12 +61,21 @@ static void rna_def_probe(BlenderRNA *brna)
        RNA_def_struct_ui_text(srna, "Probe", "Probe data-block for lighting 
capture objects");
        RNA_def_struct_ui_icon(srna, ICON_RADIO);
 
-       // prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_NONE);
-       // RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-       // RNA_def_property_range(prop, 0.0f, 1.0f);
-       // RNA_def_property_ui_text(prop, "Maximum Volume", "Maximum volume, no 
matter how near the object is");
-       /* RNA_def_property_float_funcs(prop, NULL, 
"rna_Speaker_volume_max_set", NULL); */
-       /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
+       prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_items(prop, probe_type_items);
+       RNA_def_property_ui_text(prop, "Type", "Type of probe");
+       RNA_def_property_update(prop, 0, NULL); /* TODO */
+
+       prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
+       RNA_def_property_float_sdna(prop, NULL, "dist");
+       RNA_def_property_range(prop, 0.0f, 99999.0f);
+       RNA_def_property_ui_text(prop, "Distance", "All surface within this 
distance will recieve the probe lighting");
+       RNA_def_property_update(prop, 0, NULL); /* TODO */
+
+       prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_FACTOR);
+       RNA_def_property_range(prop, 0.0f, 1.0f);
+       RNA_def_property_ui_text(prop, "Falloff", "Control how fast the probe 
intensity decreases");
+       RNA_def_property_update(prop, 0, NULL

@@ Diff output truncated at 10240 characters. @@

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

Reply via email to