Blender V5.3
wm_gizmo.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2014 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "MEM_guardedalloc.h"
10
11#include "BLI_listbase.hh"
12#include "BLI_math_matrix_c.hh"
13#include "BLI_math_vector_c.hh"
14
15#include "BKE_context.hh"
16
17#include "RNA_access.hh"
18#include "RNA_define.hh"
19#include "RNA_prototypes.hh"
20
21#include "BKE_global.hh"
22#include "BKE_idprop.hh"
23#include "BKE_main.hh"
24
25#include "WM_api.hh"
26#include "WM_toolsystem.hh"
27#include "WM_types.hh"
28
29#include "ED_screen.hh"
30#include "ED_view3d.hh"
31
32#ifdef WITH_PYTHON
33# include "BPY_extern.hh"
34#endif
35
36/* Own includes. */
37#include "wm_gizmo_intern.hh"
38#include "wm_gizmo_wmapi.hh"
39
40namespace blender {
41
42static void wm_gizmo_register(wmGizmoGroup *gzgroup, wmGizmo *gz);
43
47static wmGizmo *wm_gizmo_create(const wmGizmoType *gzt, PointerRNA *properties)
48{
49 BLI_assert(gzt != nullptr);
50 BLI_assert(gzt->struct_size >= sizeof(wmGizmo));
51
52 /* FIXME: Old C-style allocation is not trivial to port to C++ here, because actual allocation
53 * depends on the 'subtype' of gizmo. The whole gizmo type hierarchy should probably be moved to
54 * proper C++ virtual inheritance at some point. */
55 wmGizmo *gz = static_cast<wmGizmo *>(MEM_new_zeroed(gzt->struct_size, __func__));
56 new (gz) wmGizmo();
57 gz->type = gzt;
58
59 /* Initialize properties, either copy or create. */
60 gz->ptr = MEM_new<PointerRNA>("wmGizmoPtrRNA");
61 if (properties && properties->data) {
62 gz->properties = IDP_CopyProperty(static_cast<const IDProperty *>(properties->data));
63 }
64 else {
65 gz->properties = bke::idprop::create_group("wmGizmoProperties").release();
66 }
67 *gz->ptr = RNA_pointer_create_discrete(&G_MAIN->wm.first()->id, gzt->srna, gz->properties);
68
70
74
75 gz->drag_part = -1;
76
77 /* Only ensure expected size for the target properties array. Actual initialization of these
78 * happen separately (see e.g. #WM_gizmo_target_property_def_rna and related). */
80
81 return gz;
82}
83
84wmGizmo *WM_gizmo_new_ptr(const wmGizmoType *gzt, wmGizmoGroup *gzgroup, PointerRNA *properties)
85{
86 wmGizmo *gz = wm_gizmo_create(gzt, properties);
87
88 wm_gizmo_register(gzgroup, gz);
89
90 if (gz->type->setup != nullptr) {
91 gz->type->setup(gz);
92 }
93
94 return gz;
95}
96
97wmGizmo *WM_gizmo_new(const StringRef idname, wmGizmoGroup *gzgroup, PointerRNA *properties)
98{
99 const wmGizmoType *gzt = WM_gizmotype_find(idname, false);
100 return WM_gizmo_new_ptr(gzt, gzgroup, properties);
101}
102
106static void gizmo_init(wmGizmo *gz)
107{
108 const float color_default[4] = {1.0f, 1.0f, 1.0f, 1.0f};
109
110 gz->scale_basis = 1.0f;
111 gz->line_width = 1.0f;
112
113 /* Defaults. */
114 copy_v4_v4(gz->color, color_default);
115 copy_v4_v4(gz->color_hi, color_default);
116}
117
123static void wm_gizmo_register(wmGizmoGroup *gzgroup, wmGizmo *gz)
124{
125 gizmo_init(gz);
126 wm_gizmogroup_gizmo_register(gzgroup, gz);
127}
128
130{
131 if (gz->type->free != nullptr) {
132 gz->type->free(gz);
133 }
134
135#ifdef WITH_PYTHON
136 if (gz->py_instance) {
137 /* Do this first in case there are any `__del__` functions or
138 * similar that use properties. */
140 }
141#endif
142
143 for (wmGizmoOpElem &gzop : gz->op_data) {
145 }
146
147 if (gz->ptr != nullptr) {
149 MEM_delete(gz->ptr);
150 }
151
152 for (wmGizmoProperty &gz_prop : gz->target_properties) {
153 if (gz_prop.custom_func.free_fn) {
154 gz_prop.custom_func.free_fn(gz, &gz_prop);
155 }
156 }
157
158 MEM_delete(gz);
159}
160
161void WM_gizmo_unlink(ListBaseT<wmGizmo> *gizmolist, wmGizmoMap *gzmap, wmGizmo *gz, bContext *C)
162{
164 wm_gizmomap_highlight_set(gzmap, C, nullptr, 0);
165 }
166 if (gz->state & WM_GIZMO_STATE_MODAL) {
167 wm_gizmomap_modal_set(gzmap, C, gz, nullptr, false);
168 }
169 /* Unlink instead of setting so we don't run callbacks. */
170 if (gz->state & WM_GIZMO_STATE_SELECT) {
171 WM_gizmo_select_unlink(gzmap, gz);
172 }
173
174 if (gizmolist) {
175 BLI_remlink(gizmolist, gz);
176 }
177
178 BLI_assert(gzmap->gzmap_context.highlight != gz);
179 BLI_assert(gzmap->gzmap_context.modal != gz);
180
181 WM_gizmo_free(gz);
182}
183
184/* -------------------------------------------------------------------- */
190
192{
193 if ((part_index >= 0) && (part_index < gz->op_data.size())) {
194 return &gz->op_data[part_index];
195 }
196 return nullptr;
197}
198
200 int part_index,
201 wmOperatorType *ot,
202 IDProperty *properties)
203{
204 BLI_assert(part_index < 255);
205 if (part_index >= gz->op_data.size()) {
206 gz->op_data.resize(part_index + 1);
207 }
208 wmGizmoOpElem &gzop = gz->op_data[part_index];
209 gzop.type = ot;
210
211 if (gzop.ptr) {
213 }
215
216 if (properties) {
217 gzop.ptr.data = properties;
218 }
219
220 return &gzop.ptr;
221}
222
224 wmGizmo *gz,
225 wmGizmoOpElem *gzop,
226 const wmEvent *event)
227{
229 /* Merge tool-settings into the gizmo properties. */
230 PointerRNA tref_ptr;
232 if (tref && WM_toolsystem_ref_properties_get_from_operator(tref, gzop->type, &tref_ptr)) {
233 if (!gzop->ptr) {
234 gzop->ptr.data = bke::idprop::create_group("wmOperatorProperties").release();
235 }
236 IDP_MergeGroup(static_cast<IDProperty *>(gzop->ptr.data),
237 static_cast<const IDProperty *>(tref_ptr.data),
238 false);
239 }
240 }
242 C, gzop->type, wm::OpCallContext::InvokeDefault, &gzop->ptr, event);
243}
244
246 const float z_axis[3])
247{
248/* Old code, seems we can use simpler method. */
249#if 0
250 const float z_global[3] = {0.0f, 0.0f, 1.0f};
251 float rot[3][3];
252
253 rotation_between_vecs_to_mat3(rot, z_global, z_axis);
254 copy_v3_v3(matrix[0], rot[0]);
255 copy_v3_v3(matrix[1], rot[1]);
256 copy_v3_v3(matrix[2], rot[2]);
257#else
258 normalize_v3_v3(matrix[2], z_axis);
259 ortho_basis_v3v3_v3(matrix[0], matrix[1], matrix[2]);
260#endif
261}
262
264 const float y_axis[3],
265 const float z_axis[3])
266{
267 normalize_v3_v3(matrix[1], y_axis);
268 normalize_v3_v3(matrix[2], z_axis);
269 cross_v3_v3v3(matrix[0], matrix[1], matrix[2]);
270 normalize_v3(matrix[0]);
271}
272
278 const float y_axis[3],
279 const float z_axis[3])
280{
282}
283void WM_gizmo_set_matrix_location(wmGizmo *gz, const float origin[3])
284{
285 copy_v3_v3(gz->matrix_basis[3], origin);
286}
287
293 const float y_axis[3],
294 const float z_axis[3])
295{
297}
298void WM_gizmo_set_matrix_offset_location(wmGizmo *gz, const float offset[3])
299{
300 copy_v3_v3(gz->matrix_offset[3], offset);
301}
302
303void WM_gizmo_set_flag(wmGizmo *gz, const int flag, const bool enable)
304{
305 if (enable) {
306 gz->flag |= eWM_GizmoFlag(flag);
307 }
308 else {
309 gz->flag &= ~eWM_GizmoFlag(flag);
310 }
311}
312
313void WM_gizmo_set_scale(wmGizmo *gz, const float scale)
314{
315 gz->scale_basis = scale;
316}
317
318void WM_gizmo_set_line_width(wmGizmo *gz, const float line_width)
319{
320 gz->line_width = line_width;
321}
322
323void WM_gizmo_get_color(const wmGizmo *gz, float color[4])
324{
325 copy_v4_v4(color, gz->color);
326}
327void WM_gizmo_set_color(wmGizmo *gz, const float color[4])
328{
329 copy_v4_v4(gz->color, color);
330}
331
332void WM_gizmo_get_color_highlight(const wmGizmo *gz, float color_hi[4])
333{
334 copy_v4_v4(color_hi, gz->color_hi);
335}
336void WM_gizmo_set_color_highlight(wmGizmo *gz, const float color_hi[4])
337{
338 copy_v4_v4(gz->color_hi, color_hi);
339}
340 /* Gizmo Creation API. */
342
343/* -------------------------------------------------------------------- */
346
351
353
354/* -------------------------------------------------------------------- */
355
357 wmGizmoMap *gzmap, wmGizmo *gz, bool select, bool use_array, bool use_callback)
358{
359 bool changed = false;
360
361 if (select) {
362 if ((gz->state & WM_GIZMO_STATE_SELECT) == 0) {
363 if (use_array) {
365 }
367 changed = true;
368 }
369 }
370 else {
371 if (gz->state & WM_GIZMO_STATE_SELECT) {
372 if (use_array) {
374 }
376 changed = true;
377 }
378 }
379
380 /* In the case of unlinking we only want to remove from the array
381 * and not write to the external state. */
382 if (use_callback && changed) {
383 if (gz->type->select_refresh) {
384 gz->type->select_refresh(gz);
385 }
386 }
387
388 return changed;
389}
390
392{
393 return wm_gizmo_select_set_ex(gzmap, gz, false, true, false);
394}
395
397{
398 return wm_gizmo_select_set_ex(gzmap, gz, select, true, true);
399}
400
402{
403 return wm_gizmomap_highlight_set(gzmap, nullptr, gz, gz ? gz->highlight_part : 0);
404}
405
407{
408 if (WM_gizmo_select_set(gzmap, gz, true)) {
410 return true;
411 }
412 return false;
413}
414
416 wmGizmoMap *gzmap, bContext *C, wmGizmo *gz, int part_index, const wmEvent *event)
417{
418 gz->highlight_part = part_index;
419 WM_gizmo_highlight_set(gzmap, gz);
420 if (false) {
421 wm_gizmomap_modal_set(gzmap, C, gz, event, true);
422 }
423 else {
424 /* WEAK: but it works. */
426 C, "GIZMOGROUP_OT_gizmo_tweak", wm::OpCallContext::InvokeDefault, nullptr, event);
427 }
428}
429
431 bContext *C,
432 wmGizmo *gz,
433 const wmEvent *event)
434{
435 if (gzmap->gzmap_context.modal) {
436 wm_gizmomap_modal_set(gzmap, C, gzmap->gzmap_context.modal, event, false);
437 }
438
439 if (gz) {
441
442 /* Set `highlight_part` to -1 to skip operator invocation. */
443 const int highlight_part = gz->highlight_part;
444 gz->highlight_part = -1;
445 wm_gizmomap_modal_set(gzmap, C, gz, event, true);
446 gz->highlight_part = highlight_part;
447 }
448}
449
451{
452 const RegionView3D *rv3d = CTX_wm_region_view3d(C);
453 float scale = UI_SCALE_FAC;
454
455 if ((gz->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_SCALE) == 0) {
456 scale *= U.gizmo_size;
457 if (rv3d) {
458 /* #ED_view3d_pixel_size includes #U.pixelsize, remove it. */
459 float matrix_world[4][4];
460 if (gz->type->matrix_basis_get) {
461 float matrix_basis[4][4];
462 gz->type->matrix_basis_get(gz, matrix_basis);
463 mul_m4_m4m4(matrix_world, gz->matrix_space, matrix_basis);
464 }
465 else {
466 mul_m4_m4m4(matrix_world, gz->matrix_space, gz->matrix_basis);
467 }
468
469 /* Exclude matrix_offset from scale. */
470 scale *= ED_view3d_pixel_size_no_ui_scale(rv3d, matrix_world[3]);
471 }
472 }
473
474 gz->scale_final = gz->scale_basis * scale;
475}
476
478{
479 /* Gizmo property might have been changed, so update gizmo. */
480 if (gz->type->property_update) {
481 for (wmGizmoProperty &gz_prop : gz->target_properties) {
482 if (WM_gizmo_target_property_is_valid(&gz_prop)) {
483 gz->type->property_update(gz, &gz_prop);
484 }
485 }
486 }
487}
488
489void wm_gizmo_update(wmGizmo *gz, const bContext *C, const bool refresh_map)
490{
491 if (refresh_map) {
493 }
495}
496
498{
499 if (gz->flag & WM_GIZMO_HIDDEN) {
500 return 0;
501 }
502 if ((gz->state & WM_GIZMO_STATE_MODAL) &&
504 {
505 /* Don't draw while modal (dragging). */
506 return 0;
507 }
508 if ((gz->flag & WM_GIZMO_DRAW_HOVER) && !(gz->state & WM_GIZMO_STATE_HIGHLIGHT) &&
509 /* Still draw selected gizmos. */
511 {
512 /* Update but don't draw. */
514 }
515
517}
518
520 const wmGizmoMatrixParams *params,
521 float r_mat[4][4])
522{
523 const float (*const matrix_space)[4] = params->matrix_space ? params->matrix_space :
524 gz->matrix_space;
525 const float (*const matrix_basis)[4] = params->matrix_basis ? params->matrix_basis :
526 gz->matrix_basis;
527 const float (*const matrix_offset)[4] = params->matrix_offset ? params->matrix_offset :
528 gz->matrix_offset;
529 const float *scale_final = params->scale_final ? params->scale_final : &gz->scale_final;
530
531 float final_matrix[4][4];
532 if (params->matrix_basis == nullptr && gz->type->matrix_basis_get) {
533 gz->type->matrix_basis_get(gz, final_matrix);
534 }
535 else {
536 copy_m4_m4(final_matrix, matrix_basis);
537 }
538
539 if (gz->flag & WM_GIZMO_DRAW_NO_SCALE) {
540 mul_m4_m4m4(final_matrix, final_matrix, matrix_offset);
541 }
542 else {
544 mul_mat3_m4_fl(final_matrix, *scale_final);
545 mul_m4_m4m4(final_matrix, final_matrix, matrix_offset);
546 }
547 else {
548 mul_m4_m4m4(final_matrix, final_matrix, matrix_offset);
549 mul_mat3_m4_fl(final_matrix, *scale_final);
550 }
551 }
552
553 mul_m4_m4m4(r_mat, matrix_space, final_matrix);
554}
555
556void WM_gizmo_calc_matrix_final_no_offset(const wmGizmo *gz, float r_mat[4][4])
557{
558 float mat_identity[4][4];
559 unit_m4(mat_identity);
560
561 wmGizmoMatrixParams params{};
562 params.matrix_space = nullptr;
563 params.matrix_basis = nullptr;
564 params.matrix_offset = mat_identity;
565 params.scale_final = nullptr;
566 WM_gizmo_calc_matrix_final_params(gz, &params, r_mat);
567}
568
569void WM_gizmo_calc_matrix_final(const wmGizmo *gz, float r_mat[4][4])
570{
571 wmGizmoMatrixParams params{};
572 params.matrix_space = nullptr;
573 params.matrix_basis = nullptr;
574 params.matrix_offset = nullptr;
575 params.scale_final = nullptr;
576 WM_gizmo_calc_matrix_final_params(gz, &params, r_mat);
577}
578
579/* -------------------------------------------------------------------- */
585
587{
588 *ptr = RNA_pointer_create_discrete(nullptr, gzt->srna, nullptr);
589}
590
592{
593 const wmGizmoType *gzt = WM_gizmotype_find(gtstring, false);
594
595 if (gzt) {
596 WM_gizmo_properties_create_ptr(ptr, const_cast<wmGizmoType *>(gzt));
597 }
598 else {
599 *ptr = RNA_pointer_create_discrete(nullptr, RNA_GizmoProperties, nullptr);
600 }
601}
602
603void WM_gizmo_properties_alloc(PointerRNA **ptr, IDProperty **properties, const StringRef gtstring)
604{
605 if (*properties == nullptr) {
606 *properties = bke::idprop::create_group("wmOpItemProp").release();
607 }
608
609 if (*ptr == nullptr) {
610 *ptr = MEM_new<PointerRNA>("wmOpItemPtr");
611 WM_gizmo_properties_create(*ptr, gtstring);
612 }
613
614 (*ptr)->data = *properties;
615}
616
617void WM_gizmo_properties_sanitize(PointerRNA *ptr, const bool no_context)
618{
619 RNA_STRUCT_BEGIN (ptr, prop) {
620 switch (RNA_property_type(prop)) {
621 case PROP_ENUM:
622 if (no_context) {
624 }
625 else {
627 }
628 break;
629 case PROP_POINTER: {
630 StructRNA *ptype = RNA_property_pointer_type(ptr, prop);
631
632 /* Recurse into gizmo properties. */
633 if (RNA_struct_is_a(ptype, RNA_GizmoProperties)) {
634 PointerRNA opptr = RNA_property_pointer_get(ptr, prop);
635 WM_gizmo_properties_sanitize(&opptr, no_context);
636 }
637 break;
638 }
639 default:
640 break;
641 }
642 }
644}
645
646bool WM_gizmo_properties_default(PointerRNA *ptr, const bool do_update)
647{
648 bool changed = false;
649 RNA_STRUCT_BEGIN (ptr, prop) {
650 switch (RNA_property_type(prop)) {
651 case PROP_POINTER: {
652 StructRNA *ptype = RNA_property_pointer_type(ptr, prop);
653 if (ptype != RNA_Struct) {
654 PointerRNA opptr = RNA_property_pointer_get(ptr, prop);
655 changed |= WM_gizmo_properties_default(&opptr, do_update);
656 }
657 break;
658 }
659 default:
660 if ((do_update == false) || (RNA_property_is_set(ptr, prop) == false)) {
661 if (RNA_property_reset(nullptr, ptr, prop, -1)) {
662 changed = true;
663 }
664 }
665 break;
666 }
667 }
669
670 return changed;
671}
672
674{
675 if (*gz->ptr) {
676 PropertyRNA *iterprop;
677 iterprop = RNA_struct_iterator_property(gz->type->srna);
678
679 RNA_PROP_BEGIN (gz->ptr, itemptr, iterprop) {
680 PropertyRNA *prop = static_cast<PropertyRNA *>(itemptr.data);
681
682 if ((RNA_property_flag(prop) & PROP_SKIP_SAVE) == 0) {
683 const char *identifier = RNA_property_identifier(prop);
684 RNA_struct_system_idprops_unset(gz->ptr, identifier);
685 }
686 }
688 }
689}
690
692{
693 IDProperty *properties = static_cast<IDProperty *>(ptr->data);
694
695 if (properties) {
696 IDP_ClearProperty(properties);
697 }
698}
699
701{
702 IDProperty *properties = static_cast<IDProperty *>(ptr->data);
703
704 if (properties) {
705 IDP_FreeProperty(properties);
706 ptr->data = nullptr; /* Just in case. */
707 }
708}
709
711
712/* -------------------------------------------------------------------- */
715
717{
719 if (gz && gz->parent_gzgroup == gzgroup) {
720 return true;
721 }
722 return false;
723}
724
726{
727 switch (step) {
729 break;
730 }
734 return false;
735 }
736 break;
737 }
738 }
739 return true;
740}
741
743
744} // namespace blender
#define G_MAIN
#define UI_SCALE_FAC
Read Blender memory allocation and freeing.
#define RNA_PROP_END
#define RNA_STRUCT_BEGIN(sptr, prop)
#define RNA_STRUCT_END
#define RNA_PROP_BEGIN(sptr, itemptr, prop)
#define C
Definition RandGen.cpp:29
#define WM_toolsystem_ref_properties_get_from_operator(tref, ot, r_ptr)
#define rot(x, k)
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
float3x3 scale(float3x3 mat, float2 scale)
std::unique_ptr< IDProperty, IDPropertyDeleter > create_group(StringRef prop_name, eIDPropertyFlag flags={})
Allocate a new IDProperty of type IDP_GROUP.
BMesh Iterators.
void WM_gizmo_free(wmGizmo *gz)
Definition wm_gizmo.cc:129
void WM_gizmo_set_matrix_rotation_from_z_axis(wmGizmo *gz, const float z_axis[3])
Definition wm_gizmo.cc:273
UserDef U
Definition blender.cc:58
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void BPY_DECREF_RNA_INVALIDATE(void *pyob_ptr)
PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
void WM_gizmo_modal_set_from_setup(wmGizmoMap *gzmap, bContext *C, wmGizmo *gz, int part_index, const wmEvent *event)
Definition wm_gizmo.cc:415
void WM_gizmo_properties_alloc(PointerRNA **ptr, IDProperty **properties, const StringRef gtstring)
Definition wm_gizmo.cc:603
static void wm_gizmo_register(wmGizmoGroup *gzgroup, wmGizmo *gz)
Definition wm_gizmo.cc:123
void wm_gizmomap_select_array_remove(wmGizmoMap *gzmap, wmGizmo *gz)
void WM_gizmo_get_color_highlight(const wmGizmo *gz, float color_hi[4])
Definition wm_gizmo.cc:332
wmGizmo * WM_gizmomap_get_modal(const wmGizmoMap *gzmap)
static void wm_gizmo_set_matrix_rotation_from_z_axis__internal(float matrix[4][4], const float z_axis[3])
Definition wm_gizmo.cc:245
bool RNA_struct_is_a(const StructRNA *type, const StructRNA *srna)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void WM_gizmo_set_matrix_rotation_from_yz_axis(wmGizmo *gz, const float y_axis[3], const float z_axis[3])
Definition wm_gizmo.cc:277
bool RNA_property_reset(Main *bmain, PointerRNA *ptr, PropertyRNA *prop, int index)
void WM_operator_properties_free(PointerRNA *ptr)
void WM_gizmo_set_color(wmGizmo *gz, const float color[4])
Definition wm_gizmo.cc:327
const char * RNA_property_identifier(const PropertyRNA *prop)
void WM_gizmo_modal_set_while_modal(wmGizmoMap *gzmap, bContext *C, wmGizmo *gz, const wmEvent *event)
Definition wm_gizmo.cc:430
const wmGizmoType * WM_gizmotype_find(const StringRef idname, bool quiet)
IDProperty * IDP_CopyProperty(const IDProperty *prop) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition idprop.cc:986
void wm_gizmogroup_gizmo_register(wmGizmoGroup *gzgroup, wmGizmo *gz)
wmOperatorStatus WM_gizmo_operator_invoke(bContext *C, wmGizmo *gz, wmGizmoOpElem *gzop, const wmEvent *event)
Definition wm_gizmo.cc:223
void WM_gizmo_calc_matrix_final_params(const wmGizmo *gz, const wmGizmoMatrixParams *params, float r_mat[4][4])
Definition wm_gizmo.cc:519
void mul_mat3_m4_fl(float R[4][4], float f)
void WM_gizmo_properties_create(PointerRNA *ptr, const StringRef gtstring)
Definition wm_gizmo.cc:591
PointerRNA WM_operator_properties_create_ptr(wmOperatorType *ot)
void WM_gizmo_calc_matrix_final_no_offset(const wmGizmo *gz, float r_mat[4][4])
Definition wm_gizmo.cc:556
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void WM_gizmo_set_color_highlight(wmGizmo *gz, const float color_hi[4])
Definition wm_gizmo.cc:336
void WM_gizmo_calc_matrix_final(const wmGizmo *gz, float r_mat[4][4])
Definition wm_gizmo.cc:569
void WM_gizmo_get_color(const wmGizmo *gz, float color[4])
Definition wm_gizmo.cc:323
PropertyRNA * RNA_struct_iterator_property(StructRNA *type)
void WM_gizmo_set_matrix_offset_location(wmGizmo *gz, const float offset[3])
Definition wm_gizmo.cc:298
bool WM_gizmo_highlight_set(wmGizmoMap *gzmap, wmGizmo *gz)
Definition wm_gizmo.cc:401
void WM_gizmo_set_line_width(wmGizmo *gz, const float line_width)
Definition wm_gizmo.cc:318
void wm_gizmo_calculate_scale(wmGizmo *gz, const bContext *C)
Definition wm_gizmo.cc:450
void IDP_MergeGroup(IDProperty *dest, const IDProperty *src, bool do_overwrite) ATTR_NONNULL()
Definition idprop.cc:783
bool wm_gizmo_select_and_highlight(bContext *C, wmGizmoMap *gzmap, wmGizmo *gz)
Definition wm_gizmo.cc:406
void WM_gizmo_properties_create_ptr(PointerRNA *ptr, wmGizmoType *gzt)
Definition wm_gizmo.cc:586
void WM_gizmo_unlink(ListBaseT< wmGizmo > *gizmolist, wmGizmoMap *gzmap, wmGizmo *gz, bContext *C)
Definition wm_gizmo.cc:161
void WM_gizmo_set_scale(wmGizmo *gz, const float scale)
Definition wm_gizmo.cc:313
static void gizmo_init(wmGizmo *gz)
Definition wm_gizmo.cc:106
bool wm_gizmo_select_set_ex(wmGizmoMap *gzmap, wmGizmo *gz, bool select, bool use_array, bool use_callback)
Definition wm_gizmo.cc:356
void wm_gizmomap_select_array_push_back(wmGizmoMap *gzmap, wmGizmo *gz)
PropertyType RNA_property_type(PropertyRNA *prop)
void WM_gizmo_set_flag(wmGizmo *gz, const int flag, const bool enable)
Definition wm_gizmo.cc:303
void IDP_ClearProperty(IDProperty *prop)
Definition idprop.cc:1408
StructRNA * RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
@ PROP_POINTER
Definition RNA_types.hh:215
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:138
void wm_gizmo_update(wmGizmo *gz, const bContext *C, const bool refresh_map)
Definition wm_gizmo.cc:489
int wm_gizmo_is_visible(wmGizmo *gz)
Definition wm_gizmo.cc:497
void WM_gizmo_set_fn_custom_modal(wmGizmo *gz, wmGizmoFnModal fn)
Definition wm_gizmo.cc:347
wmWindowManager * CTX_wm_manager(const bContext *C)
bool WM_gizmo_context_check_drawstep(const bContext *C, eWM_GizmoFlagMapDrawStep step)
Definition wm_gizmo.cc:725
void WM_gizmo_properties_free(PointerRNA *ptr)
Definition wm_gizmo.cc:700
static void wm_gizmo_set_matrix_rotation_from_yz_axis__internal(float matrix[4][4], const float y_axis[3], const float z_axis[3])
Definition wm_gizmo.cc:263
int RNA_property_flag(PropertyRNA *prop)
PointerRNA * WM_gizmo_operator_set(wmGizmo *gz, int part_index, wmOperatorType *ot, IDProperty *properties)
Definition wm_gizmo.cc:199
bool wm_gizmomap_highlight_set(wmGizmoMap *gzmap, const bContext *C, wmGizmo *gz, int part)
bool WM_gizmo_target_property_is_valid(const wmGizmoProperty *gz_prop)
void unit_m4(float m[4][4])
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
wmOperatorStatus WM_operator_name_call(bContext *C, const char *opstring, wm::OpCallContext context, PointerRNA *properties, const wmEvent *event)
void WM_gizmo_properties_reset(wmGizmo *gz)
Definition wm_gizmo.cc:673
wmGizmo * WM_gizmo_new(const StringRef idname, wmGizmoGroup *gzgroup, PointerRNA *properties)
Definition wm_gizmo.cc:97
bool WM_gizmo_group_is_modal(const wmGizmoGroup *gzgroup)
Definition wm_gizmo.cc:716
bool WM_gizmo_properties_default(PointerRNA *ptr, const bool do_update)
Definition wm_gizmo.cc:646
void WM_gizmo_set_matrix_offset_rotation_from_yz_axis(wmGizmo *gz, const float y_axis[3], const float z_axis[3])
Definition wm_gizmo.cc:292
bool RNA_struct_system_idprops_unset(PointerRNA *ptr, const char *identifier)
MINLINE float normalize_v3_v3(float r[3], const float a[3])
void WM_gizmo_properties_sanitize(PointerRNA *ptr, const bool no_context)
Definition wm_gizmo.cc:617
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void WM_gizmo_properties_clear(PointerRNA *ptr)
Definition wm_gizmo.cc:691
@ WM_GIZMOGROUPTYPE_SCALE
@ WM_GIZMO_DRAW_NO_SCALE
@ WM_GIZMO_DRAW_HOVER
@ WM_GIZMO_OPERATOR_TOOL_INIT
@ WM_GIZMO_DRAW_OFFSET_SCALE
@ WM_GIZMO_DRAW_VALUE
@ WM_GIZMO_DRAW_MODAL
MINLINE float normalize_v3(float n[3])
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
@ WM_GIZMO_STATE_MODAL
@ WM_GIZMO_STATE_SELECT
@ WM_GIZMO_STATE_HIGHLIGHT
bool WM_gizmo_select_set(wmGizmoMap *gzmap, wmGizmo *gz, bool select)
Definition wm_gizmo.cc:396
bToolRef * WM_toolsystem_ref_from_context(const bContext *C)
float ED_view3d_pixel_size_no_ui_scale(const RegionView3D *rv3d, const float co[3])
void IDP_FreeProperty(IDProperty *prop)
Definition idprop.cc:1403
static void gizmo_update_prop_data(wmGizmo *gz)
Definition wm_gizmo.cc:477
wmOperatorStatus WM_operator_name_call_ptr(bContext *C, wmOperatorType *ot, wm::OpCallContext context, PointerRNA *properties, const wmEvent *event)
@ PROP_ENUM_NO_CONTEXT
Definition RNA_types.hh:500
@ PROP_SKIP_SAVE
Definition RNA_types.hh:414
void WM_gizmo_set_matrix_offset_rotation_from_z_axis(wmGizmo *gz, const float z_axis[3])
Definition wm_gizmo.cc:288
MINLINE void copy_v4_v4(float r[4], const float a[4])
wmOperatorStatus(*)(bContext *, wmGizmo *, const wmEvent *, eWM_GizmoFlagTweak) wmGizmoFnModal
void copy_m4_m4(float m1[4][4], const float m2[4][4])
wmGizmoOpElem * WM_gizmo_operator_get(wmGizmo *gz, int part_index)
Definition wm_gizmo.cc:191
void ortho_basis_v3v3_v3(float r_n1[3], float r_n2[3], const float n[3])
void WM_gizmo_set_matrix_location(wmGizmo *gz, const float origin[3])
Definition wm_gizmo.cc:283
void wm_gizmomap_modal_set(wmGizmoMap *gzmap, bContext *C, wmGizmo *gz, const wmEvent *event, bool enable)
wmGizmo * WM_gizmo_new_ptr(const wmGizmoType *gzt, wmGizmoGroup *gzgroup, PointerRNA *properties)
Definition wm_gizmo.cc:84
@ WM_GIZMO_IS_VISIBLE_UPDATE
@ WM_GIZMO_IS_VISIBLE_DRAW
bool WM_gizmo_select_unlink(wmGizmoMap *gzmap, wmGizmo *gz)
Definition wm_gizmo.cc:391
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
void rotation_between_vecs_to_mat3(float m[3][3], const float v1[3], const float v2[3])
bScreen * ED_screen_animation_playing(const wmWindowManager *wm)
static wmGizmo * wm_gizmo_create(const wmGizmoType *gzt, PointerRNA *properties)
Definition wm_gizmo.cc:47
@ WM_GIZMOMAP_DRAWSTEP_3D
@ WM_GIZMOMAP_DRAWSTEP_2D
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
eWM_GizmoFlagGroupTypeFlag flag
wmGizmoGroupType * type
struct blender::wmGizmoMap::@077047172235271304035100110332311133341144335100 gzmap_context
const float(* matrix_space)[4]
const float(* matrix_basis)[4]
const float(* matrix_offset)[4]
struct blender::wmGizmoProperty::@216011055122204070127377170176223170047224321165 custom_func
wmGizmoFnMatrixBasisGet matrix_basis_get
wmGizmoFnSelectRefresh select_refresh
wmGizmoFnPropertyUpdate property_update
float matrix_basis[4][4]
float matrix_space[4][4]
IDProperty * properties
float matrix_offset[4][4]
const wmGizmoType * type
wmGizmoGroup * parent_gzgroup
Vector< wmGizmoProperty, 0 > target_properties
eWM_GizmoFlag flag
wmGizmoFnModal custom_modal
eWM_GizmoFlagState state
Vector< wmGizmoOpElem, 4 > op_data