Blender V5.0
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 }
246 C, gzop->type, blender::wm::OpCallContext::InvokeDefault, &gzop->ptr, event);
247}
248
250 const float z_axis[3])
251{
252/* Old code, seems we can use simpler method. */
253#if 0
254 const float z_global[3] = {0.0f, 0.0f, 1.0f};
255 float rot[3][3];
256
257 rotation_between_vecs_to_mat3(rot, z_global, z_axis);
258 copy_v3_v3(matrix[0], rot[0]);
259 copy_v3_v3(matrix[1], rot[1]);
260 copy_v3_v3(matrix[2], rot[2]);
261#else
262 normalize_v3_v3(matrix[2], z_axis);
263 ortho_basis_v3v3_v3(matrix[0], matrix[1], matrix[2]);
264#endif
265}
266
268 const float y_axis[3],
269 const float z_axis[3])
270{
271 normalize_v3_v3(matrix[1], y_axis);
272 normalize_v3_v3(matrix[2], z_axis);
273 cross_v3_v3v3(matrix[0], matrix[1], matrix[2]);
274 normalize_v3(matrix[0]);
275}
276
282 const float y_axis[3],
283 const float z_axis[3])
284{
286}
287void WM_gizmo_set_matrix_location(wmGizmo *gz, const float origin[3])
288{
289 copy_v3_v3(gz->matrix_basis[3], origin);
290}
291
297 const float y_axis[3],
298 const float z_axis[3])
299{
301}
302void WM_gizmo_set_matrix_offset_location(wmGizmo *gz, const float offset[3])
303{
304 copy_v3_v3(gz->matrix_offset[3], offset);
305}
306
307void WM_gizmo_set_flag(wmGizmo *gz, const int flag, const bool enable)
308{
309 if (enable) {
310 gz->flag |= eWM_GizmoFlag(flag);
311 }
312 else {
313 gz->flag &= ~eWM_GizmoFlag(flag);
314 }
315}
316
317void WM_gizmo_set_scale(wmGizmo *gz, const float scale)
318{
319 gz->scale_basis = scale;
320}
321
322void WM_gizmo_set_line_width(wmGizmo *gz, const float line_width)
323{
324 gz->line_width = line_width;
325}
326
327void WM_gizmo_get_color(const wmGizmo *gz, float color[4])
328{
329 copy_v4_v4(color, gz->color);
330}
331void WM_gizmo_set_color(wmGizmo *gz, const float color[4])
332{
333 copy_v4_v4(gz->color, color);
334}
335
336void WM_gizmo_get_color_highlight(const wmGizmo *gz, float color_hi[4])
337{
338 copy_v4_v4(color_hi, gz->color_hi);
339}
340void WM_gizmo_set_color_highlight(wmGizmo *gz, const float color_hi[4])
341{
342 copy_v4_v4(gz->color_hi, color_hi);
343}
344 /* Gizmo Creation API. */
346
347/* -------------------------------------------------------------------- */
350
355
357
358/* -------------------------------------------------------------------- */
359
361 wmGizmoMap *gzmap, wmGizmo *gz, bool select, bool use_array, bool use_callback)
362{
363 bool changed = false;
364
365 if (select) {
366 if ((gz->state & WM_GIZMO_STATE_SELECT) == 0) {
367 if (use_array) {
369 }
371 changed = true;
372 }
373 }
374 else {
375 if (gz->state & WM_GIZMO_STATE_SELECT) {
376 if (use_array) {
378 }
380 changed = true;
381 }
382 }
383
384 /* In the case of unlinking we only want to remove from the array
385 * and not write to the external state. */
386 if (use_callback && changed) {
387 if (gz->type->select_refresh) {
388 gz->type->select_refresh(gz);
389 }
390 }
391
392 return changed;
393}
394
396{
397 return wm_gizmo_select_set_ex(gzmap, gz, false, true, false);
398}
399
401{
402 return wm_gizmo_select_set_ex(gzmap, gz, select, true, true);
403}
404
406{
407 return wm_gizmomap_highlight_set(gzmap, nullptr, gz, gz ? gz->highlight_part : 0);
408}
409
411{
412 if (WM_gizmo_select_set(gzmap, gz, true)) {
414 return true;
415 }
416 return false;
417}
418
420 wmGizmoMap *gzmap, bContext *C, wmGizmo *gz, int part_index, const wmEvent *event)
421{
422 gz->highlight_part = part_index;
423 WM_gizmo_highlight_set(gzmap, gz);
424 if (false) {
425 wm_gizmomap_modal_set(gzmap, C, gz, event, true);
426 }
427 else {
428 /* WEAK: but it works. */
430 C, "GIZMOGROUP_OT_gizmo_tweak", blender::wm::OpCallContext::InvokeDefault, nullptr, event);
431 }
432}
433
435 bContext *C,
436 wmGizmo *gz,
437 const wmEvent *event)
438{
439 if (gzmap->gzmap_context.modal) {
440 wm_gizmomap_modal_set(gzmap, C, gzmap->gzmap_context.modal, event, false);
441 }
442
443 if (gz) {
445
446 /* Set `highlight_part` to -1 to skip operator invocation. */
447 const int highlight_part = gz->highlight_part;
448 gz->highlight_part = -1;
449 wm_gizmomap_modal_set(gzmap, C, gz, event, true);
450 gz->highlight_part = highlight_part;
451 }
452}
453
455{
456 const RegionView3D *rv3d = CTX_wm_region_view3d(C);
457 float scale = UI_SCALE_FAC;
458
459 if ((gz->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_SCALE) == 0) {
460 scale *= U.gizmo_size;
461 if (rv3d) {
462 /* #ED_view3d_pixel_size includes #U.pixelsize, remove it. */
463 float matrix_world[4][4];
464 if (gz->type->matrix_basis_get) {
465 float matrix_basis[4][4];
466 gz->type->matrix_basis_get(gz, matrix_basis);
467 mul_m4_m4m4(matrix_world, gz->matrix_space, matrix_basis);
468 }
469 else {
470 mul_m4_m4m4(matrix_world, gz->matrix_space, gz->matrix_basis);
471 }
472
473 /* Exclude matrix_offset from scale. */
474 scale *= ED_view3d_pixel_size_no_ui_scale(rv3d, matrix_world[3]);
475 }
476 }
477
478 gz->scale_final = gz->scale_basis * scale;
479}
480
482{
483 /* Gizmo property might have been changed, so update gizmo. */
484 if (gz->type->property_update) {
485 for (wmGizmoProperty &gz_prop : gz->target_properties) {
486 if (WM_gizmo_target_property_is_valid(&gz_prop)) {
487 gz->type->property_update(gz, &gz_prop);
488 }
489 }
490 }
491}
492
493void wm_gizmo_update(wmGizmo *gz, const bContext *C, const bool refresh_map)
494{
495 if (refresh_map) {
497 }
499}
500
502{
503 if (gz->flag & WM_GIZMO_HIDDEN) {
504 return 0;
505 }
506 if ((gz->state & WM_GIZMO_STATE_MODAL) &&
508 {
509 /* Don't draw while modal (dragging). */
510 return 0;
511 }
512 if ((gz->flag & WM_GIZMO_DRAW_HOVER) && !(gz->state & WM_GIZMO_STATE_HIGHLIGHT) &&
513 !(gz->state & WM_GIZMO_STATE_SELECT)) /* Still draw selected gizmos. */
514 {
515 /* Update but don't draw. */
517 }
518
520}
521
524 float r_mat[4][4])
525{
526 const float (*const matrix_space)[4] = params->matrix_space ? params->matrix_space :
527 gz->matrix_space;
528 const float (*const matrix_basis)[4] = params->matrix_basis ? params->matrix_basis :
529 gz->matrix_basis;
530 const float (*const matrix_offset)[4] = params->matrix_offset ? params->matrix_offset :
531 gz->matrix_offset;
532 const float *scale_final = params->scale_final ? params->scale_final : &gz->scale_final;
533
534 float final_matrix[4][4];
535 if (params->matrix_basis == nullptr && gz->type->matrix_basis_get) {
536 gz->type->matrix_basis_get(gz, final_matrix);
537 }
538 else {
539 copy_m4_m4(final_matrix, matrix_basis);
540 }
541
542 if (gz->flag & WM_GIZMO_DRAW_NO_SCALE) {
543 mul_m4_m4m4(final_matrix, final_matrix, matrix_offset);
544 }
545 else {
547 mul_mat3_m4_fl(final_matrix, *scale_final);
548 mul_m4_m4m4(final_matrix, final_matrix, matrix_offset);
549 }
550 else {
551 mul_m4_m4m4(final_matrix, final_matrix, matrix_offset);
552 mul_mat3_m4_fl(final_matrix, *scale_final);
553 }
554 }
555
556 mul_m4_m4m4(r_mat, matrix_space, final_matrix);
557}
558
559void WM_gizmo_calc_matrix_final_no_offset(const wmGizmo *gz, float r_mat[4][4])
560{
561 float mat_identity[4][4];
562 unit_m4(mat_identity);
563
565 params.matrix_space = nullptr;
566 params.matrix_basis = nullptr;
567 params.matrix_offset = mat_identity;
568 params.scale_final = nullptr;
570}
571
572void WM_gizmo_calc_matrix_final(const wmGizmo *gz, float r_mat[4][4])
573{
575 params.matrix_space = nullptr;
576 params.matrix_basis = nullptr;
577 params.matrix_offset = nullptr;
578 params.scale_final = nullptr;
580}
581
582/* -------------------------------------------------------------------- */
588
590{
591 *ptr = RNA_pointer_create_discrete(nullptr, gzt->srna, nullptr);
592}
593
595{
596 const wmGizmoType *gzt = WM_gizmotype_find(gtstring, false);
597
598 if (gzt) {
600 }
601 else {
602 *ptr = RNA_pointer_create_discrete(nullptr, &RNA_GizmoProperties, nullptr);
603 }
604}
605
606void WM_gizmo_properties_alloc(PointerRNA **ptr, IDProperty **properties, const StringRef gtstring)
607{
608 if (*properties == nullptr) {
609 *properties = blender::bke::idprop::create_group("wmOpItemProp").release();
610 }
611
612 if (*ptr == nullptr) {
613 *ptr = MEM_new<PointerRNA>("wmOpItemPtr");
615 }
616
617 (*ptr)->data = *properties;
618}
619
620void WM_gizmo_properties_sanitize(PointerRNA *ptr, const bool no_context)
621{
622 RNA_STRUCT_BEGIN (ptr, prop) {
623 switch (RNA_property_type(prop)) {
624 case PROP_ENUM:
625 if (no_context) {
627 }
628 else {
630 }
631 break;
632 case PROP_POINTER: {
634
635 /* Recurse into gizmo properties. */
636 if (RNA_struct_is_a(ptype, &RNA_GizmoProperties)) {
638 WM_gizmo_properties_sanitize(&opptr, no_context);
639 }
640 break;
641 }
642 default:
643 break;
644 }
645 }
647}
648
649bool WM_gizmo_properties_default(PointerRNA *ptr, const bool do_update)
650{
651 bool changed = false;
652 RNA_STRUCT_BEGIN (ptr, prop) {
653 switch (RNA_property_type(prop)) {
654 case PROP_POINTER: {
656 if (ptype != &RNA_Struct) {
658 changed |= WM_gizmo_properties_default(&opptr, do_update);
659 }
660 break;
661 }
662 default:
663 if ((do_update == false) || (RNA_property_is_set(ptr, prop) == false)) {
664 if (RNA_property_reset(ptr, prop, -1)) {
665 changed = true;
666 }
667 }
668 break;
669 }
670 }
672
673 return changed;
674}
675
677{
678 if (gz->ptr->data) {
679 PropertyRNA *iterprop;
680 iterprop = RNA_struct_iterator_property(gz->type->srna);
681
682 RNA_PROP_BEGIN (gz->ptr, itemptr, iterprop) {
683 PropertyRNA *prop = static_cast<PropertyRNA *>(itemptr.data);
684
685 if ((RNA_property_flag(prop) & PROP_SKIP_SAVE) == 0) {
686 const char *identifier = RNA_property_identifier(prop);
687 RNA_struct_system_idprops_unset(gz->ptr, identifier);
688 }
689 }
691 }
692}
693
695{
696 IDProperty *properties = static_cast<IDProperty *>(ptr->data);
697
698 if (properties) {
699 IDP_ClearProperty(properties);
700 }
701}
702
704{
705 IDProperty *properties = static_cast<IDProperty *>(ptr->data);
706
707 if (properties) {
708 IDP_FreeProperty(properties);
709 ptr->data = nullptr; /* Just in case. */
710 }
711}
712
714
715/* -------------------------------------------------------------------- */
718
720{
722 if (gz && gz->parent_gzgroup == gzgroup) {
723 return true;
724 }
725 return false;
726}
727
729{
730 switch (step) {
732 break;
733 }
737 return false;
738 }
739 break;
740 }
741 }
742 return true;
743}
744
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:1251
void IDP_ClearProperty(IDProperty *prop)
Definition idprop.cc:1257
IDProperty * IDP_CopyProperty(const IDProperty *prop) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition idprop.cc:863
void IDP_MergeGroup(IDProperty *dest, const IDProperty *src, bool do_overwrite) ATTR_NONNULL()
Definition idprop.cc:712
#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:166
@ PROP_POINTER
Definition RNA_types.hh:167
@ PROP_ENUM_NO_CONTEXT
Definition RNA_types.hh:430
@ PROP_SKIP_SAVE
Definition RNA_types.hh:344
#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)
#define U
int64_t size() const
void resize(const int64_t new_size)
nullptr float
#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_struct_system_idprops_unset(PointerRNA *ptr, const char *identifier)
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)
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:414
void * data
Definition RNA_types.hh:53
eWM_GizmoFlagGroupTypeFlag flag
wmGizmoMap * parent_gzmap
wmGizmoGroupType * type
wmGizmo * modal
struct wmGizmoMap::@114263143030171315362141314326010164050332242157 gzmap_context
Gizmo map runtime context.
wmGizmo * highlight
wmOperatorType * type
struct wmGizmoProperty::@331027022007232055216276241130041346111314317052 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, blender::wm::OpCallContext context, PointerRNA *properties, const wmEvent *event)
wmOperatorStatus WM_operator_name_call(bContext *C, const char *opstring, blender::wm::OpCallContext context, PointerRNA *properties, const wmEvent *event)
PointerRNA * ptr
Definition wm_files.cc:4238
wmOperatorType * ot
Definition wm_files.cc:4237
bool wm_gizmo_select_set_ex(wmGizmoMap *gzmap, wmGizmo *gz, bool select, bool use_array, bool use_callback)
Definition wm_gizmo.cc:360
void WM_gizmo_set_matrix_offset_location(wmGizmo *gz, const float offset[3])
Definition wm_gizmo.cc:302
void WM_gizmo_modal_set_from_setup(wmGizmoMap *gzmap, bContext *C, wmGizmo *gz, int part_index, const wmEvent *event)
Definition wm_gizmo.cc:419
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:728
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:481
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:434
void WM_gizmo_set_color_highlight(wmGizmo *gz, const float color_hi[4])
Definition wm_gizmo.cc:340
void WM_gizmo_set_line_width(wmGizmo *gz, const float line_width)
Definition wm_gizmo.cc:322
void WM_gizmo_calc_matrix_final_params(const wmGizmo *gz, const WM_GizmoMatrixParams *params, float r_mat[4][4])
Definition wm_gizmo.cc:522
bool wm_gizmo_select_and_highlight(bContext *C, wmGizmoMap *gzmap, wmGizmo *gz)
Definition wm_gizmo.cc:410
void WM_gizmo_get_color_highlight(const wmGizmo *gz, float color_hi[4])
Definition wm_gizmo.cc:336
void WM_gizmo_set_fn_custom_modal(wmGizmo *gz, wmGizmoFnModal fn)
Definition wm_gizmo.cc:351
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:296
void WM_gizmo_calc_matrix_final(const wmGizmo *gz, float r_mat[4][4])
Definition wm_gizmo.cc:572
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:281
void WM_gizmo_properties_create_ptr(PointerRNA *ptr, wmGizmoType *gzt)
Definition wm_gizmo.cc:589
bool WM_gizmo_group_is_modal(const wmGizmoGroup *gzgroup)
Definition wm_gizmo.cc:719
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:267
void WM_gizmo_get_color(const wmGizmo *gz, float color[4])
Definition wm_gizmo.cc:327
void WM_gizmo_calc_matrix_final_no_offset(const wmGizmo *gz, float r_mat[4][4])
Definition wm_gizmo.cc:559
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:493
bool WM_gizmo_highlight_set(wmGizmoMap *gzmap, wmGizmo *gz)
Definition wm_gizmo.cc:405
void WM_gizmo_set_matrix_offset_rotation_from_z_axis(wmGizmo *gz, const float z_axis[3])
Definition wm_gizmo.cc:292
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:317
void WM_gizmo_set_matrix_location(wmGizmo *gz, const float origin[3])
Definition wm_gizmo.cc:287
bool WM_gizmo_select_unlink(wmGizmoMap *gzmap, wmGizmo *gz)
Definition wm_gizmo.cc:395
void WM_gizmo_set_flag(wmGizmo *gz, const int flag, const bool enable)
Definition wm_gizmo.cc:307
void WM_gizmo_set_matrix_rotation_from_z_axis(wmGizmo *gz, const float z_axis[3])
Definition wm_gizmo.cc:277
static void wm_gizmo_set_matrix_rotation_from_z_axis__internal(float matrix[4][4], const float z_axis[3])
Definition wm_gizmo.cc:249
bool WM_gizmo_select_set(wmGizmoMap *gzmap, wmGizmo *gz, bool select)
Definition wm_gizmo.cc:400
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:620
void WM_gizmo_properties_free(PointerRNA *ptr)
Definition wm_gizmo.cc:703
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:676
void WM_gizmo_properties_alloc(PointerRNA **ptr, IDProperty **properties, const StringRef gtstring)
Definition wm_gizmo.cc:606
void WM_gizmo_properties_clear(PointerRNA *ptr)
Definition wm_gizmo.cc:694
void wm_gizmo_calculate_scale(wmGizmo *gz, const bContext *C)
Definition wm_gizmo.cc:454
bool WM_gizmo_properties_default(PointerRNA *ptr, const bool do_update)
Definition wm_gizmo.cc:649
void WM_gizmo_properties_create(PointerRNA *ptr, const StringRef gtstring)
Definition wm_gizmo.cc:594
void WM_gizmo_set_color(wmGizmo *gz, const float color[4])
Definition wm_gizmo.cc:331
int wm_gizmo_is_visible(wmGizmo *gz)
Definition wm_gizmo.cc:501
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:145