Blender V4.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
9#include <new>
10
11#include "MEM_guardedalloc.h"
12
13#include "BLI_listbase.h"
14#include "BLI_math_matrix.h"
15
16#include "BKE_context.hh"
17
18#include "GPU_batch.hh"
19
20#include "RNA_access.hh"
21#include "RNA_define.hh"
22#include "RNA_prototypes.hh"
23
24#include "BKE_global.hh"
25#include "BKE_idprop.hh"
26#include "BKE_main.hh"
27
28#include "WM_api.hh"
29#include "WM_toolsystem.hh"
30#include "WM_types.hh"
31
32#include "ED_screen.hh"
33#include "ED_view3d.hh"
34
35#ifdef WITH_PYTHON
36# include "BPY_extern.hh"
37#endif
38
39/* Own includes. */
40#include "wm_gizmo_intern.hh"
41#include "wm_gizmo_wmapi.hh"
42
43static void wm_gizmo_register(wmGizmoGroup *gzgroup, wmGizmo *gz);
44
48static wmGizmo *wm_gizmo_create(const wmGizmoType *gzt, PointerRNA *properties)
49{
50 BLI_assert(gzt != nullptr);
51 BLI_assert(gzt->struct_size >= sizeof(wmGizmo));
52
53 /* FIXME: Old C-style over-allocation is not trivial to port to C++, so for now keep it that way
54 * and use a placement new for C++ construction. */
55 wmGizmo *gz = static_cast<wmGizmo *>(MEM_callocN(
56 gzt->struct_size + (sizeof(wmGizmoProperty) * gzt->target_property_defs_len), __func__));
57 new (gz) wmGizmo();
58 gz->type = gzt;
59
60 /* Initialize properties, either copy or create. */
61 gz->ptr = MEM_new<PointerRNA>("wmGizmoPtrRNA");
62 if (properties && properties->data) {
63 gz->properties = IDP_CopyProperty(static_cast<const IDProperty *>(properties->data));
64 }
65 else {
66 gz->properties = blender::bke::idprop::create_group("wmGizmoProperties").release();
67 }
68 *gz->ptr = RNA_pointer_create(static_cast<ID *>(G_MAIN->wm.first), gzt->srna, gz->properties);
69
71
75
76 gz->drag_part = -1;
77
78 return gz;
79}
80
81wmGizmo *WM_gizmo_new_ptr(const wmGizmoType *gzt, wmGizmoGroup *gzgroup, PointerRNA *properties)
82{
83 wmGizmo *gz = wm_gizmo_create(gzt, properties);
84
85 wm_gizmo_register(gzgroup, gz);
86
87 if (gz->type->setup != nullptr) {
88 gz->type->setup(gz);
89 }
90
91 return gz;
92}
93
94wmGizmo *WM_gizmo_new(const char *idname, wmGizmoGroup *gzgroup, PointerRNA *properties)
95{
96 const wmGizmoType *gzt = WM_gizmotype_find(idname, false);
97 return WM_gizmo_new_ptr(gzt, gzgroup, properties);
98}
99
103static void gizmo_init(wmGizmo *gz)
104{
105 const float color_default[4] = {1.0f, 1.0f, 1.0f, 1.0f};
106
107 gz->scale_basis = 1.0f;
108 gz->line_width = 1.0f;
109
110 /* Defaults. */
111 copy_v4_v4(gz->color, color_default);
112 copy_v4_v4(gz->color_hi, color_default);
113}
114
120static void wm_gizmo_register(wmGizmoGroup *gzgroup, wmGizmo *gz)
121{
122 gizmo_init(gz);
123 wm_gizmogroup_gizmo_register(gzgroup, gz);
124}
125
127{
128 if (gz->type->free != nullptr) {
129 gz->type->free(gz);
130 }
131
132#ifdef WITH_PYTHON
133 if (gz->py_instance) {
134 /* Do this first in case there are any `__del__` functions or
135 * similar that use properties. */
137 }
138#endif
139
140 for (wmGizmoOpElem &gzop : gz->op_data) {
142 }
143
144 if (gz->ptr != nullptr) {
146 MEM_delete(gz->ptr);
147 }
148
149 if (gz->type->target_property_defs_len != 0) {
151 for (int i = 0; i < gz->type->target_property_defs_len; i++) {
152 wmGizmoProperty *gz_prop = &gz_prop_array[i];
153 if (gz_prop->custom_func.free_fn) {
154 gz_prop->custom_func.free_fn(gz, gz_prop);
155 }
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(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/* -------------------------------------------------------------------- */
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{
230 /* Merge tool-settings into the gizmo properties. */
231 PointerRNA tref_ptr;
233 if (tref && WM_toolsystem_ref_properties_get_from_operator(tref, gzop->type, &tref_ptr)) {
234 if (gzop->ptr.data == nullptr) {
235 gzop->ptr.data = blender::bke::idprop::create_group("wmOperatorProperties").release();
236 }
237 IDP_MergeGroup(static_cast<IDProperty *>(gzop->ptr.data),
238 static_cast<const IDProperty *>(tref_ptr.data),
239 false);
240 }
241 }
242 return WM_operator_name_call_ptr(C, gzop->type, WM_OP_INVOKE_DEFAULT, &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
341 /* Gizmo Creation API. */
342
343/* -------------------------------------------------------------------- */
351
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 }
375 gz->state &= ~WM_GIZMO_STATE_SELECT;
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)) {
409 wm_gizmomap_highlight_set(gzmap, C, gz, gz->highlight_part);
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. */
425 WM_operator_name_call(C, "GIZMOGROUP_OT_gizmo_tweak", WM_OP_INVOKE_DEFAULT, nullptr, event);
426 }
427}
428
430 bContext *C,
431 wmGizmo *gz,
432 const wmEvent *event)
433{
434 if (gzmap->gzmap_context.modal) {
435 wm_gizmomap_modal_set(gzmap, C, gzmap->gzmap_context.modal, event, false);
436 }
437
438 if (gz) {
440
441 /* Set `highlight_part` to -1 to skip operator invocation. */
442 const int highlight_part = gz->highlight_part;
443 gz->highlight_part = -1;
444 wm_gizmomap_modal_set(gzmap, C, gz, event, true);
445 gz->highlight_part = highlight_part;
446 }
447}
448
450{
451 const RegionView3D *rv3d = CTX_wm_region_view3d(C);
452 float scale = UI_SCALE_FAC;
453
454 if ((gz->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_SCALE) == 0) {
455 scale *= U.gizmo_size;
456 if (rv3d) {
457 /* 'ED_view3d_pixel_size' includes 'U.pixelsize', remove it. */
458 float matrix_world[4][4];
459 if (gz->type->matrix_basis_get) {
460 float matrix_basis[4][4];
461 gz->type->matrix_basis_get(gz, matrix_basis);
462 mul_m4_m4m4(matrix_world, gz->matrix_space, matrix_basis);
463 }
464 else {
465 mul_m4_m4m4(matrix_world, gz->matrix_space, gz->matrix_basis);
466 }
467
468 /* Exclude matrix_offset from scale. */
469 scale *= ED_view3d_pixel_size_no_ui_scale(rv3d, matrix_world[3]);
470 }
471 }
472
473 gz->scale_final = gz->scale_basis * scale;
474}
475
477{
478 /* Gizmo property might have been changed, so update gizmo. */
479 if (gz->type->property_update) {
481 for (int i = 0; i < gz->type->target_property_defs_len; i++) {
482 wmGizmoProperty *gz_prop = &gz_prop_array[i];
484 gz->type->property_update(gz, gz_prop);
485 }
486 }
487 }
488}
489
490void wm_gizmo_update(wmGizmo *gz, const bContext *C, const bool refresh_map)
491{
492 if (refresh_map) {
494 }
496}
497
499{
500 if (gz->flag & WM_GIZMO_HIDDEN) {
501 return 0;
502 }
503 if ((gz->state & WM_GIZMO_STATE_MODAL) &&
505 {
506 /* Don't draw while modal (dragging). */
507 return 0;
508 }
509 if ((gz->flag & WM_GIZMO_DRAW_HOVER) && !(gz->state & WM_GIZMO_STATE_HIGHLIGHT) &&
510 !(gz->state & WM_GIZMO_STATE_SELECT)) /* Still draw selected gizmos. */
511 {
512 /* Update but don't draw. */
514 }
515
517}
518
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
562 params.matrix_space = nullptr;
563 params.matrix_basis = nullptr;
564 params.matrix_offset = mat_identity;
565 params.scale_final = nullptr;
567}
568
569void WM_gizmo_calc_matrix_final(const wmGizmo *gz, float r_mat[4][4])
570{
572 params.matrix_space = nullptr;
573 params.matrix_basis = nullptr;
574 params.matrix_offset = nullptr;
575 params.scale_final = nullptr;
577}
578
579/* -------------------------------------------------------------------- */
587{
588 *ptr = RNA_pointer_create(nullptr, gzt->srna, nullptr);
589}
590
591void WM_gizmo_properties_create(PointerRNA *ptr, const char *gtstring)
592{
593 const wmGizmoType *gzt = WM_gizmotype_find(gtstring, false);
594
595 if (gzt) {
597 }
598 else {
599 *ptr = RNA_pointer_create(nullptr, &RNA_GizmoProperties, nullptr);
600 }
601}
602
603void WM_gizmo_properties_alloc(PointerRNA **ptr, IDProperty **properties, const char *gtstring)
604{
605 if (*properties == nullptr) {
606 *properties = blender::bke::idprop::create_group("wmOpItemProp").release();
607 }
608
609 if (*ptr == nullptr) {
610 *ptr = MEM_new<PointerRNA>("wmOpItemPtr");
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: {
631
632 /* Recurse into gizmo properties. */
633 if (RNA_struct_is_a(ptype, &RNA_GizmoProperties)) {
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: {
653 if (ptype != &RNA_Struct) {
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(ptr, prop, -1)) {
662 changed = true;
663 }
664 }
665 break;
666 }
667 }
669
670 return changed;
671}
672
674{
675 if (gz->ptr->data) {
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_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
712/* -------------------------------------------------------------------- */
717{
718 switch (step) {
720 break;
721 }
725 return false;
726 }
727 break;
728 }
729 }
730 return true;
731}
732
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:1227
void IDP_ClearProperty(IDProperty *prop)
Definition idprop.cc:1233
IDProperty * IDP_CopyProperty(const IDProperty *prop) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition idprop.cc:861
void IDP_MergeGroup(IDProperty *dest, const IDProperty *src, bool do_overwrite) ATTR_NONNULL()
Definition idprop.cc:717
#define BLI_assert(a)
Definition BLI_assert.h:50
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:130
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 unit_m4(float m[4][4])
Definition rct.c:1127
void copy_m4_m4(float m1[4][4], const float m2[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:69
@ PROP_POINTER
Definition RNA_types.hh:70
@ PROP_ENUM_NO_CONTEXT
Definition RNA_types.hh:319
@ PROP_SKIP_SAVE
Definition RNA_types.hh:245
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)
@ WM_OP_INVOKE_DEFAULT
Definition WM_types.hh:218
unsigned int U
Definition btGjkEpa3.h:78
int64_t size() const
void resize(const int64_t new_size)
draw_view in_light_buf[] float
#define rot(x, k)
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void MEM_freeN(void *vmemh)
Definition mallocn.cc:105
void *(* MEM_callocN)(size_t len, const char *str)
Definition mallocn.cc:42
ccl_device_inline float4 select(const int4 mask, const float4 a, const float4 b)
std::unique_ptr< IDProperty, IDPropertyDeleter > create_group(StringRefNull 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(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:413
void * data
Definition RNA_types.hh:42
eWM_GizmoFlagGroupTypeFlag flag
wmGizmoGroupType * type
struct wmGizmoMap::@1370 gzmap_context
Gizmo map runtime context.
wmGizmo * modal
wmGizmo * highlight
wmOperatorType * type
struct wmGizmoProperty::@1373 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
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
int WM_operator_name_call_ptr(bContext *C, wmOperatorType *ot, wmOperatorCallContext context, PointerRNA *properties, const wmEvent *event)
int WM_operator_name_call(bContext *C, const char *opstring, wmOperatorCallContext context, PointerRNA *properties, const wmEvent *event)
PointerRNA * ptr
Definition wm_files.cc:4126
wmOperatorType * ot
Definition wm_files.cc:4125
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_gizmo_set_matrix_offset_location(wmGizmo *gz, const float offset[3])
Definition wm_gizmo.cc:298
void WM_gizmo_modal_set_from_setup(wmGizmoMap *gzmap, bContext *C, wmGizmo *gz, int part_index, const wmEvent *event)
Definition wm_gizmo.cc:415
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:716
static void wm_gizmo_register(wmGizmoGroup *gzgroup, wmGizmo *gz)
Definition wm_gizmo.cc:120
static void gizmo_update_prop_data(wmGizmo *gz)
Definition wm_gizmo.cc:476
void WM_gizmo_modal_set_while_modal(wmGizmoMap *gzmap, bContext *C, wmGizmo *gz, const wmEvent *event)
Definition wm_gizmo.cc:429
void WM_gizmo_set_color_highlight(wmGizmo *gz, const float color_hi[4])
Definition wm_gizmo.cc:336
void WM_gizmo_set_line_width(wmGizmo *gz, const float line_width)
Definition wm_gizmo.cc:318
void WM_gizmo_calc_matrix_final_params(const wmGizmo *gz, const WM_GizmoMatrixParams *params, float r_mat[4][4])
Definition wm_gizmo.cc:519
bool wm_gizmo_select_and_highlight(bContext *C, wmGizmoMap *gzmap, wmGizmo *gz)
Definition wm_gizmo.cc:406
void WM_gizmo_get_color_highlight(const wmGizmo *gz, float color_hi[4])
Definition wm_gizmo.cc:332
void WM_gizmo_set_fn_custom_modal(wmGizmo *gz, wmGizmoFnModal fn)
Definition wm_gizmo.cc:347
void WM_gizmo_free(wmGizmo *gz)
Definition wm_gizmo.cc:126
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
void WM_gizmo_calc_matrix_final(const wmGizmo *gz, float r_mat[4][4])
Definition wm_gizmo.cc:569
int WM_gizmo_operator_invoke(bContext *C, wmGizmo *gz, wmGizmoOpElem *gzop, const wmEvent *event)
Definition wm_gizmo.cc:227
wmGizmo * WM_gizmo_new(const char *idname, wmGizmoGroup *gzgroup, PointerRNA *properties)
Definition wm_gizmo.cc:94
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
void WM_gizmo_properties_create_ptr(PointerRNA *ptr, wmGizmoType *gzt)
Definition wm_gizmo.cc:586
wmGizmo * WM_gizmo_new_ptr(const wmGizmoType *gzt, wmGizmoGroup *gzgroup, PointerRNA *properties)
Definition wm_gizmo.cc:81
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
void WM_gizmo_get_color(const wmGizmo *gz, float color[4])
Definition wm_gizmo.cc:323
void WM_gizmo_calc_matrix_final_no_offset(const wmGizmo *gz, float r_mat[4][4])
Definition wm_gizmo.cc:556
static wmGizmo * wm_gizmo_create(const wmGizmoType *gzt, PointerRNA *properties)
Definition wm_gizmo.cc:48
void wm_gizmo_update(wmGizmo *gz, const bContext *C, const bool refresh_map)
Definition wm_gizmo.cc:490
bool WM_gizmo_highlight_set(wmGizmoMap *gzmap, wmGizmo *gz)
Definition wm_gizmo.cc:401
void WM_gizmo_set_matrix_offset_rotation_from_z_axis(wmGizmo *gz, const float z_axis[3])
Definition wm_gizmo.cc:288
static void gizmo_init(wmGizmo *gz)
Definition wm_gizmo.cc:103
void WM_gizmo_set_scale(wmGizmo *gz, const float scale)
Definition wm_gizmo.cc:313
void WM_gizmo_set_matrix_location(wmGizmo *gz, const float origin[3])
Definition wm_gizmo.cc:283
bool WM_gizmo_select_unlink(wmGizmoMap *gzmap, wmGizmo *gz)
Definition wm_gizmo.cc:391
void WM_gizmo_set_flag(wmGizmo *gz, const int flag, const bool enable)
Definition wm_gizmo.cc:303
void WM_gizmo_set_matrix_rotation_from_z_axis(wmGizmo *gz, const float z_axis[3])
Definition wm_gizmo.cc:273
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 WM_gizmo_select_set(wmGizmoMap *gzmap, wmGizmo *gz, bool select)
Definition wm_gizmo.cc:396
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:617
void WM_gizmo_properties_free(PointerRNA *ptr)
Definition wm_gizmo.cc:700
void WM_gizmo_properties_reset(wmGizmo *gz)
Definition wm_gizmo.cc:673
void WM_gizmo_properties_clear(PointerRNA *ptr)
Definition wm_gizmo.cc:691
void wm_gizmo_calculate_scale(wmGizmo *gz, const bContext *C)
Definition wm_gizmo.cc:449
bool WM_gizmo_properties_default(PointerRNA *ptr, const bool do_update)
Definition wm_gizmo.cc:646
void WM_gizmo_properties_create(PointerRNA *ptr, const char *gtstring)
Definition wm_gizmo.cc:591
void WM_gizmo_set_color(wmGizmo *gz, const float color[4])
Definition wm_gizmo.cc:327
int wm_gizmo_is_visible(wmGizmo *gz)
Definition wm_gizmo.cc:498
void WM_gizmo_properties_alloc(PointerRNA **ptr, IDProperty **properties, const char *gtstring)
Definition wm_gizmo.cc:603
void WM_gizmo_unlink(ListBase *gizmolist, wmGizmoMap *gzmap, wmGizmo *gz, bContext *C)
Definition wm_gizmo.cc:165
int(*)(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)
bool WM_gizmo_target_property_is_valid(const wmGizmoProperty *gz_prop)
wmGizmoProperty * WM_gizmo_target_property_array(wmGizmo *gz)
const wmGizmoType * WM_gizmotype_find(const char *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:138