Blender V5.3
view3d_gizmo_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 "BLI_listbase.hh"
10#include "BLI_math_base_safe.hh"
11#include "BLI_math_matrix.hh"
12#include "BLI_math_matrix_c.hh"
13#include "BLI_math_vector_c.hh"
14#include "BLI_utildefines.hh"
15
16#include "BKE_context.hh"
17#include "BKE_layer.hh"
18#include "BKE_lib_id.hh"
19
20#include "DEG_depsgraph.hh"
21
22#include "DNA_light_types.h"
23#include "DNA_object_types.h"
24
25#include "ED_gizmo_library.hh"
26
27#include "UI_resources.hh"
28
29#include "MEM_guardedalloc.h"
30
31#include "RNA_access.hh"
32#include "RNA_prototypes.hh"
33
34#include "WM_api.hh"
35#include "WM_types.hh"
36
37#include "view3d_intern.hh" /* own include */
38
39namespace blender {
40
41/* -------------------------------------------------------------------- */
44/* NOTE: scaling from `overlay_extra.cc`. */
45#define CONE_SCALE 10.0f
46#define INV_CONE_SCALE 0.1f
47
53
54static void gizmo_spot_blend_prop_matrix_get(const wmGizmo * /*gz*/,
55 wmGizmoProperty *gz_prop,
56 void *value_p)
57{
58 BLI_assert(gz_prop->type->array_length == 16);
59 float (*matrix)[4] = static_cast<float (*)[4]>(value_p);
60
61 const bContext *C = static_cast<const bContext *>(gz_prop->custom_func.user_data);
62 const Main *bmain = CTX_data_main(C);
63 ViewLayer *view_layer = CTX_data_view_layer(C);
64 BKE_view_layer_synced_ensure(*bmain, CTX_data_scene(C), view_layer);
65 Light *la = id_cast<Light *>(BKE_view_layer_active_object_get(view_layer)->data);
66
67 float a = cosf(la->spotsize * 0.5f);
68 float b = la->spotblend;
69 /* Cosine of the angle where spot attenuation == 1. */
70 float c = (1.0f - a) * b + a;
71 /* Tangent. */
72 float t = sqrtf(1.0f - c * c) / c;
73
74 matrix[0][0] = 2.0f * CONE_SCALE * t * a;
75 matrix[1][1] = 2.0f * CONE_SCALE * t * a;
76}
77
79 wmGizmoProperty *gz_prop,
80 const FunctionRef<void(PointerRNA &ptr, PropertyRNA *prop, int index)> callback)
81{
82 bContext *C = static_cast<bContext *>(gz_prop->custom_func.user_data);
83 const Main *bmain = CTX_data_main(C);
84 Scene *scene = CTX_data_scene(C);
85 ViewLayer *view_layer = CTX_data_view_layer(C);
86 BKE_view_layer_synced_ensure(*bmain, scene, view_layer);
87 Light *la = id_cast<Light *>(BKE_view_layer_active_object_get(view_layer)->data);
88 PointerRNA light_ptr = RNA_pointer_create_discrete(&la->id, RNA_Light, la);
89 PropertyRNA *spot_blend_prop = RNA_struct_find_property(&light_ptr, "spot_blend");
90
91 callback(light_ptr, spot_blend_prop, 0);
92}
93
94static void gizmo_spot_blend_prop_matrix_set(const wmGizmo * /*gz*/,
95 wmGizmoProperty *gz_prop,
96 const void *value_p)
97{
98 const float (*matrix)[4] = static_cast<const float (*)[4]>(value_p);
99 BLI_assert(gz_prop->type->array_length == 16);
100
101 const bContext *C = static_cast<const bContext *>(gz_prop->custom_func.user_data);
102 const Main *bmain = CTX_data_main(C);
103 Scene *scene = CTX_data_scene(C);
104 ViewLayer *view_layer = CTX_data_view_layer(C);
105 BKE_view_layer_synced_ensure(*bmain, scene, view_layer);
106 Light *la = id_cast<Light *>(BKE_view_layer_active_object_get(view_layer)->data);
107
108 float a = cosf(la->spotsize * 0.5f);
109 float t = matrix[0][0] * 0.5f * INV_CONE_SCALE / a;
110 float c = 1.0f / sqrt(t * t + 1.0f);
111
112 float spot_blend = safe_divide(clamp_f(c - a, 0.0f, 1.0f - a), 1.0f - a);
113
114 PointerRNA light_ptr = RNA_pointer_create_discrete(&la->id, RNA_Light, la);
115 PropertyRNA *spot_blend_prop = RNA_struct_find_property(&light_ptr, "spot_blend");
116 RNA_property_float_set(&light_ptr, spot_blend_prop, spot_blend);
117
118 RNA_property_update_main(CTX_data_main(C), scene, &light_ptr, spot_blend_prop);
119}
120
121/* Used by spot light and point light. */
123 wmGizmoProperty *gz_prop,
124 const FunctionRef<void(PointerRNA &ptr, PropertyRNA *prop, int index)> callback)
125{
126 bContext *C = static_cast<bContext *>(gz_prop->custom_func.user_data);
127 const Main *bmain = CTX_data_main(C);
128 Scene *scene = CTX_data_scene(C);
129 ViewLayer *view_layer = CTX_data_view_layer(C);
130 BKE_view_layer_synced_ensure(*bmain, scene, view_layer);
131 Light *la = id_cast<Light *>(BKE_view_layer_active_object_get(view_layer)->data);
132 PointerRNA light_ptr = RNA_pointer_create_discrete(&la->id, RNA_Light, la);
133 PropertyRNA *radius_prop = RNA_struct_find_property(&light_ptr, "shadow_soft_size");
134
135 callback(light_ptr, radius_prop, 0);
136}
137
139 wmGizmoProperty *gz_prop,
140 void *value_p)
141{
142 BLI_assert(gz_prop->type->array_length == 16);
143 float (*matrix)[4] = static_cast<float (*)[4]>(value_p);
144
145 const bContext *C = static_cast<const bContext *>(gz_prop->custom_func.user_data);
146 const Main *bmain = CTX_data_main(C);
147 ViewLayer *view_layer = CTX_data_view_layer(C);
148 BKE_view_layer_synced_ensure(*bmain, CTX_data_scene(C), view_layer);
149 const Light *la = id_cast<const Light *>(BKE_view_layer_active_object_get(view_layer)->data);
150
151 const float diameter = 2.0f * la->radius;
152 matrix[0][0] = diameter;
153 matrix[1][1] = diameter;
154}
155
157 wmGizmoProperty *gz_prop,
158 const void *value_p)
159{
160 const float (*matrix)[4] = static_cast<const float (*)[4]>(value_p);
161 BLI_assert(gz_prop->type->array_length == 16);
162
163 const bContext *C = static_cast<const bContext *>(gz_prop->custom_func.user_data);
164 const Main *bmain = CTX_data_main(C);
165 Scene *scene = CTX_data_scene(C);
166 ViewLayer *view_layer = CTX_data_view_layer(C);
167 BKE_view_layer_synced_ensure(*bmain, scene, view_layer);
168 Light *la = id_cast<Light *>(BKE_view_layer_active_object_get(view_layer)->data);
169
170 const float radius = 0.5f * len_v3(matrix[0]);
171
172 PointerRNA light_ptr = RNA_pointer_create_discrete(&la->id, RNA_Light, la);
173 PropertyRNA *radius_prop = RNA_struct_find_property(&light_ptr, "shadow_soft_size");
174 RNA_property_float_set(&light_ptr, radius_prop, radius);
175
176 RNA_property_update_main(CTX_data_main(C), scene, &light_ptr, radius_prop);
177}
178
180{
181 View3D *v3d = CTX_wm_view3d(C);
183 return false;
184 }
186 return false;
187 }
188
189 const Main *bmain = CTX_data_main(C);
190 const Scene *scene = CTX_data_scene(C);
191 ViewLayer *view_layer = CTX_data_view_layer(C);
192 BKE_view_layer_synced_ensure(*bmain, scene, view_layer);
193 Base *base = BKE_view_layer_active_base_get(view_layer);
194 if (base && BASE_SELECTABLE(v3d, base)) {
195 const Object *ob = base->object;
196 if (ob->type == OB_LAMP) {
197 const Light *la = id_cast<Light *>(ob->data);
198 if (la->type == LA_SPOT) {
199 if (BKE_id_is_editable(CTX_data_main(C), &la->id)) {
200 return true;
201 }
202 }
203 }
204 }
205 return false;
206}
207
209{
211
212 gzgroup->customdata = ls_gzgroup;
213
214 /* Spot angle gizmo. */
215 {
216 ls_gzgroup->spot_angle = WM_gizmo_new("GIZMO_GT_arrow_3d", gzgroup, nullptr);
217 wmGizmo *gz = ls_gzgroup->spot_angle;
221 }
222
223 /* Spot blend gizmo. */
224 {
225 ls_gzgroup->spot_blend = WM_gizmo_new("GIZMO_GT_cage_2d", gzgroup, nullptr);
226 wmGizmo *gz = ls_gzgroup->spot_blend;
227 RNA_enum_set(gz->ptr,
228 "transform",
234
238 params.range_get_fn = nullptr;
240 params.user_data = (void *)C;
241 WM_gizmo_target_property_def_func(gz, "matrix", &params);
242 }
243
244 /* Spot radius gizmo. */
245 {
246 ls_gzgroup->spot_radius = WM_gizmo_new("GIZMO_GT_cage_2d", gzgroup, nullptr);
247 wmGizmo *gz = ls_gzgroup->spot_radius;
248 RNA_enum_set(gz->ptr,
249 "transform",
255
259 params.range_get_fn = nullptr;
261 params.user_data = (void *)C;
262 WM_gizmo_target_property_def_func(gz, "matrix", &params);
263 }
264
265 /* All gizmos must perform undo. */
266 for (wmGizmo &gz : gzgroup->gizmos) {
268 }
269}
270
272{
273 LightSpotWidgetGroup *ls_gzgroup = static_cast<LightSpotWidgetGroup *>(gzgroup->customdata);
274 const Main *bmain = CTX_data_main(C);
275 const Scene *scene = CTX_data_scene(C);
276 ViewLayer *view_layer = CTX_data_view_layer(C);
277 BKE_view_layer_synced_ensure(*bmain, scene, view_layer);
279 Light *la = id_cast<Light *>(ob->data);
280 const float4x4 &ob_mat = ob->object_to_world();
281
282 /* Spot angle gizmo. */
283 {
284 PointerRNA lamp_ptr = RNA_pointer_create_discrete(&la->id, RNA_Light, la);
285
286 wmGizmo *gz = ls_gzgroup->spot_angle;
287 float dir[3];
288 negate_v3_v3(dir, ob_mat.ptr()[2]);
291
292 const char *propname = "spot_size";
293 WM_gizmo_target_property_def_rna(gz, "offset", &lamp_ptr, propname, -1);
294 }
295
296 /* Spot blend gizmo. */
297 {
298 wmGizmo *gz = ls_gzgroup->spot_blend;
299
300 copy_m4_m4(gz->matrix_basis, ob_mat.ptr());
301
302 /* Move center to the cone base plane. */
303 float dir[3];
304 negate_v3_v3(dir, ob_mat.ptr()[2]);
305 mul_v3_fl(dir, CONE_SCALE * cosf(0.5f * la->spotsize));
306 add_v3_v3(gz->matrix_basis[3], dir);
307 }
308}
309
311{
312 LightSpotWidgetGroup *ls_gzgroup = static_cast<LightSpotWidgetGroup *>(gzgroup->customdata);
313 const Main *bmain = CTX_data_main(C);
314 ViewLayer *view_layer = CTX_data_view_layer(C);
315 BKE_view_layer_synced_ensure(*bmain, CTX_data_scene(C), view_layer);
317 const float4x4 &ob_mat = ob->object_to_world();
318
319 /* Spot radius gizmo. */
320 wmGizmo *gz = ls_gzgroup->spot_radius;
321
322 /* Draw circle in the screen space. */
323 RegionView3D *rv3d = static_cast<RegionView3D *>(CTX_wm_region(C)->regiondata);
325
327}
328
342
344
345/* -------------------------------------------------------------------- */
348
350{
351 const View3D *v3d = CTX_wm_view3d(C);
353 return false;
354 }
356 return false;
357 }
358
359 const Main *bmain = CTX_data_main(C);
360 const Scene *scene = CTX_data_scene(C);
361 ViewLayer *view_layer = CTX_data_view_layer(C);
362 BKE_view_layer_synced_ensure(*bmain, scene, view_layer);
363 const Base *base = BKE_view_layer_active_base_get(view_layer);
364 if (base && BASE_SELECTABLE(v3d, base)) {
365 const Object *ob = base->object;
366 if (ob->type == OB_LAMP) {
367 const Light *la = id_cast<const Light *>(ob->data);
368 if (la->type == LA_LOCAL) {
369 if (BKE_id_is_editable(CTX_data_main(C), &la->id)) {
370 return true;
371 }
372 }
373 }
374 }
375 return false;
376}
377
379{
381 wwrapper->gizmo = WM_gizmo_new("GIZMO_GT_cage_2d", gzgroup, nullptr);
382 /* Point radius gizmo. */
383 wmGizmo *gz = wwrapper->gizmo;
384 gzgroup->customdata = wwrapper;
385
386 RNA_enum_set(gz->ptr,
387 "transform",
393
397 params.range_get_fn = nullptr;
399 params.user_data = (void *)C;
400 WM_gizmo_target_property_def_func(gz, "matrix", &params);
401
402 /* All gizmos must perform undo. */
403 for (wmGizmo &gz_iter : gzgroup->gizmos) {
404 WM_gizmo_set_flag(&gz_iter, WM_GIZMO_NEEDS_UNDO, true);
405 }
406}
407
409{
410 wmGizmoWrapper *wwrapper = static_cast<wmGizmoWrapper *>(gzgroup->customdata);
411 const Main *bmain = CTX_data_main(C);
412 ViewLayer *view_layer = CTX_data_view_layer(C);
413 BKE_view_layer_synced_ensure(*bmain, CTX_data_scene(C), view_layer);
414 const Object *ob = BKE_view_layer_active_object_get(view_layer);
415 const float4x4 &ob_mat = ob->object_to_world();
416
417 /* Point radius gizmo. */
418 wmGizmo *gz = wwrapper->gizmo;
419
420 /* Draw circle in the screen space. */
421 const RegionView3D *rv3d = static_cast<const RegionView3D *>(CTX_wm_region(C)->regiondata);
423
425}
426
439
441
442/* -------------------------------------------------------------------- */
445
446/* scale callbacks */
447
449 wmGizmoProperty *gz_prop,
450 const FunctionRef<void(PointerRNA &ptr, PropertyRNA *prop, int index)> callback)
451{
452 Light *la = static_cast<Light *>(gz_prop->custom_func.user_data);
453 PointerRNA light_ptr = RNA_pointer_create_discrete(&la->id, RNA_Light, la);
454
455 PropertyRNA *area_size_prop = RNA_struct_find_property(&light_ptr, "size");
456 callback(light_ptr, area_size_prop, 0);
457
458 if (ELEM(la->area_shape, LA_AREA_RECT, LA_AREA_ELLIPSE)) {
459 area_size_prop = RNA_struct_find_property(&light_ptr, "size_y");
460 callback(light_ptr, area_size_prop, 0);
461 }
462}
463
464static void gizmo_area_light_prop_matrix_get(const wmGizmo * /*gz*/,
465 wmGizmoProperty *gz_prop,
466 void *value_p)
467{
468 BLI_assert(gz_prop->type->array_length == 16);
469 float (*matrix)[4] = static_cast<float (*)[4]>(value_p);
470 const Light *la = static_cast<const Light *>(gz_prop->custom_func.user_data);
471
472 matrix[0][0] = la->area_size;
473 matrix[1][1] = ELEM(la->area_shape, LA_AREA_RECT, LA_AREA_ELLIPSE) ? la->area_sizey :
474 la->area_size;
475}
476
477static void gizmo_area_light_prop_matrix_set(const wmGizmo * /*gz*/,
478 wmGizmoProperty *gz_prop,
479 const void *value_p)
480{
481 const float (*matrix)[4] = static_cast<const float (*)[4]>(value_p);
482 BLI_assert(gz_prop->type->array_length == 16);
483 Light *la = static_cast<Light *>(gz_prop->custom_func.user_data);
484
485 if (ELEM(la->area_shape, LA_AREA_RECT, LA_AREA_ELLIPSE)) {
486 la->area_size = len_v3(matrix[0]);
487 la->area_sizey = len_v3(matrix[1]);
488 }
489 else {
490 la->area_size = len_v3(matrix[0]);
491 }
492
495}
496
498{
499 View3D *v3d = CTX_wm_view3d(C);
501 return false;
502 }
504 return false;
505 }
506
507 const Main *bmain = CTX_data_main(C);
508 const Scene *scene = CTX_data_scene(C);
509 ViewLayer *view_layer = CTX_data_view_layer(C);
510 BKE_view_layer_synced_ensure(*bmain, scene, view_layer);
511 Base *base = BKE_view_layer_active_base_get(view_layer);
512 if (base && BASE_SELECTABLE(v3d, base)) {
513 const Object *ob = base->object;
514 if (ob->type == OB_LAMP) {
515 const Light *la = id_cast<Light *>(ob->data);
516 if (la->type == LA_AREA) {
517 if (BKE_id_is_editable(CTX_data_main(C), &la->id)) {
518 return true;
519 }
520 }
521 }
522 }
523 return false;
524}
525
526static void WIDGETGROUP_light_area_setup(const bContext * /*C*/, wmGizmoGroup *gzgroup)
527{
529 wwrapper->gizmo = WM_gizmo_new("GIZMO_GT_cage_2d", gzgroup, nullptr);
530 wmGizmo *gz = wwrapper->gizmo;
532
533 gzgroup->customdata = wwrapper;
534
536
539
540 /* All gizmos must perform undo. */
541 for (wmGizmo &gz_iter : gzgroup->gizmos) {
542 WM_gizmo_set_flag(&gz_iter, WM_GIZMO_NEEDS_UNDO, true);
543 }
544}
545
547{
548 wmGizmoWrapper *wwrapper = static_cast<wmGizmoWrapper *>(gzgroup->customdata);
549 const Main *bmain = CTX_data_main(C);
550 const Scene *scene = CTX_data_scene(C);
551 ViewLayer *view_layer = CTX_data_view_layer(C);
552 BKE_view_layer_synced_ensure(*bmain, scene, view_layer);
554 Light *la = id_cast<Light *>(ob->data);
555 const float4x4 &ob_mat = ob->object_to_world();
556 wmGizmo *gz = wwrapper->gizmo;
557
558 copy_m4_m4(gz->matrix_basis, ob_mat.ptr());
559
561 if (ELEM(la->area_shape, LA_AREA_SQUARE, LA_AREA_DISK)) {
563 }
564 RNA_enum_set(gz->ptr, "transform", flag);
565
566 /* need to set property here for undo. TODO: would prefer to do this in _init. */
570 params.range_get_fn = nullptr;
572 params.user_data = la;
573 WM_gizmo_target_property_def_func(gz, "matrix", &params);
574}
575
588
590
591/* -------------------------------------------------------------------- */
594
596{
597 View3D *v3d = CTX_wm_view3d(C);
599 return false;
600 }
602 return false;
603 }
604
605 const Main *bmain = CTX_data_main(C);
606 const Scene *scene = CTX_data_scene(C);
607 ViewLayer *view_layer = CTX_data_view_layer(C);
608 BKE_view_layer_synced_ensure(*bmain, scene, view_layer);
609 Base *base = BKE_view_layer_active_base_get(view_layer);
610 if (base && BASE_SELECTABLE(v3d, base)) {
611 const Object *ob = base->object;
612 if (BKE_id_is_editable(CTX_data_main(C), &ob->id)) {
613 if (ob->type == OB_LAMP) {
614 /* No need to check the light is editable, only the object is transformed. */
615 const Light *la = id_cast<Light *>(ob->data);
616 if (ELEM(la->type, LA_SUN, LA_SPOT, LA_AREA)) {
617 return true;
618 }
619 }
620#if 0
621 else if (ob->type == OB_CAMERA) {
622 return true;
623 }
624#endif
625 }
626 }
627 return false;
628}
629
630static void WIDGETGROUP_light_target_setup(const bContext * /*C*/, wmGizmoGroup *gzgroup)
631{
633 wwrapper->gizmo = WM_gizmo_new("GIZMO_GT_move_3d", gzgroup, nullptr);
634 wmGizmo *gz = wwrapper->gizmo;
635
636 gzgroup->customdata = wwrapper;
637
640
641 gz->scale_basis = 0.06f;
642
643 wmOperatorType *ot = WM_operatortype_find("OBJECT_OT_transform_axis_target", true);
644
647
648 WM_gizmo_operator_set(gz, 0, ot, nullptr);
649
650 /* The operator handles undo, no need to set #WM_GIZMO_NEEDS_UNDO. */
651}
652
654{
655 wmGizmoWrapper *wwrapper = static_cast<wmGizmoWrapper *>(gzgroup->customdata);
656 const Main *bmain = CTX_data_main(C);
657 const Scene *scene = CTX_data_scene(C);
658 ViewLayer *view_layer = CTX_data_view_layer(C);
659 BKE_view_layer_synced_ensure(*bmain, scene, view_layer);
661 const float4x4 &ob_mat = ob->object_to_world();
662 wmGizmo *gz = wwrapper->gizmo;
663
664 normalize_m4_m4(gz->matrix_basis, ob_mat.ptr());
666
667 if (ob->type == OB_LAMP) {
668 Light *la = id_cast<Light *>(ob->data);
669 if (la->type == LA_SPOT) {
670 /* Draw just past the light size angle gizmo. */
671 madd_v3_v3fl(gz->matrix_basis[3], gz->matrix_basis[2], -la->spotsize);
672 }
673 }
674 gz->matrix_offset[3][2] -= 23.0;
676}
677
679{
680 gzgt->name = "Target Light Widgets";
681 gzgt->idname = "VIEW3D_GGT_light_target";
682
684
689}
690
692
693} // namespace blender
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define C
Definition RandGen.cpp:29
#define ND_LIGHTING_DRAW
Definition WM_types.hh:527
#define NC_LAMP
Definition WM_types.hh:395
#define ELEM(...)
void get_color_3fv(int colorid, float col[3])
BMesh Iterators.
void WM_main_add_notifier(uint type, void *reference)
void WM_gizmo_set_matrix_rotation_from_z_axis(wmGizmo *gz, const float z_axis[3])
Definition wm_gizmo.cc:273
void * MEM_new_uninitialized(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
MINLINE void negate_v3_v3(float r[3], const float a[3])
void ED_gizmo_arrow3d_set_range_fac(wmGizmo *gz, const float range_fac)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
static void gizmo_light_radius_prop_matrix_get(const wmGizmo *, wmGizmoProperty *gz_prop, void *value_p)
static void WIDGETGROUP_light_point_setup(const bContext *C, wmGizmoGroup *gzgroup)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
void RNA_property_update_main(Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop)
void WM_gizmo_target_property_def_func(wmGizmo *gz, const char *idname, const wmGizmoPropertyFnParams *params)
void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
static void WIDGETGROUP_light_spot_setup(const bContext *C, wmGizmoGroup *gzgroup)
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
Base * BKE_view_layer_active_base_get(ViewLayer *view_layer)
@ TH_GIZMO_SECONDARY
void VIEW3D_GGT_light_point(wmGizmoGroupType *gzgt)
@ ED_GIZMO_CAGE_XFORM_FLAG_SCALE
@ ED_GIZMO_CAGE_XFORM_FLAG_SCALE_UNIFORM
MatBase< float, 4, 4 > float4x4
static void WIDGETGROUP_light_spot_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
ViewLayer * CTX_data_view_layer(const bContext *C)
MINLINE void mul_v3_fl(float r[3], float f)
@ ED_GIZMO_CAGE2D_STYLE_CIRCLE
void WM_gizmo_target_property_def_rna(wmGizmo *gz, const char *idname, PointerRNA *ptr, const char *propname, int index)
static void WIDGETGROUP_light_target_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
static bool WIDGETGROUP_light_spot_poll(const bContext *C, wmGizmoGroupType *)
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
static void WIDGETGROUP_light_target_setup(const bContext *, wmGizmoGroup *gzgroup)
static void WIDGETGROUP_light_spot_refresh(const bContext *C, wmGizmoGroup *gzgroup)
void WM_gizmo_set_flag(wmGizmo *gz, const int flag, const bool enable)
Definition wm_gizmo.cc:303
@ ED_GIZMO_ARROW_XFORM_FLAG_INVERTED
void DEG_id_tag_update(ID *id, unsigned int flags)
BMesh const char void * data
static void WIDGETGROUP_light_point_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
@ ED_GIZMO_MOVE_DRAW_FLAG_FILL
@ ED_GIZMO_MOVE_DRAW_FLAG_ALIGN_VIEW
PointerRNA * WM_gizmo_operator_set(wmGizmo *gz, int part_index, wmOperatorType *ot, IDProperty *properties)
Definition wm_gizmo.cc:199
sqrt(x)+1/max(0
bool BKE_view_layer_synced_ensure(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
static void gizmo_area_light_prop_matrix_set(const wmGizmo *, wmGizmoProperty *gz_prop, const void *value_p)
void unit_m4(float m[4][4])
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
void VIEW3D_GGT_light_spot(wmGizmoGroupType *gzgt)
@ V3D_GIZMO_SHOW_LIGHT_LOOK_AT
@ V3D_GIZMO_SHOW_LIGHT_SIZE
void VIEW3D_GGT_light_target(wmGizmoGroupType *gzgt)
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
wmGizmo * WM_gizmo_new(const StringRef idname, wmGizmoGroup *gzgroup, PointerRNA *properties)
Definition wm_gizmo.cc:97
static void gizmo_spot_blend_prop_matrix_set(const wmGizmo *, wmGizmoProperty *gz_prop, const void *value_p)
static void gizmo_area_light_foreach_rna_prop(wmGizmoProperty *gz_prop, const FunctionRef< void(PointerRNA &ptr, PropertyRNA *prop, int index)> callback)
@ WM_GIZMOGROUPTYPE_DEPTH_3D
@ WM_GIZMOGROUPTYPE_PERSISTENT
@ WM_GIZMO_DRAW_HOVER
@ WM_GIZMO_DRAW_OFFSET_SCALE
@ WM_GIZMO_NEEDS_UNDO
static void gizmo_spot_blend_foreach_rna_prop(wmGizmoProperty *gz_prop, const FunctionRef< void(PointerRNA &ptr, PropertyRNA *prop, int index)> callback)
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
MINLINE void add_v3_v3(float r[3], const float a[3])
void VIEW3D_GGT_light_area(wmGizmoGroupType *gzgt)
static bool WIDGETGROUP_light_area_poll(const bContext *C, wmGizmoGroupType *)
Main * CTX_data_main(const bContext *C)
static void gizmo_light_radius_prop_matrix_set(const wmGizmo *, wmGizmoProperty *gz_prop, const void *value_p)
@ ID_RECALC_PARAMETERS
Definition DNA_ID.h:1138
static void WIDGETGROUP_light_area_refresh(const bContext *C, wmGizmoGroup *gzgroup)
static void gizmo_spot_blend_prop_matrix_get(const wmGizmo *, wmGizmoProperty *gz_prop, void *value_p)
static bool WIDGETGROUP_light_point_poll(const bContext *C, wmGizmoGroupType *)
Scene * CTX_data_scene(const bContext *C)
wmKeyMap * WM_gizmogroup_setup_keymap_generic_maybe_drag(const wmGizmoGroupType *, wmKeyConfig *kc)
static void gizmo_area_light_prop_matrix_get(const wmGizmo *, wmGizmoProperty *gz_prop, void *value_p)
void copy_m4_m4(float m1[4][4], const float m2[4][4])
static void WIDGETGROUP_light_area_setup(const bContext *, wmGizmoGroup *gzgroup)
void normalize_m4_m4(float rmat[4][4], const float mat[4][4]) ATTR_NONNULL()
void WM_gizmo_set_matrix_location(wmGizmo *gz, const float origin[3])
Definition wm_gizmo.cc:283
static bool WIDGETGROUP_light_target_poll(const bContext *C, wmGizmoGroupType *)
bool BKE_id_is_editable(const Main *bmain, const ID *id)
Definition lib_id.cc:2782
static void gizmo_light_radius_foreach_rna_prop(wmGizmoProperty *gz_prop, const FunctionRef< void(PointerRNA &ptr, PropertyRNA *prop, int index)> callback)
MINLINE float safe_divide(float a, float b)
ARegion * CTX_wm_region(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
MINLINE float clamp_f(float value, float min, float max)
#define sqrtf
#define cosf
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
struct Object * object
const c_style_mat & ptr() const
eView3D_GizmoShowLight gizmo_show_light
eView3D_GizmoFlag gizmo_flag
wmGizmoGroupFnRefresh refresh
wmGizmoGroupFnSetupKeymap setup_keymap
wmGizmoGroupFnDrawPrepare draw_prepare
eWM_GizmoFlagGroupTypeFlag flag
ListBaseT< wmGizmo > gizmos
wmGizmoPropertyFnSet value_set_fn
wmGizmoPropertyFnRangeGet range_get_fn
wmGizmoPropertyFnGet value_get_fn
wmGizmoPropertyFnForeachRNAProp foreach_rna_prop_fn
const wmGizmoPropertyType * type
struct blender::wmGizmoProperty::@216011055122204070127377170176223170047224321165 custom_func
float matrix_basis[4][4]
float matrix_offset[4][4]
#define CONE_SCALE
#define INV_CONE_SCALE