Blender  V2.93
rna_lightprobe.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #include <stdlib.h>
22 
23 #include "RNA_define.h"
24 #include "RNA_enum_types.h"
25 
26 #include "rna_internal.h"
27 
28 #include "DNA_lightprobe_types.h"
29 
30 #include "WM_types.h"
31 
32 #ifdef RNA_RUNTIME
33 
34 # include "MEM_guardedalloc.h"
35 
36 # include "BKE_main.h"
37 # include "DEG_depsgraph.h"
38 
39 # include "DNA_collection_types.h"
40 # include "DNA_object_types.h"
41 
42 # include "WM_api.h"
43 
44 static void rna_LightProbe_recalc(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
45 {
47 }
48 
49 #else
50 
52  {LIGHTPROBE_SHAPE_ELIPSOID, "ELIPSOID", ICON_NONE, "Sphere", ""},
53  {LIGHTPROBE_SHAPE_BOX, "BOX", ICON_NONE, "Box", ""},
54  {0, NULL, 0, NULL, NULL},
55 };
56 
59  "CUBEMAP",
60  ICON_LIGHTPROBE_CUBEMAP,
61  "Reflection Cubemap",
62  "Capture reflections"},
63  {LIGHTPROBE_TYPE_PLANAR, "PLANAR", ICON_LIGHTPROBE_PLANAR, "Reflection Plane", ""},
65  "GRID",
66  ICON_LIGHTPROBE_GRID,
67  "Irradiance Volume",
68  "Volume used for precomputing indirect lighting"},
69  {0, NULL, 0, NULL, NULL},
70 };
71 
72 static void rna_def_lightprobe(BlenderRNA *brna)
73 {
74  StructRNA *srna;
75  PropertyRNA *prop;
76 
77  srna = RNA_def_struct(brna, "LightProbe", "ID");
79  srna, "LightProbe", "Light Probe data-block for lighting capture objects");
80  RNA_def_struct_ui_icon(srna, ICON_OUTLINER_DATA_LIGHTPROBE);
81 
82  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
84  RNA_def_property_ui_text(prop, "Type", "Type of light probe");
86 
87  prop = RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_DISTANCE);
88  RNA_def_property_float_sdna(prop, NULL, "clipsta");
89  RNA_def_property_range(prop, 1e-6f, FLT_MAX);
90  RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
92  prop, "Clip Start", "Probe clip start, below which objects will not appear in reflections");
93  RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
94 
95  prop = RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_DISTANCE);
96  RNA_def_property_float_sdna(prop, NULL, "clipend");
97  RNA_def_property_range(prop, 1e-6f, FLT_MAX);
98  RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
100  prop, "Clip End", "Probe clip end, beyond which objects will not appear in reflections");
101  RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
102 
103  prop = RNA_def_property(srna, "show_clip", PROP_BOOLEAN, PROP_NONE);
105  RNA_def_property_ui_text(prop, "Clipping", "Show the clipping distances in the 3D view");
107 
108  prop = RNA_def_property(srna, "influence_type", PROP_ENUM, PROP_NONE);
109  RNA_def_property_enum_sdna(prop, NULL, "attenuation_type");
111  RNA_def_property_ui_text(prop, "Type", "Type of influence volume");
113 
114  prop = RNA_def_property(srna, "show_influence", PROP_BOOLEAN, PROP_NONE);
116  RNA_def_property_ui_text(prop, "Influence", "Show the influence volume in the 3D view");
118 
119  prop = RNA_def_property(srna, "influence_distance", PROP_FLOAT, PROP_DISTANCE);
120  RNA_def_property_float_sdna(prop, NULL, "distinf");
121  RNA_def_property_range(prop, 0.0f, FLT_MAX);
122  RNA_def_property_ui_text(prop, "Influence Distance", "Influence distance of the probe");
124 
125  prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_FACTOR);
126  RNA_def_property_range(prop, 0.0f, 1.0f);
127  RNA_def_property_ui_text(prop, "Falloff", "Control how fast the probe influence decreases");
129 
130  prop = RNA_def_property(srna, "use_custom_parallax", PROP_BOOLEAN, PROP_NONE);
133  prop, "Use Custom Parallax", "Enable custom settings for the parallax correction volume");
135 
136  prop = RNA_def_property(srna, "show_parallax", PROP_BOOLEAN, PROP_NONE);
138  RNA_def_property_ui_text(prop, "Parallax", "Show the parallax correction volume in the 3D view");
140 
141  prop = RNA_def_property(srna, "parallax_type", PROP_ENUM, PROP_NONE);
143  RNA_def_property_ui_text(prop, "Type", "Type of parallax volume");
145 
146  prop = RNA_def_property(srna, "parallax_distance", PROP_FLOAT, PROP_DISTANCE);
147  RNA_def_property_float_sdna(prop, NULL, "distpar");
148  RNA_def_property_range(prop, 0.0f, FLT_MAX);
149  RNA_def_property_ui_text(prop, "Parallax Radius", "Lowest corner of the parallax bounding box");
151 
152  /* irradiance grid */
153  prop = RNA_def_property(srna, "grid_resolution_x", PROP_INT, PROP_NONE);
154  RNA_def_property_range(prop, 1, 256);
156  prop, "Resolution X", "Number of sample along the x axis of the volume");
157  RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
158 
159  prop = RNA_def_property(srna, "grid_resolution_y", PROP_INT, PROP_NONE);
160  RNA_def_property_range(prop, 1, 256);
162  prop, "Resolution Y", "Number of sample along the y axis of the volume");
163  RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
164 
165  prop = RNA_def_property(srna, "grid_resolution_z", PROP_INT, PROP_NONE);
166  RNA_def_property_range(prop, 1, 256);
168  prop, "Resolution Z", "Number of sample along the z axis of the volume");
169  RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
170 
171  prop = RNA_def_property(srna, "visibility_buffer_bias", PROP_FLOAT, PROP_NONE);
172  RNA_def_property_float_sdna(prop, NULL, "vis_bias");
173  RNA_def_property_range(prop, 0.001f, 9999.0f);
174  RNA_def_property_ui_range(prop, 0.001f, 5.0f, 1.0, 3);
175  RNA_def_property_ui_text(prop, "Visibility Bias", "Bias for reducing self shadowing");
177 
178  prop = RNA_def_property(srna, "visibility_bleed_bias", PROP_FLOAT, PROP_FACTOR);
179  RNA_def_property_float_sdna(prop, NULL, "vis_bleedbias");
180  RNA_def_property_range(prop, 0.0f, 1.0f);
182  prop, "Visibility Bleed Bias", "Bias for reducing light-bleed on variance shadow maps");
184 
185  prop = RNA_def_property(srna, "visibility_blur", PROP_FLOAT, PROP_FACTOR);
186  RNA_def_property_float_sdna(prop, NULL, "vis_blur");
187  RNA_def_property_range(prop, 0.0f, 1.0f);
188  RNA_def_property_ui_text(prop, "Visibility Blur", "Filter size of the visibility blur");
189  RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
190 
191  prop = RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
192  RNA_def_property_float_sdna(prop, NULL, "intensity");
193  RNA_def_property_range(prop, 0.0f, FLT_MAX);
194  RNA_def_property_ui_range(prop, 0.0f, 3.0f, 1.0, 3);
196  prop, "Intensity", "Modify the intensity of the lighting captured by this probe");
197  RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
198 
199  prop = RNA_def_property(srna, "visibility_collection", PROP_POINTER, PROP_NONE);
200  RNA_def_property_struct_type(prop, "Collection");
201  RNA_def_property_pointer_sdna(prop, NULL, "visibility_grp");
205  prop, "Visibility Collection", "Restrict objects visible for this probe");
206  RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
207 
208  prop = RNA_def_property(srna, "invert_visibility_collection", PROP_BOOLEAN, PROP_NONE);
211  RNA_def_property_ui_text(prop, "Invert Collection", "Invert visibility collection");
212  RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
213 
214  /* Data preview */
215  prop = RNA_def_property(srna, "show_data", PROP_BOOLEAN, PROP_NONE);
218  "Show Preview Plane",
219  "Show captured lighting data into the 3D view for debugging purpose");
221 
222  /* common */
224 }
225 
227 {
228  rna_def_lightprobe(brna);
229 }
230 
231 #endif
#define UNUSED(x)
void DEG_id_tag_update(struct ID *id, int flag)
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:611
Object groups, one object can be in many groups at once.
@ LIGHTPROBE_SHAPE_BOX
@ LIGHTPROBE_SHAPE_ELIPSOID
@ 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
@ LIGHTPROBE_TYPE_CUBE
@ LIGHTPROBE_TYPE_PLANAR
@ LIGHTPROBE_TYPE_GRID
Object is a sort of wrapper for general info.
Read Guarded memory(de)allocation.
@ PROP_FLOAT
Definition: RNA_types.h:75
@ PROP_BOOLEAN
Definition: RNA_types.h:73
@ PROP_ENUM
Definition: RNA_types.h:77
@ PROP_INT
Definition: RNA_types.h:74
@ PROP_POINTER
Definition: RNA_types.h:78
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition: RNA_types.h:297
@ PROP_EDITABLE
Definition: RNA_types.h:175
@ PROP_DISTANCE
Definition: RNA_types.h:135
@ PROP_NONE
Definition: RNA_types.h:113
@ PROP_FACTOR
Definition: RNA_types.h:131
#define ND_SHADING
Definition: WM_types.h:377
#define NC_MATERIAL
Definition: WM_types.h:281
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:2762
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
Definition: rna_define.c:2257
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
Definition: rna_define.c:1676
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
Definition: rna_define.c:1259
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
Definition: rna_define.c:1892
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
Definition: rna_define.c:1757
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
Definition: rna_define.c:1792
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
Definition: rna_define.c:2927
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
Definition: rna_define.c:1279
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1517
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
Definition: rna_define.c:1047
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2623
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
Definition: rna_define.c:1267
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1512
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2515
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
Definition: rna_define.c:1706
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
Definition: rna_define.c:1525
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:116
struct ID * owner_id
Definition: RNA_types.h:50
PointerRNA * ptr
Definition: wm_files.c:3157