Blender  V3.3
rna_lightprobe.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #include <stdlib.h>
8 
9 #include "RNA_define.h"
10 #include "RNA_enum_types.h"
11 
12 #include "rna_internal.h"
13 
14 #include "DNA_lightprobe_types.h"
15 
16 #include "WM_types.h"
17 
18 #ifdef RNA_RUNTIME
19 
20 # include "MEM_guardedalloc.h"
21 
22 # include "BKE_main.h"
23 # include "DEG_depsgraph.h"
24 
25 # include "DNA_collection_types.h"
26 # include "DNA_object_types.h"
27 
28 # include "WM_api.h"
29 
30 static void rna_LightProbe_recalc(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
31 {
33 }
34 
35 #else
36 
38  {LIGHTPROBE_SHAPE_ELIPSOID, "ELIPSOID", ICON_NONE, "Sphere", ""},
39  {LIGHTPROBE_SHAPE_BOX, "BOX", ICON_NONE, "Box", ""},
40  {0, NULL, 0, NULL, NULL},
41 };
42 
45  "CUBEMAP",
46  ICON_LIGHTPROBE_CUBEMAP,
47  "Reflection Cubemap",
48  "Capture reflections"},
49  {LIGHTPROBE_TYPE_PLANAR, "PLANAR", ICON_LIGHTPROBE_PLANAR, "Reflection Plane", ""},
51  "GRID",
52  ICON_LIGHTPROBE_GRID,
53  "Irradiance Volume",
54  "Volume used for precomputing indirect lighting"},
55  {0, NULL, 0, NULL, NULL},
56 };
57 
58 static void rna_def_lightprobe(BlenderRNA *brna)
59 {
60  StructRNA *srna;
61  PropertyRNA *prop;
62 
63  srna = RNA_def_struct(brna, "LightProbe", "ID");
65  srna, "LightProbe", "Light Probe data-block for lighting capture objects");
66  RNA_def_struct_ui_icon(srna, ICON_OUTLINER_DATA_LIGHTPROBE);
67 
68  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
70  RNA_def_property_ui_text(prop, "Type", "Type of light probe");
72 
73  prop = RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_DISTANCE);
74  RNA_def_property_float_sdna(prop, NULL, "clipsta");
75  RNA_def_property_range(prop, 1e-6f, FLT_MAX);
76  RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
78  prop, "Clip Start", "Probe clip start, below which objects will not appear in reflections");
79  RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
80 
81  prop = RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_DISTANCE);
82  RNA_def_property_float_sdna(prop, NULL, "clipend");
83  RNA_def_property_range(prop, 1e-6f, FLT_MAX);
84  RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
86  prop, "Clip End", "Probe clip end, beyond which objects will not appear in reflections");
87  RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
88 
89  prop = RNA_def_property(srna, "show_clip", PROP_BOOLEAN, PROP_NONE);
91  RNA_def_property_ui_text(prop, "Clipping", "Show the clipping distances in the 3D view");
93 
94  prop = RNA_def_property(srna, "influence_type", PROP_ENUM, PROP_NONE);
95  RNA_def_property_enum_sdna(prop, NULL, "attenuation_type");
97  RNA_def_property_ui_text(prop, "Type", "Type of influence volume");
99 
100  prop = RNA_def_property(srna, "show_influence", PROP_BOOLEAN, PROP_NONE);
102  RNA_def_property_ui_text(prop, "Influence", "Show the influence volume in the 3D view");
104 
105  prop = RNA_def_property(srna, "influence_distance", PROP_FLOAT, PROP_DISTANCE);
106  RNA_def_property_float_sdna(prop, NULL, "distinf");
107  RNA_def_property_range(prop, 0.0f, FLT_MAX);
108  RNA_def_property_ui_text(prop, "Influence Distance", "Influence distance of the probe");
110 
111  prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_FACTOR);
112  RNA_def_property_range(prop, 0.0f, 1.0f);
113  RNA_def_property_ui_text(prop, "Falloff", "Control how fast the probe influence decreases");
115 
116  prop = RNA_def_property(srna, "use_custom_parallax", PROP_BOOLEAN, PROP_NONE);
119  prop, "Use Custom Parallax", "Enable custom settings for the parallax correction volume");
121 
122  prop = RNA_def_property(srna, "show_parallax", PROP_BOOLEAN, PROP_NONE);
124  RNA_def_property_ui_text(prop, "Parallax", "Show the parallax correction volume in the 3D view");
126 
127  prop = RNA_def_property(srna, "parallax_type", PROP_ENUM, PROP_NONE);
129  RNA_def_property_ui_text(prop, "Type", "Type of parallax volume");
131 
132  prop = RNA_def_property(srna, "parallax_distance", PROP_FLOAT, PROP_DISTANCE);
133  RNA_def_property_float_sdna(prop, NULL, "distpar");
134  RNA_def_property_range(prop, 0.0f, FLT_MAX);
135  RNA_def_property_ui_text(prop, "Parallax Radius", "Lowest corner of the parallax bounding box");
137 
138  /* irradiance grid */
139  prop = RNA_def_property(srna, "grid_resolution_x", PROP_INT, PROP_NONE);
140  RNA_def_property_range(prop, 1, 256);
142  prop, "Resolution X", "Number of sample along the x axis of the volume");
143  RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
144 
145  prop = RNA_def_property(srna, "grid_resolution_y", PROP_INT, PROP_NONE);
146  RNA_def_property_range(prop, 1, 256);
148  prop, "Resolution Y", "Number of sample along the y axis of the volume");
149  RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
150 
151  prop = RNA_def_property(srna, "grid_resolution_z", PROP_INT, PROP_NONE);
152  RNA_def_property_range(prop, 1, 256);
154  prop, "Resolution Z", "Number of sample along the z axis of the volume");
155  RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
156 
157  prop = RNA_def_property(srna, "visibility_buffer_bias", PROP_FLOAT, PROP_NONE);
158  RNA_def_property_float_sdna(prop, NULL, "vis_bias");
159  RNA_def_property_range(prop, 0.001f, 9999.0f);
160  RNA_def_property_ui_range(prop, 0.001f, 5.0f, 1.0, 3);
161  RNA_def_property_ui_text(prop, "Visibility Bias", "Bias for reducing self shadowing");
163 
164  prop = RNA_def_property(srna, "visibility_bleed_bias", PROP_FLOAT, PROP_FACTOR);
165  RNA_def_property_float_sdna(prop, NULL, "vis_bleedbias");
166  RNA_def_property_range(prop, 0.0f, 1.0f);
168  prop, "Visibility Bleed Bias", "Bias for reducing light-bleed on variance shadow maps");
170 
171  prop = RNA_def_property(srna, "visibility_blur", PROP_FLOAT, PROP_FACTOR);
172  RNA_def_property_float_sdna(prop, NULL, "vis_blur");
173  RNA_def_property_range(prop, 0.0f, 1.0f);
174  RNA_def_property_ui_text(prop, "Visibility Blur", "Filter size of the visibility blur");
175  RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
176 
177  prop = RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
178  RNA_def_property_float_sdna(prop, NULL, "intensity");
179  RNA_def_property_range(prop, 0.0f, FLT_MAX);
180  RNA_def_property_ui_range(prop, 0.0f, 3.0f, 1.0, 3);
182  prop, "Intensity", "Modify the intensity of the lighting captured by this probe");
183  RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
184 
185  prop = RNA_def_property(srna, "visibility_collection", PROP_POINTER, PROP_NONE);
186  RNA_def_property_struct_type(prop, "Collection");
187  RNA_def_property_pointer_sdna(prop, NULL, "visibility_grp");
191  prop, "Visibility Collection", "Restrict objects visible for this probe");
192  RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
193 
194  prop = RNA_def_property(srna, "invert_visibility_collection", PROP_BOOLEAN, PROP_NONE);
197  RNA_def_property_ui_text(prop, "Invert Collection", "Invert visibility collection");
198  RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
199 
200  /* Data preview */
201  prop = RNA_def_property(srna, "show_data", PROP_BOOLEAN, PROP_NONE);
204  "Show Preview Plane",
205  "Show captured lighting data into the 3D view for debugging purpose");
207 
208  /* common */
210 }
211 
213 {
214  rna_def_lightprobe(brna);
215 }
216 
217 #endif
#define UNUSED(x)
void DEG_id_tag_update(struct ID *id, int flag)
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:791
Object groups, one object can be in many groups at once.
@ LIGHTPROBE_SHAPE_BOX
@ LIGHTPROBE_SHAPE_ELIPSOID
@ LIGHTPROBE_TYPE_CUBE
@ LIGHTPROBE_TYPE_PLANAR
@ LIGHTPROBE_TYPE_GRID
@ LIGHTPROBE_FLAG_SHOW_PARALLAX
@ LIGHTPROBE_FLAG_SHOW_CLIP_DIST
@ LIGHTPROBE_FLAG_SHOW_INFLUENCE
@ LIGHTPROBE_FLAG_INVERT_GROUP
@ LIGHTPROBE_FLAG_SHOW_DATA
@ LIGHTPROBE_FLAG_CUSTOM_PARALLAX
Object is a sort of wrapper for general info.
Read Guarded memory(de)allocation.
@ PROP_FLOAT
Definition: RNA_types.h:61
@ PROP_BOOLEAN
Definition: RNA_types.h:59
@ PROP_ENUM
Definition: RNA_types.h:63
@ PROP_INT
Definition: RNA_types.h:60
@ PROP_POINTER
Definition: RNA_types.h:64
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition: RNA_types.h:312
@ PROP_EDITABLE
Definition: RNA_types.h:189
@ PROP_DISTANCE
Definition: RNA_types.h:149
@ PROP_NONE
Definition: RNA_types.h:126
@ PROP_FACTOR
Definition: RNA_types.h:144
#define ND_SHADING
Definition: WM_types.h:425
#define NC_MATERIAL
Definition: WM_types.h:330
Scene scene
void rna_def_animdata_common(StructRNA *srna)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2740
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
Definition: rna_define.c:2236
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
Definition: rna_define.c:1645
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
Definition: rna_define.c:1237
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
Definition: rna_define.c:1872
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
Definition: rna_define.c:1737
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
Definition: rna_define.c:1772
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
Definition: rna_define.c:2900
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
Definition: rna_define.c:1257
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1495
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
Definition: rna_define.c:1028
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2601
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
Definition: rna_define.c:1245
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1490
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2493
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
Definition: rna_define.c:1664
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
Definition: rna_define.c:1503
void RNA_def_lightprobe(BlenderRNA *brna)
static EnumPropertyItem parallax_type_items[]
static EnumPropertyItem lightprobe_type_items[]
static void rna_def_lightprobe(BlenderRNA *brna)
Definition: BKE_main.h:121
struct ID * owner_id
Definition: RNA_types.h:36
PointerRNA * ptr
Definition: wm_files.c:3480