Blender V5.0
rna_light.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cstdlib>
10
11#include "BLI_math_rotation.h"
12
13#include "BLT_translation.hh"
14
15#include "RNA_define.hh"
16#include "RNA_enum_types.hh"
17#include "RNA_types.hh"
18#include "rna_internal.hh"
19
20#include "DNA_light_types.h"
21
23
24#ifdef RNA_RUNTIME
25
26# include "MEM_guardedalloc.h"
27
29
30# include "BKE_context.hh"
31# include "BKE_light.h"
32# include "BKE_main.hh"
33# include "BKE_texture.h"
34
35# include "DEG_depsgraph.hh"
36
37# include "WM_api.hh"
38# include "WM_types.hh"
39
40# include "ED_node.hh"
41
42static StructRNA *rna_Light_refine(PointerRNA *ptr)
43{
44 Light *la = (Light *)ptr->data;
45
46 switch (la->type) {
47 case LA_LOCAL:
48 return &RNA_PointLight;
49 case LA_SUN:
50 return &RNA_SunLight;
51 case LA_SPOT:
52 return &RNA_SpotLight;
53 case LA_AREA:
54 return &RNA_AreaLight;
55 default:
56 return &RNA_Light;
57 }
58}
59
60static void rna_Light_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
61{
62 Light *la = (Light *)ptr->owner_id;
63
64 DEG_id_tag_update(&la->id, 0);
66}
67
68static void rna_Light_draw_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
69{
70 Light *la = (Light *)ptr->owner_id;
71
72 DEG_id_tag_update(&la->id, 0);
74}
75
76static void rna_Light_use_nodes_update(bContext *C, PointerRNA *ptr)
77{
78 Light *la = (Light *)ptr->data;
79 Main *bmain = CTX_data_main(C);
80
81 if (la->use_nodes && la->nodetree == nullptr) {
82 ED_node_shader_default(C, bmain, &la->id);
83 }
84
85 rna_Light_update(CTX_data_main(C), CTX_data_scene(C), ptr);
86}
87
88static void rna_Light_temperature_color_get(PointerRNA *ptr, float *color)
89{
90 Light *la = (Light *)ptr->data;
91
92 if (la->mode & LA_USE_TEMPERATURE) {
93 float rgb[4];
95
96 color[0] = rgb[0];
97 color[1] = rgb[1];
98 color[2] = rgb[2];
99 }
100 else {
101 copy_v3_fl(color, 1.0f);
102 }
103}
104
105static float rna_Light_area(Light *light, const float matrix_world[16])
106{
107 blender::float4x4 mat(matrix_world);
108 return BKE_light_area(*light, mat);
109}
110
111#else
112
113/* NOTE(@dingto): Don't define icons here,
114 * so they don't show up in the Light UI (properties editor). */
115
117 {LA_LOCAL, "POINT", 0, "Point", "Omnidirectional point light source"},
118 {LA_SUN, "SUN", 0, "Sun", "Constant direction parallel ray light source"},
119 {LA_SPOT, "SPOT", 0, "Spot", "Directional cone light source"},
120 {LA_AREA, "AREA", 0, "Area", "Directional area light source"},
121 {0, nullptr, 0, nullptr, nullptr},
122};
123
124static void rna_def_light_api(StructRNA *srna)
125{
126 FunctionRNA *func = RNA_def_function(srna, "area", "rna_Light_area");
128 "Compute light area based on type and shape. The normalize "
129 "option divides light intensity by this area");
130 PropertyRNA *parm = RNA_def_property(func, "matrix_world", PROP_FLOAT, PROP_MATRIX);
132 RNA_def_property_ui_text(parm, "", "Object to world space transformation matrix");
133 parm = RNA_def_property(func, "area", PROP_FLOAT, PROP_NONE);
134 RNA_def_function_return(func, parm);
135}
136
137static void rna_def_light(BlenderRNA *brna)
138{
139 StructRNA *srna;
140 PropertyRNA *prop;
141 static const float default_color[4] = {1.0f, 1.0f, 1.0f, 1.0f};
142
143 srna = RNA_def_struct(brna, "Light", "ID");
144 RNA_def_struct_sdna(srna, "Light");
145 RNA_def_struct_refine_func(srna, "rna_Light_refine");
146 RNA_def_struct_ui_text(srna, "Light", "Light data-block for lighting a scene");
148 RNA_def_struct_ui_icon(srna, ICON_LIGHT_DATA);
149
150 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
152 RNA_def_property_ui_text(prop, "Type", "Type of light");
154 RNA_def_property_update(prop, 0, "rna_Light_draw_update");
155
156 prop = RNA_def_property(srna, "use_temperature", PROP_BOOLEAN, PROP_NONE);
159 prop, "Use Temperature", "Use blackbody temperature to define a natural light color");
161 RNA_def_property_update(prop, 0, "rna_Light_draw_update");
162
163 prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
164 RNA_def_property_float_sdna(prop, nullptr, "r");
165 RNA_def_property_array(prop, 3);
166 RNA_def_property_float_array_default(prop, default_color);
167 RNA_def_property_ui_text(prop, "Color", "Light color");
168 RNA_def_property_update(prop, 0, "rna_Light_draw_update");
169
170 prop = RNA_def_property(srna, "temperature", PROP_FLOAT, PROP_COLOR_TEMPERATURE);
171 RNA_def_property_float_sdna(prop, nullptr, "temperature");
172 RNA_def_property_range(prop, 800.0f, 20000.0f);
173 RNA_def_property_ui_range(prop, 800.0f, 20000.0f, 400.0f, 1);
174 RNA_def_property_ui_text(prop, "Temperature", "Light color temperature in Kelvin");
175 RNA_def_property_update(prop, 0, "rna_Light_update");
176
177 prop = RNA_def_property(srna, "temperature_color", PROP_FLOAT, PROP_COLOR);
178 RNA_def_property_array(prop, 3);
180 RNA_def_property_float_funcs(prop, "rna_Light_temperature_color_get", nullptr, nullptr);
181 RNA_def_property_ui_text(prop, "Temperature Color", "Color from Temperature");
182 RNA_def_property_update(prop, 0, "rna_Light_draw_update");
183
184 prop = RNA_def_property(srna, "specular_factor", PROP_FLOAT, PROP_FACTOR);
185 RNA_def_property_float_sdna(prop, nullptr, "spec_fac");
186 RNA_def_property_range(prop, 0.0f, FLT_MAX);
187 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01, 2);
188 RNA_def_property_ui_text(prop, "Specular Factor", "Specular reflection multiplier");
189 RNA_def_property_update(prop, 0, "rna_Light_update");
190
191 prop = RNA_def_property(srna, "diffuse_factor", PROP_FLOAT, PROP_FACTOR);
192 RNA_def_property_float_sdna(prop, nullptr, "diff_fac");
193 RNA_def_property_range(prop, 0.0f, FLT_MAX);
194 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01, 2);
195 RNA_def_property_ui_text(prop, "Diffuse Factor", "Diffuse reflection multiplier");
196 RNA_def_property_update(prop, 0, "rna_Light_update");
197
198 prop = RNA_def_property(srna, "transmission_factor", PROP_FLOAT, PROP_FACTOR);
199 RNA_def_property_float_sdna(prop, nullptr, "transmission_fac");
200 RNA_def_property_range(prop, 0.0f, FLT_MAX);
201 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01, 2);
202 RNA_def_property_ui_text(prop, "Transmission Factor", "Transmission light multiplier");
203 RNA_def_property_update(prop, 0, "rna_Light_update");
204
205 prop = RNA_def_property(srna, "volume_factor", PROP_FLOAT, PROP_FACTOR);
206 RNA_def_property_float_sdna(prop, nullptr, "volume_fac");
207 RNA_def_property_range(prop, 0.0f, FLT_MAX);
208 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01, 2);
209 RNA_def_property_ui_text(prop, "Volume Factor", "Volume light multiplier");
210 RNA_def_property_update(prop, 0, "rna_Light_update");
211
212 prop = RNA_def_property(srna, "use_custom_distance", PROP_BOOLEAN, PROP_NONE);
215 "Custom Attenuation",
216 "Use custom attenuation distance instead of global light threshold");
217 RNA_def_property_update(prop, 0, "rna_Light_update");
218
219 prop = RNA_def_property(srna, "cutoff_distance", PROP_FLOAT, PROP_DISTANCE);
220 RNA_def_property_float_sdna(prop, nullptr, "att_dist");
221 RNA_def_property_range(prop, 0.0f, FLT_MAX);
222 RNA_def_property_ui_range(prop, 0.01f, 100.0f, 1.0, 2);
224 prop, "Cutoff Distance", "Distance at which the light influence will be set to 0");
225 RNA_def_property_update(prop, 0, "rna_Light_update");
226
227 prop = RNA_def_property(srna, "use_shadow", PROP_BOOLEAN, PROP_NONE);
228 RNA_def_property_boolean_sdna(prop, nullptr, "mode", LA_SHADOW);
229 RNA_def_property_update(prop, 0, "rna_Light_draw_update");
230
231 prop = RNA_def_property(srna, "exposure", PROP_FLOAT, PROP_FACTOR);
233 RNA_def_property_range(prop, -32.0f, 32.0f);
234 RNA_def_property_ui_range(prop, -10.0f, 10.0f, 1, 3);
236 prop,
237 "Exposure",
238 "Scales the power of the light exponentially, multiplying the intensity by 2^exposure");
239 RNA_def_property_update(prop, 0, "rna_Light_update");
240
241 prop = RNA_def_property(srna, "normalize", PROP_BOOLEAN, PROP_NONE);
245 "Normalize",
246 "Normalize intensity by light area, for consistent total light "
247 "output regardless of size and shape");
248 RNA_def_property_update(prop, 0, "rna_Light_draw_update");
249
250 /* nodes */
251 prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
252 RNA_def_property_pointer_sdna(prop, nullptr, "nodetree");
255 RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node based lights");
256
257 prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
258 RNA_def_property_boolean_sdna(prop, nullptr, "use_nodes", 1);
261 RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes to render the light");
262 RNA_def_property_update(prop, 0, "rna_Light_use_nodes_update");
263
264 /* common */
266 rna_def_light_api(srna);
267}
268
269static void rna_def_light_energy(StructRNA *srna, const short light_type)
270{
271 PropertyRNA *prop;
272
273 switch (light_type) {
274 case LA_SUN: {
275 /* Distant light strength has no unit defined,
276 * it's proportional to 'watt/m^2' and is not sensitive to scene unit scale. */
277 prop = RNA_def_property(srna, "energy", PROP_FLOAT, PROP_NONE);
278 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
280 prop, "Strength", "Sunlight strength in watts per meter squared (W/m²)");
282 RNA_def_property_update(prop, 0, "rna_Light_draw_update");
283 break;
284 }
285 case LA_SPOT: {
286 /* Lights with a location have radiometric power in Watts,
287 * which is sensitive to scene unit scale. */
288 prop = RNA_def_property(srna, "energy", PROP_FLOAT, PROP_NONE);
289 RNA_def_property_ui_range(prop, 0.0f, 1000000.0f, 10, 3);
291 prop,
292 "Power",
293 "The energy this light would emit over its entire area "
294 "if it wasn't limited by the spot angle, in units of radiant power (W)");
296 RNA_def_property_update(prop, 0, "rna_Light_draw_update");
297 break;
298 }
299 default: {
300 /* Lights with a location have radiometric power in Watts,
301 * which is sensitive to scene unit scale. */
302 prop = RNA_def_property(srna, "energy", PROP_FLOAT, PROP_NONE);
303 RNA_def_property_ui_range(prop, 0.0f, 1000000.0f, 10, 3);
305 "Power",
306 "Light energy emitted over the entire area of the light in all "
307 "directions, in units of radiant power (W)");
309 RNA_def_property_update(prop, 0, "rna_Light_draw_update");
310 break;
311 }
312 }
313}
314
315static void rna_def_light_shadow(StructRNA *srna, bool sun)
316{
317 PropertyRNA *prop;
318
319 prop = RNA_def_property(srna, "shadow_buffer_clip_start", PROP_FLOAT, PROP_DISTANCE);
320 RNA_def_property_float_sdna(prop, nullptr, "clipsta");
321 RNA_def_property_range(prop, 1e-6f, FLT_MAX);
322 RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
324 "Shadow Buffer Clip Start",
325 "Shadow map clip start, below which objects will not generate shadows");
326 RNA_def_property_update(prop, 0, "rna_Light_draw_update");
327
328 prop = RNA_def_property(srna, "shadow_soft_size", PROP_FLOAT, PROP_DISTANCE);
329 RNA_def_property_float_sdna(prop, nullptr, "radius");
330 RNA_def_property_range(prop, 0.0f, FLT_MAX);
331 RNA_def_property_ui_range(prop, 0, 100, 0.1, 3);
333 prop, "Shadow Soft Size", "Light size for ray shadow sampling (Raytraced shadows)");
334 RNA_def_property_update(prop, 0, "rna_Light_draw_update");
335
336 /* Eevee */
337 prop = RNA_def_property(srna, "shadow_filter_radius", PROP_FLOAT, PROP_NONE);
338 RNA_def_property_range(prop, 0.0f, FLT_MAX);
339 RNA_def_property_ui_range(prop, 0.0f, 5.0f, 1.0f, 2);
341 prop, "Shadow Filter Radius", "Blur shadow aliasing using Percentage Closer Filtering");
343 RNA_def_property_update(prop, 0, "rna_Light_update");
344
345 prop = RNA_def_property(srna, "shadow_maximum_resolution", PROP_FLOAT, PROP_DISTANCE);
346 RNA_def_property_range(prop, 0.0f, FLT_MAX);
347 RNA_def_property_ui_range(prop, 0.0001f, 0.020f, 0.05f, 4);
349 "Shadows Resolution Limit",
350 "Minimum size of a shadow map pixel. Higher values use less memory at "
351 "the cost of shadow quality.");
353 RNA_def_property_update(prop, 0, "rna_Light_update");
354
355 prop = RNA_def_property(srna, "use_shadow_jitter", PROP_BOOLEAN, PROP_NONE);
356 RNA_def_property_boolean_sdna(prop, nullptr, "mode", LA_SHADOW_JITTER);
358 prop,
359 "Shadow Jitter",
360 "Enable jittered soft shadows to increase shadow precision (disabled in viewport unless "
361 "enabled in the render settings). Has a high performance impact.");
363 RNA_def_property_update(prop, 0, "rna_Light_update");
364
365 prop = RNA_def_property(srna, "shadow_jitter_overblur", PROP_FLOAT, PROP_PERCENTAGE);
366 RNA_def_property_range(prop, 0.0f, 100.0f);
367 RNA_def_property_ui_range(prop, 0.0f, 20.0f, 10.0f, 0);
369 prop,
370 "Shadow Jitter Overblur",
371 "Apply shadow tracing to each jittered sample to reduce under-sampling artifacts");
373 RNA_def_property_update(prop, 0, "rna_Light_update");
374
375 if (sun) {
376 prop = RNA_def_property(srna, "shadow_cascade_max_distance", PROP_FLOAT, PROP_DISTANCE);
377 RNA_def_property_float_sdna(prop, nullptr, "cascade_max_dist");
378 RNA_def_property_range(prop, 0.0f, FLT_MAX);
380 "Cascade Max Distance",
381 "End distance of the cascaded shadow map (only in perspective view)");
382 RNA_def_property_update(prop, 0, "rna_Light_update");
383
384 prop = RNA_def_property(srna, "shadow_cascade_count", PROP_INT, PROP_NONE);
385 RNA_def_property_int_sdna(prop, nullptr, "cascade_count");
386 RNA_def_property_range(prop, 1, 4);
388 prop, "Cascade Count", "Number of texture used by the cascaded shadow map");
389 RNA_def_property_update(prop, 0, "rna_Light_update");
390
391 prop = RNA_def_property(srna, "shadow_cascade_exponent", PROP_FLOAT, PROP_FACTOR);
392 RNA_def_property_float_sdna(prop, nullptr, "cascade_exponent");
393 RNA_def_property_range(prop, 0.0f, 1.0f);
395 "Exponential Distribution",
396 "Higher value increase resolution towards the viewpoint");
397 RNA_def_property_update(prop, 0, "rna_Light_update");
398
399 prop = RNA_def_property(srna, "shadow_cascade_fade", PROP_FLOAT, PROP_FACTOR);
400 RNA_def_property_float_sdna(prop, nullptr, "cascade_fade");
401 RNA_def_property_range(prop, 0.0f, 1.0f);
403 prop, "Cascade Fade", "How smooth is the transition between each cascade");
404 RNA_def_property_update(prop, 0, "rna_Light_update");
405 }
406 else {
407 prop = RNA_def_property(srna, "use_absolute_resolution", PROP_BOOLEAN, PROP_NONE);
410 "Absolute Resolution Limit",
411 "Limit the resolution at 1 unit from the light origin instead of "
412 "relative to the shadowed pixel");
414 RNA_def_property_update(prop, 0, "rna_Light_update");
415 }
416}
417
419{
420 StructRNA *srna;
421
422 srna = RNA_def_struct(brna, "PointLight", "Light");
423 RNA_def_struct_sdna(srna, "Light");
424 RNA_def_struct_ui_text(srna, "Point Light", "Omnidirectional point Light");
425 RNA_def_struct_ui_icon(srna, ICON_LIGHT_POINT);
426
427 PropertyRNA *prop;
428 prop = RNA_def_property(srna, "use_soft_falloff", PROP_BOOLEAN, PROP_NONE);
431 prop,
432 "Soft Falloff",
433 "Apply falloff to avoid sharp edges when the light geometry intersects with other objects");
434 RNA_def_property_update(prop, 0, "rna_Light_draw_update");
435
437 rna_def_light_shadow(srna, false);
438}
439
441{
442 StructRNA *srna;
443 PropertyRNA *prop;
444
445 static const EnumPropertyItem prop_areashape_items[] = {
446 {LA_AREA_SQUARE, "SQUARE", 0, "Square", ""},
447 {LA_AREA_RECT, "RECTANGLE", 0, "Rectangle", ""},
448 {LA_AREA_DISK, "DISK", 0, "Disk", ""},
449 {LA_AREA_ELLIPSE, "ELLIPSE", 0, "Ellipse", ""},
450 {0, nullptr, 0, nullptr, nullptr},
451 };
452
453 srna = RNA_def_struct(brna, "AreaLight", "Light");
454 RNA_def_struct_sdna(srna, "Light");
455 RNA_def_struct_ui_text(srna, "Area Light", "Directional area Light");
456 RNA_def_struct_ui_icon(srna, ICON_LIGHT_AREA);
457
459 rna_def_light_shadow(srna, false);
460
461 prop = RNA_def_property(srna, "shape", PROP_ENUM, PROP_NONE);
462 RNA_def_property_enum_sdna(prop, nullptr, "area_shape");
463 RNA_def_property_enum_items(prop, prop_areashape_items);
464 RNA_def_property_ui_text(prop, "Shape", "Shape of the area Light");
465 RNA_def_property_update(prop, 0, "rna_Light_draw_update");
466
467 prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_DISTANCE);
468 RNA_def_property_float_sdna(prop, nullptr, "area_size");
469 RNA_def_property_range(prop, 0.0f, FLT_MAX);
470 RNA_def_property_ui_range(prop, 0, 100, 0.1, 3);
472 prop, "Size", "Size of the area of the area light, X direction size for rectangle shapes");
473 RNA_def_property_update(prop, 0, "rna_Light_draw_update");
474
475 prop = RNA_def_property(srna, "size_y", PROP_FLOAT, PROP_DISTANCE);
476 RNA_def_property_float_sdna(prop, nullptr, "area_sizey");
477 RNA_def_property_range(prop, 0.0f, FLT_MAX);
478 RNA_def_property_ui_range(prop, 0, 100, 0.1, 3);
480 prop,
481 "Size Y",
482 "Size of the area of the area light in the Y direction for rectangle shapes");
483 RNA_def_property_update(prop, 0, "rna_Light_draw_update");
484
485 prop = RNA_def_property(srna, "spread", PROP_FLOAT, PROP_ANGLE);
486 RNA_def_property_float_sdna(prop, nullptr, "area_spread");
487 RNA_def_property_range(prop, DEG2RADF(0.0f), DEG2RADF(180.0f));
489 prop,
490 "Spread",
491 "How widely the emitted light fans out, as in the case of a gridded softbox");
492 RNA_def_property_update(prop, 0, "rna_Light_draw_update");
493}
494
496{
497 StructRNA *srna;
498 PropertyRNA *prop;
499
500 srna = RNA_def_struct(brna, "SpotLight", "Light");
501 RNA_def_struct_sdna(srna, "Light");
502 RNA_def_struct_ui_text(srna, "Spot Light", "Directional cone Light");
503 RNA_def_struct_ui_icon(srna, ICON_LIGHT_SPOT);
504
506 rna_def_light_shadow(srna, false);
507
508 prop = RNA_def_property(srna, "use_square", PROP_BOOLEAN, PROP_NONE);
509 RNA_def_property_boolean_sdna(prop, nullptr, "mode", LA_SQUARE);
510 RNA_def_property_ui_text(prop, "Square", "Cast a square spot light shape");
511 RNA_def_property_update(prop, 0, "rna_Light_draw_update");
512
513 prop = RNA_def_property(srna, "spot_blend", PROP_FLOAT, PROP_NONE);
514 RNA_def_property_float_sdna(prop, nullptr, "spotblend");
515 RNA_def_property_range(prop, 0.0f, 1.0f);
516 RNA_def_property_ui_text(prop, "Spot Blend", "The softness of the spotlight edge");
517 RNA_def_property_update(prop, 0, "rna_Light_draw_update");
518
519 prop = RNA_def_property(srna, "spot_size", PROP_FLOAT, PROP_ANGLE);
520 RNA_def_property_float_sdna(prop, nullptr, "spotsize");
521 RNA_def_property_range(prop, DEG2RADF(1.0f), DEG2RADF(180.0f));
522 RNA_def_property_ui_text(prop, "Beam Angle", "Angular diameter of the spotlight beam");
523 RNA_def_property_update(prop, 0, "rna_Light_draw_update");
524
525 prop = RNA_def_property(srna, "show_cone", PROP_BOOLEAN, PROP_NONE);
526 RNA_def_property_boolean_sdna(prop, nullptr, "mode", LA_SHOW_CONE);
528 prop,
529 "Show Cone",
530 "Display transparent cone in 3D view to visualize which objects are contained in it");
531 RNA_def_property_update(prop, 0, "rna_Light_draw_update");
532
533 prop = RNA_def_property(srna, "use_soft_falloff", PROP_BOOLEAN, PROP_NONE);
536 prop,
537 "Soft Falloff",
538 "Apply falloff to avoid sharp edges when the light geometry intersects with other objects");
539 RNA_def_property_update(prop, 0, "rna_Light_draw_update");
540}
541
543{
544 StructRNA *srna;
545 PropertyRNA *prop;
546
547 srna = RNA_def_struct(brna, "SunLight", "Light");
548 RNA_def_struct_sdna(srna, "Light");
549 RNA_def_struct_ui_text(srna, "Sun Light", "Constant direction parallel ray Light");
550 RNA_def_struct_ui_icon(srna, ICON_LIGHT_SUN);
551
552 prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
553 RNA_def_property_float_sdna(prop, nullptr, "sun_angle");
554 RNA_def_property_range(prop, DEG2RADF(0.0f), DEG2RADF(180.0f));
555 RNA_def_property_ui_text(prop, "Angle", "Angular diameter of the Sun as seen from the Earth");
556 RNA_def_property_update(prop, 0, "rna_Light_update");
557
559 rna_def_light_shadow(srna, true);
560}
561
563{
564 rna_def_light(brna);
566 rna_def_area_light(brna);
567 rna_def_spot_light(brna);
568 rna_def_sun_light(brna);
569}
570
571#endif
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
General operations, lookup, etc. for blender lights.
float BKE_light_area(const Light &light, const blender::float4x4 &object_to_world)
#define DEG2RADF(_deg)
MINLINE void copy_v3_fl(float r[3], float f)
#define BLT_I18NCONTEXT_ID_LIGHT
void DEG_id_tag_update(ID *id, unsigned int flags)
@ LA_AREA
@ LA_LOCAL
@ LA_SPOT
@ LA_SUN
@ LA_USE_TEMPERATURE
@ LA_SHAD_RES_ABSOLUTE
@ LA_CUSTOM_ATTENUATION
@ LA_SQUARE
@ LA_SHOW_CONE
@ LA_UNNORMALIZED
@ LA_SHADOW_JITTER
@ LA_SHADOW
@ LA_USE_SOFT_FALLOFF
@ LA_AREA_ELLIPSE
@ LA_AREA_SQUARE
@ LA_AREA_RECT
@ LA_AREA_DISK
void ED_node_shader_default(const bContext *C, Main *bmain, ID *id)
Definition node_edit.cc:513
void IMB_colormanagement_blackbody_temperature_to_rgb(float r_dest[4], float value)
Read Guarded memory(de)allocation.
@ PROP_FLOAT
Definition RNA_types.hh:164
@ PROP_BOOLEAN
Definition RNA_types.hh:162
@ PROP_ENUM
Definition RNA_types.hh:166
@ PROP_INT
Definition RNA_types.hh:163
@ PROP_POINTER
Definition RNA_types.hh:167
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition RNA_types.hh:503
@ PROP_CONTEXT_UPDATE
Definition RNA_types.hh:407
@ PROP_ANIMATABLE
Definition RNA_types.hh:319
@ PROP_EDITABLE
Definition RNA_types.hh:306
@ PROP_PTR_NO_OWNERSHIP
Definition RNA_types.hh:395
@ PROP_MATRIX
Definition RNA_types.hh:265
@ PROP_DISTANCE
Definition RNA_types.hh:256
@ PROP_COLOR
Definition RNA_types.hh:260
@ PROP_ANGLE
Definition RNA_types.hh:252
@ PROP_COLOR_TEMPERATURE
Definition RNA_types.hh:290
@ PROP_NONE
Definition RNA_types.hh:233
@ PROP_PERCENTAGE
Definition RNA_types.hh:250
@ PROP_FACTOR
Definition RNA_types.hh:251
#define C
Definition RandGen.cpp:29
#define ND_LIGHTING_DRAW
Definition WM_types.hh:484
#define NC_LAMP
Definition WM_types.hh:382
#define ND_LIGHTING
Definition WM_types.hh:483
MatBase< float, 4, 4 > float4x4
const EnumPropertyItem rna_enum_light_type_items[]
void rna_def_animdata_common(StructRNA *srna)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_struct_refine_func(StructRNA *srna, const char *refine)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_float_default(PropertyRNA *prop, float value)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[])
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
void RNA_def_property_array(PropertyRNA *prop, int length)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
const int rna_matrix_dimsize_4x4[]
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_struct_translation_context(StructRNA *srna, const char *context)
void RNA_def_property_float_array_default(PropertyRNA *prop, const float *array)
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
static void rna_def_area_light(BlenderRNA *brna)
Definition rna_light.cc:440
void RNA_def_light(BlenderRNA *brna)
Definition rna_light.cc:562
static void rna_def_sun_light(BlenderRNA *brna)
Definition rna_light.cc:542
static void rna_def_light_shadow(StructRNA *srna, bool sun)
Definition rna_light.cc:315
static void rna_def_light_api(StructRNA *srna)
Definition rna_light.cc:124
static void rna_def_point_light(BlenderRNA *brna)
Definition rna_light.cc:418
static void rna_def_light_energy(StructRNA *srna, const short light_type)
Definition rna_light.cc:269
static void rna_def_spot_light(BlenderRNA *brna)
Definition rna_light.cc:495
static void rna_def_light(BlenderRNA *brna)
Definition rna_light.cc:137
#define FLT_MAX
Definition stdcycles.h:14
void WM_main_add_notifier(uint type, void *reference)
PointerRNA * ptr
Definition wm_files.cc:4238