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