Blender V4.5
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.h"
12#include "BLI_math_matrix.h"
13#include "BLI_math_vector.h"
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
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_callocN(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 = blender::bke::idprop::create_group("wmGizmoProperties").release();
66 }
68 static_cast<ID *>(G_MAIN->wm.first), gzt->srna, gz->properties);
69
71
75
76 gz->drag_part = -1;
77
78 /* Only ensure expected size for the target properties array. Actual initialization of these
79 * happen separately (see e.g. #WM_gizmo_target_property_def_rna and related). */
81
82 return gz;
83}
84
85wmGizmo *WM_gizmo_new_ptr(const wmGizmoType *gzt, wmGizmoGroup *gzgroup, PointerRNA *properties)
86{
87 wmGizmo *gz = wm_gizmo_create(gzt, properties);
88
89 wm_gizmo_register(gzgroup, gz);
90
91 if (gz->type->setup != nullptr) {
92 gz->type->setup(gz);
93 }
94
95 return gz;
96}
97
98wmGizmo *WM_gizmo_new(const StringRef idname, wmGizmoGroup *gzgroup, PointerRNA *properties)
99{
100 const wmGizmoType *gzt = WM_gizmotype_find(idname, false);
101 return WM_gizmo_new_ptr(gzt, gzgroup, properties);
102}
103
107static void gizmo_init(wmGizmo *gz)
108{
109 const float color_default[4] = {1.0f, 1.0f, 1.0f, 1.0f};
110
111 gz->scale_basis = 1.0f;
112 gz->line_width = 1.0f;
113
114 /* Defaults. */
115 copy_v4_v4(gz->color, color_default);
116 copy_v4_v4(gz->color_hi, color_default);
117}
118
124static void wm_gizmo_register(wmGizmoGroup *gzgroup, wmGizmo *gz)
125{
126 gizmo_init(gz);
127 wm_gizmogroup_gizmo_register(gzgroup, gz);
128}
129
131{
132 if (gz->type->free != nullptr) {
133 gz->type->free(gz);
134 }
135
136#ifdef WITH_PYTHON
137 if (gz->py_instance) {
138 /* Do this first in case there are any `__del__` functions or
139 * similar that use properties. */
141 }
142#endif
143
144 for (wmGizmoOpElem &gzop : gz->op_data) {
146 }
147
148 if (gz->ptr != nullptr) {
150 MEM_delete(gz->ptr);
151 }
152
153 for (wmGizmoProperty &gz_prop : gz->target_properties) {
154 if (gz_prop.custom_func.free_fn) {
155 gz_prop.custom_func.free_fn(gz, &gz_prop);
156 }
157 }
158
159 /* Explicit calling of the destructor is needed here because allocation still happens 'the C
160 * way', see FIXME note in #wm_gizmo_create. */
161 gz->~wmGizmo();
162 MEM_freeN(static_cast<void *>(gz));
163}
164
165void WM_gizmo_unlink(ListBase *gizmolist, wmGizmoMap *gzmap, wmGizmo *gz, bContext *C)
166{
168 wm_gizmomap_highlight_set(gzmap, C, nullptr, 0);
169 }
170 if (gz->state & WM_GIZMO_STATE_MODAL) {
171 wm_gizmomap_modal_set(gzmap, C, gz, nullptr, false);
172 }
173 /* Unlink instead of setting so we don't run callbacks. */
174 if (gz->state & WM_GIZMO_STATE_SELECT) {
175 WM_gizmo_select_unlink(gzmap, gz);
176 }
177
178 if (gizmolist) {
179 BLI_remlink(gizmolist, gz);
180 }
181
182 BLI_assert(gzmap->gzmap_context.highlight != gz);
183 BLI_assert(gzmap->gzmap_context.modal != gz);
184
185 WM_gizmo_free(gz);
186}
187
188/* -------------------------------------------------------------------- */
194
196{
197 if ((part_index >= 0) && (part_index < gz->op_data.size())) {
198 return &gz->op_data[part_index];
199 }
200 return nullptr;
201}
202
204 int part_index,
206 IDProperty *properties)
207{
208 BLI_assert(part_index < 255);
209 if (part_index >= gz->op_data.size()) {
210 gz->op_data.resize(part_index + 1);
211 }
212 wmGizmoOpElem &gzop = gz->op_data[part_index];
213 gzop.type = ot;
214
215 if (gzop.ptr.data) {
217 }
219
220 if (properties) {
221 gzop.ptr.data = properties;
222 }
223
224 return &gzop.ptr;
225}
226
228 wmGizmo *gz,
229 wmGizmoOpElem *gzop,
230 const wmEvent *event)
231{
233 /* Merge tool-settings into the gizmo properties. */
234 PointerRNA tref_ptr;
236 if (tref && WM_toolsystem_ref_properties_get_from_operator(tref, gzop->type, &tref_ptr)) {
237 if (gzop->ptr.data == nullptr) {
238 gzop->ptr.data = blender::bke::idprop::create_group("wmOperatorProperties").release();
239 }
240 IDP_MergeGroup(static_cast<IDProperty *>(gzop->ptr.data),
241 static_cast<const IDProperty *>(tref_ptr.data),
242 false);
243 }
244 }
245 return WM_operator_name_call_ptr(C, gzop->type, WM_OP_INVOKE_DEFAULT, &gzop->ptr, event);
246}
247
249 const float z_axis[3])
250{
251/* Old code, seems we can use simpler method. */
252#if 0
253 const float z_global[3] = {0.0f, 0.0f, 1.0f};
254 float rot[3][3];
255
256 rotation_between_vecs_to_mat3(rot, z_global, z_axis);
257 copy_v3_v3(matrix[0], rot[0]);
258 copy_v3_v3(matrix[1], rot[1]);
259 copy_v3_v3(matrix[2], rot[2]);
260#else
261 normalize_v3_v3(matrix[2], z_axis);
262 ortho_basis_v3v3_v3(matrix[0], matrix[1], matrix[2]);
263#endif
264}
265
267 const float y_axis[3],
268 const float z_axis[3])
269{
270 normalize_v3_v3(matrix[1], y_axis);
271 normalize_v3_v3(matrix[2], z_axis);
272 cross_v3_v3v3(matrix[0], matrix[1], matrix[2]);
273 normalize_v3(matrix[0]);
274}
275
281 const float y_axis[3],
282 const float z_axis[3])
283{
285}
286void WM_gizmo_set_matrix_location(wmGizmo *gz, const float origin[3])
287{
288 copy_v3_v3(gz->matrix_basis[3], origin);
289}
290
296 const float y_axis[3],
297 const float z_axis[3])
298{
300}
301void WM_gizmo_set_matrix_offset_location(wmGizmo *gz, const float offset[3])
302{
303 copy_v3_v3(gz->matrix_offset[3], offset);
304}
305
306void WM_gizmo_set_flag(wmGizmo *gz, const int flag, const bool enable)
307{
308 if (enable) {
309 gz->flag |= eWM_GizmoFlag(flag);
310 }
311 else {
312 gz->flag &= ~eWM_GizmoFlag(flag);
313 }
314}
315
316void WM_gizmo_set_scale(wmGizmo *gz, const float scale)
317{
318 gz->scale_basis = scale;
319}
320
321void WM_gizmo_set_line_width(wmGizmo *gz, const float line_width)
322{
323 gz->line_width = line_width;
324}
325
326void WM_gizmo_get_color(const wmGizmo *gz, float color[4])
327{
328 copy_v4_v4(color, gz->color);
329}
330void WM_gizmo_set_color(wmGizmo *gz, const float color[4])
331{
332 copy_v4_v4(gz->color, color);
333}
334
335void WM_gizmo_get_color_highlight(const wmGizmo *gz, float color_hi[4])
336{
337 copy_v4_v4(color_hi, gz->color_hi);
338}
339void WM_gizmo_set_color_highlight(wmGizmo *gz, const float color_hi[4])
340{
341 copy_v4_v4(gz->color_hi, color_hi);
342}
343 /* Gizmo Creation API. */
345
346/* -------------------------------------------------------------------- */
349
354
356
357/* -------------------------------------------------------------------- */
358
360 wmGizmoMap *gzmap, wmGizmo *gz, bool select, bool use_array, bool use_callback)
361{
362 bool changed = false;
363
364 if (select) {
365 if ((gz->state & WM_GIZMO_STATE_SELECT) == 0) {
366 if (use_array) {
368 }
370 changed = true;
371 }
372 }
373 else {
374 if (gz->state & WM_GIZMO_STATE_SELECT) {
375 if (use_array) {
377 }
379 changed = true;
380 }
381 }
382
383 /* In the case of unlinking we only want to remove from the array
384 * and not write to the external state. */
385 if (use_callback && changed) {
386 if (gz->type->select_refresh) {
387 gz->type->select_refresh(gz);
388 }
389 }
390
391 return changed;
392}
393
395{
396 return wm_gizmo_select_set_ex(gzmap, gz, false, true, false);
397}
398
400{
401 return wm_gizmo_select_set_ex(gzmap, gz, select, true, true);
402}
403
405{
406 return wm_gizmomap_highlight_set(gzmap, nullptr, gz, gz ? gz->highlight_part : 0);
407}
408
410{
411 if (WM_gizmo_select_set(gzmap, gz, true)) {
413 return true;
414 }
415 return false;
416}
417
419 wmGizmoMap *gzmap, bContext *C, wmGizmo *gz, int part_index, const wmEvent *event)
420{
421 gz->highlight_part = part_index;
422 WM_gizmo_highlight_set(gzmap, gz);
423 if (false) {
424 wm_gizmomap_modal_set(gzmap, C, gz, event, true);
425 }
426 else {
427 /* WEAK: but it works. */
428 WM_operator_name_call(C, "GIZMOGROUP_OT_gizmo_tweak", WM_OP_INVOKE_DEFAULT, nullptr, event);
429 }
430}
431
433 bContext *C,
434 wmGizmo *gz,
435 const wmEvent *event)
436{
437 if (gzmap->gzmap_context.modal) {
438 wm_gizmomap_modal_set(gzmap, C, gzmap->gzmap_context.modal, event, false);
439 }
440
441 if (gz) {
443
444 /* Set `highlight_part` to -1 to skip operator invocation. */
445 const int highlight_part = gz->highlight_part;
446 gz->highlight_part = -1;
447 wm_gizmomap_modal_set(gzmap, C, gz, event, true);
448 gz->highlight_part = highlight_part;
449 }
450}
451
453{
454 const RegionView3D *rv3d = CTX_wm_region_view3d(C);
455 float scale = UI_SCALE_FAC;
456
457 if ((gz->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_SCALE) == 0) {
458 scale *= U.gizmo_size;
459 if (rv3d) {
460 /* #ED_view3d_pixel_size includes #U.pixelsize, remove it. */
461 float matrix_world[4][4];
462 if (gz->type->matrix_basis_get) {
463 float matrix_basis[4][4];
464 gz->type->matrix_basis_get(gz, matrix_basis);
465 mul_m4_m4m4(matrix_world, gz->matrix_space, matrix_basis);
466 }
467 else {
468 mul_m4_m4m4(matrix_world, gz->matrix_space, gz->matrix_basis);
469 }
470
471 /* Exclude matrix_offset from scale. */
472 scale *= ED_view3d_pixel_size_no_ui_scale(rv3d, matrix_world[3]);
473 }
474 }
475
476 gz->scale_final = gz->scale_basis * scale;
477}
478
480{
481 /* Gizmo property might have been changed, so update gizmo. */
482 if (gz->type->property_update) {
483 for (wmGizmoProperty &gz_prop : gz->target_properties) {
484 if (WM_gizmo_target_property_is_valid(&gz_prop)) {
485 gz->type->property_update(gz, &gz_prop);
486 }
487 }
488 }
489}
490
491void wm_gizmo_update(wmGizmo *gz, const bContext *C, const bool refresh_map)
492{
493 if (refresh_map) {
495 }
497}
498
500{
501 if (gz->flag & WM_GIZMO_HIDDEN) {
502 return 0;
503 }
504 if ((gz->state & WM_GIZMO_STATE_MODAL) &&
506 {
507 /* Don't draw while modal (dragging). */
508 return 0;
509 }
510 if ((gz->flag & WM_GIZMO_DRAW_HOVER) && !(gz->state & WM_GIZMO_STATE_HIGHLIGHT) &&
511 !(gz->state & WM_GIZMO_STATE_SELECT)) /* Still draw selected gizmos. */
512 {
513 /* Update but don't draw. */
515 }
516
518}
519
522 float r_mat[4][4])
523{
524 const float(*const matrix_space)[4] = params->matrix_space ? params->matrix_space :
525 gz->matrix_space;
526 const float(*const matrix_basis)[4] = params->matrix_basis ? params->matrix_basis :
527 gz->matrix_basis;
528 const float(*const matrix_offset)[4] = params->matrix_offset ? params->matrix_offset :
529 gz->matrix_offset;
530 const float *scale_final = params->scale_final ? params->scale_final : &gz->scale_final;
531
532 float final_matrix[4][4];
533 if (params->matrix_basis == nullptr && gz->type->matrix_basis_get) {
534 gz->type->matrix_basis_get(gz, final_matrix);
535 }
536 else {
537 copy_m4_m4(final_matrix, matrix_basis);
538 }
539
540 if (gz->flag & WM_GIZMO_DRAW_NO_SCALE) {
541 mul_m4_m4m4(final_matrix, final_matrix, matrix_offset);
542 }
543 else {
545 mul_mat3_m4_fl(final_matrix, *scale_final);
546 mul_m4_m4m4(final_matrix, final_matrix, matrix_offset);
547 }
548 else {
549 mul_m4_m4m4(final_matrix, final_matrix, matrix_offset);
550 mul_mat3_m4_fl(final_matrix, *scale_final);
551 }
552 }
553
554 mul_m4_m4m4(r_mat, matrix_space, final_matrix);
555}
556
557void WM_gizmo_calc_matrix_final_no_offset(const wmGizmo *gz, float r_mat[4][4])
558{
559 float mat_identity[4][4];
560 unit_m4(mat_identity);
561
563 params.matrix_space = nullptr;
564 params.matrix_basis = nullptr;
565 params.matrix_offset = mat_identity;
566 params.scale_final = nullptr;
568}
569
570void WM_gizmo_calc_matrix_final(const wmGizmo *gz, float r_mat[4][4])
571{
573 params.matrix_space = nullptr;
574 params.matrix_basis = nullptr;
575 params.matrix_offset = nullptr;
576 params.scale_final = nullptr;
578}
579
580/* -------------------------------------------------------------------- */
586
588{
589 *ptr = RNA_pointer_create_discrete(nullptr, gzt->srna, nullptr);
590}
591
593{
594 const wmGizmoType *gzt = WM_gizmotype_find(gtstring, false);
595
596 if (gzt) {
598 }
599 else {
600 *ptr = RNA_pointer_create_discrete(nullptr, &RNA_GizmoProperties, nullptr);
601 }
602}
603
604void WM_gizmo_properties_alloc(PointerRNA **ptr, IDProperty **properties, const StringRef gtstring)
605{
606 if (*properties == nullptr) {
607 *properties = blender::bke::idprop::create_group("wmOpItemProp").release();
608 }
609
610 if (*ptr == nullptr) {
611 *ptr = MEM_new<PointerRNA>("wmOpItemPtr");
613 }
614
615 (*ptr)->data = *properties;
616}
617
618void WM_gizmo_properties_sanitize(PointerRNA *ptr, const bool no_context)
619{
620 RNA_STRUCT_BEGIN (ptr, prop) {
621 switch (RNA_property_type(prop)) {
622 case PROP_ENUM:
623 if (no_context) {
625 }
626 else {
628 }
629 break;
630 case PROP_POINTER: {
632
633 /* Recurse into gizmo properties. */
634 if (RNA_struct_is_a(ptype, &RNA_GizmoProperties)) {
636 WM_gizmo_properties_sanitize(&opptr, no_context);
637 }
638 break;
639 }
640 default:
641 break;
642 }
643 }
645}
646
648{
649 bool changed = false;
650 RNA_STRUCT_BEGIN (ptr, prop) {
651 switch (RNA_property_type(prop)) {
652 case PROP_POINTER: {
654 if (ptype != &RNA_Struct) {
656 changed |= WM_gizmo_properties_default(&opptr, do_update);
657 }
658 break;
659 }
660 default:
661 if ((do_update == false) || (RNA_property_is_set(ptr, prop) == false)) {
662 if (RNA_property_reset(ptr, prop, -1)) {
663 changed = true;
664 }
665 }
666 break;
667 }
668 }
670
671 return changed;
672}
673
675{
676 if (gz->ptr->data) {
677 PropertyRNA *iterprop;
678 iterprop = RNA_struct_iterator_property(gz->type->srna);
679
680 RNA_PROP_BEGIN (gz->ptr, itemptr, iterprop) {
681 PropertyRNA *prop = static_cast<PropertyRNA *>(itemptr.data);
682
683 if ((RNA_property_flag(prop) & PROP_SKIP_SAVE) == 0) {
684 const char *identifier = RNA_property_identifier(prop);
685 RNA_struct_idprops_unset(gz->ptr, identifier);
686 }
687 }
689 }
690}
691
693{
694 IDProperty *properties = static_cast<IDProperty *>(ptr->data);
695
696 if (properties) {
697 IDP_ClearProperty(properties);
698 }
699}
700
702{
703 IDProperty *properties = static_cast<IDProperty *>(ptr->data);
704
705 if (properties) {
706 IDP_FreeProperty(properties);
707 ptr->data = nullptr; /* Just in case. */
708 }
709}
710
712
713/* -------------------------------------------------------------------- */
716
718{
720 if (gz && gz->parent_gzgroup == gzgroup) {
721 return true;
722 }
723 return false;
724}
725
727{
728 switch (step) {
730 break;
731 }
735 return false;
736 }
737 break;
738 }
739 }
740 return true;
741}
742
RegionView3D * CTX_wm_region_view3d(const bContext *C)
wmWindowManager * CTX_wm_manager(const bContext *C)
#define G_MAIN
void IDP_FreeProperty(IDProperty *prop)
Definition idprop.cc:1243
void IDP_ClearProperty(IDProperty *prop)
Definition idprop.cc:1249
IDProperty * IDP_CopyProperty(const IDProperty *prop) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition idprop.cc:873
void IDP_MergeGroup(IDProperty *dest, const IDProperty *src, bool do_overwrite) ATTR_NONNULL()
Definition idprop.cc:720
#define BLI_assert(a)
Definition BLI_assert.h:46
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:131
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void mul_mat3_m4_fl(float R[4][4], float f)
void copy_m4_m4(float m1[4][4], const float m2[4][4])
void unit_m4(float m[4][4])
void rotation_between_vecs_to_mat3(float m[3][3], const float v1[3], const float v2[3])
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE float normalize_v3_v3(float r[3], const float a[3])
void ortho_basis_v3v3_v3(float r_n1[3], float r_n2[3], const float n[3])
MINLINE float normalize_v3(float n[3])
void BPY_DECREF_RNA_INVALIDATE(void *pyob_ptr)
#define UI_SCALE_FAC
bScreen * ED_screen_animation_playing(const wmWindowManager *wm)
float ED_view3d_pixel_size_no_ui_scale(const RegionView3D *rv3d, const float co[3])
Read Guarded memory(de)allocation.
#define RNA_PROP_END
#define RNA_STRUCT_BEGIN(sptr, prop)
#define RNA_STRUCT_END
#define RNA_PROP_BEGIN(sptr, itemptr, prop)
@ PROP_ENUM
Definition RNA_types.hh:154
@ PROP_POINTER
Definition RNA_types.hh:155
@ PROP_ENUM_NO_CONTEXT
Definition RNA_types.hh:404
@ PROP_SKIP_SAVE
Definition RNA_types.hh:330
#define C
Definition RandGen.cpp:29
eWM_GizmoFlagMapDrawStep
@ WM_GIZMOMAP_DRAWSTEP_3D
@ WM_GIZMOMAP_DRAWSTEP_2D
eWM_GizmoFlag
@ WM_GIZMO_DRAW_NO_SCALE
@ WM_GIZMO_HIDDEN
@ WM_GIZMO_OPERATOR_TOOL_INIT
@ WM_GIZMO_DRAW_VALUE
@ WM_GIZMO_DRAW_MODAL
@ WM_GIZMO_DRAW_HOVER
@ WM_GIZMO_DRAW_OFFSET_SCALE
@ WM_GIZMOGROUPTYPE_SCALE
@ WM_GIZMO_STATE_HIGHLIGHT
@ WM_GIZMO_STATE_MODAL
@ WM_GIZMO_STATE_SELECT
#define WM_toolsystem_ref_properties_get_from_operator(tref, ot, r_ptr)
bool do_update
Definition WM_types.hh:1008
@ WM_OP_INVOKE_DEFAULT
Definition WM_types.hh:238
#define U
int64_t size() const
void resize(const int64_t new_size)
#define rot(x, k)
#define select(A, B, C)
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void * MEM_callocN(size_t len, const char *str)
Definition mallocn.cc:118
void MEM_freeN(void *vmemh)
Definition mallocn.cc:113
std::unique_ptr< IDProperty, IDPropertyDeleter > create_group(StringRef prop_name, eIDPropertyFlag flags={})
Allocate a new IDProperty of type IDP_GROUP.
bool RNA_struct_is_a(const StructRNA *type, const StructRNA *srna)
bool RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index)
StructRNA * RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
PropertyType RNA_property_type(PropertyRNA *prop)
PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
int RNA_property_flag(PropertyRNA *prop)
bool RNA_struct_idprops_unset(PointerRNA *ptr, const char *identifier)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
PropertyRNA * RNA_struct_iterator_property(StructRNA *type)
const char * RNA_property_identifier(const PropertyRNA *prop)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition DNA_ID.h:404
void * data
Definition RNA_types.hh:53
eWM_GizmoFlagGroupTypeFlag flag
wmGizmoMap * parent_gzmap
wmGizmoGroupType * type
struct wmGizmoMap::@176324062253052324135223064236045247240266151116 gzmap_context
Gizmo map runtime context.
wmGizmo * modal
wmGizmo * highlight
wmOperatorType * type
struct wmGizmoProperty::@046017364211037167053011312355256221126135017103 custom_func
wmGizmoPropertyFnFree free_fn
StructRNA * srna
wmGizmoFnSelectRefresh select_refresh
wmGizmoFnSetup setup
int target_property_defs_len
wmGizmoFnMatrixBasisGet matrix_basis_get
wmGizmoFnFree free
wmGizmoFnPropertyUpdate property_update
wmGizmoGroup * parent_gzgroup
const wmGizmoType * type
eWM_GizmoFlagState state
float matrix_basis[4][4]
void * py_instance
blender::Vector< wmGizmoProperty, 0 > target_properties
float matrix_offset[4][4]
blender::Vector< wmGizmoOpElem, 4 > op_data
float color_hi[4]
float scale_final
float color[4]
IDProperty * properties
PointerRNA * ptr
float scale_basis
float matrix_space[4][4]
float line_width
eWM_GizmoFlag flag
wmGizmoFnModal custom_modal
wmOperatorStatus WM_operator_name_call_ptr(bContext *C, wmOperatorType *ot, wmOperatorCallContext context, PointerRNA *properties, const wmEvent *event)
wmOperatorStatus WM_operator_name_call(bContext *C, const char *opstring, wmOperatorCallContext context, PointerRNA *properties, const wmEvent *event)
PointerRNA * ptr
Definition wm_files.cc:4226
wmOperatorType * ot
Definition wm_files.cc:4225
bool wm_gizmo_select_set_ex(wmGizmoMap *gzmap, wmGizmo *gz, bool select, bool use_array, bool use_callback)
Definition wm_gizmo.cc:359
void WM_gizmo_set_matrix_offset_location(wmGizmo *gz, const float offset[3])
Definition wm_gizmo.cc:301
void WM_gizmo_modal_set_from_setup(wmGizmoMap *gzmap, bContext *C, wmGizmo *gz, int part_index, const wmEvent *event)
Definition wm_gizmo.cc:418
wmGizmoOpElem * WM_gizmo_operator_get(wmGizmo *gz, int part_index)
Definition wm_gizmo.cc:195
bool WM_gizmo_context_check_drawstep(const bContext *C, eWM_GizmoFlagMapDrawStep step)
Definition wm_gizmo.cc:726
static void wm_gizmo_register(wmGizmoGroup *gzgroup, wmGizmo *gz)
Definition wm_gizmo.cc:124
static void gizmo_update_prop_data(wmGizmo *gz)
Definition wm_gizmo.cc:479
wmOperatorStatus WM_gizmo_operator_invoke(bContext *C, wmGizmo *gz, wmGizmoOpElem *gzop, const wmEvent *event)
Definition wm_gizmo.cc:227
void WM_gizmo_modal_set_while_modal(wmGizmoMap *gzmap, bContext *C, wmGizmo *gz, const wmEvent *event)
Definition wm_gizmo.cc:432
void WM_gizmo_set_color_highlight(wmGizmo *gz, const float color_hi[4])
Definition wm_gizmo.cc:339
void WM_gizmo_set_line_width(wmGizmo *gz, const float line_width)
Definition wm_gizmo.cc:321
void WM_gizmo_calc_matrix_final_params(const wmGizmo *gz, const WM_GizmoMatrixParams *params, float r_mat[4][4])
Definition wm_gizmo.cc:520
bool wm_gizmo_select_and_highlight(bContext *C, wmGizmoMap *gzmap, wmGizmo *gz)
Definition wm_gizmo.cc:409
void WM_gizmo_get_color_highlight(const wmGizmo *gz, float color_hi[4])
Definition wm_gizmo.cc:335
void WM_gizmo_set_fn_custom_modal(wmGizmo *gz, wmGizmoFnModal fn)
Definition wm_gizmo.cc:350
void WM_gizmo_free(wmGizmo *gz)
Definition wm_gizmo.cc:130
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:295
void WM_gizmo_calc_matrix_final(const wmGizmo *gz, float r_mat[4][4])
Definition wm_gizmo.cc:570
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:280
void WM_gizmo_properties_create_ptr(PointerRNA *ptr, wmGizmoType *gzt)
Definition wm_gizmo.cc:587
bool WM_gizmo_group_is_modal(const wmGizmoGroup *gzgroup)
Definition wm_gizmo.cc:717
wmGizmo * WM_gizmo_new_ptr(const wmGizmoType *gzt, wmGizmoGroup *gzgroup, PointerRNA *properties)
Definition wm_gizmo.cc:85
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:266
void WM_gizmo_get_color(const wmGizmo *gz, float color[4])
Definition wm_gizmo.cc:326
void WM_gizmo_calc_matrix_final_no_offset(const wmGizmo *gz, float r_mat[4][4])
Definition wm_gizmo.cc:557
static wmGizmo * wm_gizmo_create(const wmGizmoType *gzt, PointerRNA *properties)
Definition wm_gizmo.cc:47
void wm_gizmo_update(wmGizmo *gz, const bContext *C, const bool refresh_map)
Definition wm_gizmo.cc:491
bool WM_gizmo_highlight_set(wmGizmoMap *gzmap, wmGizmo *gz)
Definition wm_gizmo.cc:404
void WM_gizmo_set_matrix_offset_rotation_from_z_axis(wmGizmo *gz, const float z_axis[3])
Definition wm_gizmo.cc:291
static void gizmo_init(wmGizmo *gz)
Definition wm_gizmo.cc:107
void WM_gizmo_set_scale(wmGizmo *gz, const float scale)
Definition wm_gizmo.cc:316
void WM_gizmo_set_matrix_location(wmGizmo *gz, const float origin[3])
Definition wm_gizmo.cc:286
bool WM_gizmo_select_unlink(wmGizmoMap *gzmap, wmGizmo *gz)
Definition wm_gizmo.cc:394
void WM_gizmo_set_flag(wmGizmo *gz, const int flag, const bool enable)
Definition wm_gizmo.cc:306
void WM_gizmo_set_matrix_rotation_from_z_axis(wmGizmo *gz, const float z_axis[3])
Definition wm_gizmo.cc:276
static void wm_gizmo_set_matrix_rotation_from_z_axis__internal(float matrix[4][4], const float z_axis[3])
Definition wm_gizmo.cc:248
bool WM_gizmo_select_set(wmGizmoMap *gzmap, wmGizmo *gz, bool select)
Definition wm_gizmo.cc:399
PointerRNA * WM_gizmo_operator_set(wmGizmo *gz, int part_index, wmOperatorType *ot, IDProperty *properties)
Definition wm_gizmo.cc:203
void WM_gizmo_properties_sanitize(PointerRNA *ptr, const bool no_context)
Definition wm_gizmo.cc:618
void WM_gizmo_properties_free(PointerRNA *ptr)
Definition wm_gizmo.cc:701
wmGizmo * WM_gizmo_new(const StringRef idname, wmGizmoGroup *gzgroup, PointerRNA *properties)
Definition wm_gizmo.cc:98
void WM_gizmo_properties_reset(wmGizmo *gz)
Definition wm_gizmo.cc:674
void WM_gizmo_properties_alloc(PointerRNA **ptr, IDProperty **properties, const StringRef gtstring)
Definition wm_gizmo.cc:604
void WM_gizmo_properties_clear(PointerRNA *ptr)
Definition wm_gizmo.cc:692
void wm_gizmo_calculate_scale(wmGizmo *gz, const bContext *C)
Definition wm_gizmo.cc:452
bool WM_gizmo_properties_default(PointerRNA *ptr, const bool do_update)
Definition wm_gizmo.cc:647
void WM_gizmo_properties_create(PointerRNA *ptr, const StringRef gtstring)
Definition wm_gizmo.cc:592
void WM_gizmo_set_color(wmGizmo *gz, const float color[4])
Definition wm_gizmo.cc:330
int wm_gizmo_is_visible(wmGizmo *gz)
Definition wm_gizmo.cc:499
void WM_gizmo_unlink(ListBase *gizmolist, wmGizmoMap *gzmap, wmGizmo *gz, bContext *C)
Definition wm_gizmo.cc:165
wmOperatorStatus(*)(bContext *, wmGizmo *, const wmEvent *, eWM_GizmoFlagTweak) wmGizmoFnModal
void wm_gizmogroup_gizmo_register(wmGizmoGroup *gzgroup, wmGizmo *gz)
@ WM_GIZMO_IS_VISIBLE_DRAW
@ WM_GIZMO_IS_VISIBLE_UPDATE
void wm_gizmomap_select_array_remove(wmGizmoMap *gzmap, wmGizmo *gz)
void wm_gizmomap_select_array_push_back(wmGizmoMap *gzmap, wmGizmo *gz)
void wm_gizmomap_modal_set(wmGizmoMap *gzmap, bContext *C, wmGizmo *gz, const wmEvent *event, bool enable)
bool wm_gizmomap_highlight_set(wmGizmoMap *gzmap, const bContext *C, wmGizmo *gz, int part)
wmGizmo * WM_gizmomap_get_modal(const wmGizmoMap *gzmap)
bool WM_gizmo_target_property_is_valid(const wmGizmoProperty *gz_prop)
const wmGizmoType * WM_gizmotype_find(const StringRef idname, bool quiet)
void WM_operator_properties_create_ptr(PointerRNA *ptr, wmOperatorType *ot)
void WM_operator_properties_free(PointerRNA *ptr)
bToolRef * WM_toolsystem_ref_from_context(const bContext *C)
uint8_t flag
Definition wm_window.cc:139