Blender V5.3
editmesh_extrude_spin_gizmo.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "BLI_listbase.hh"
10#include "BLI_math_geom_c.hh"
11#include "BLI_math_matrix_c.hh"
13#include "BLI_math_vector_c.hh"
14
15#include "BKE_context.hh"
16#include "BKE_scene.hh"
17#include "BKE_screen.hh"
18
19#include "RNA_access.hh"
20#include "RNA_define.hh"
21#include "RNA_enum_types.hh"
22
23#include "WM_api.hh"
24#include "WM_message.hh"
25#include "WM_toolsystem.hh"
26#include "WM_types.hh"
27
28#include "ED_gizmo_utils.hh"
29#include "ED_screen.hh"
30#include "ED_view3d.hh"
31
32#include "UI_resources.hh"
33
34#include "MEM_guardedalloc.h"
35
36#include "mesh_intern.hh" /* own include */
37
38#include "ED_transform.hh"
39
40#include "ED_gizmo_library.hh"
41#include "ED_undo.hh"
42
43namespace blender {
44
48/* Disable for now, issues w/ refresh and '+' icons overlap. */
49// #define USE_SELECT_CENTER
50
51#ifdef USE_SELECT_CENTER
52# include "BKE_editmesh.hh"
53#endif
54
55static const float dial_angle_partial = M_PI_2;
56static const float dial_angle_partial_margin = 0.92f;
57
58#define ORTHO_AXIS_OFFSET 2
59
60/* -------------------------------------------------------------------- */
63
65 struct {
66 wmGizmo *xyz_view[4];
67 wmGizmo *icon_button[3][2];
69
70 /* Only for view orientation. */
71 struct {
72 float viewinv_m3[3][3];
74
75 /* We could store more vars here! */
76 struct {
79 float orient_mat[3][3];
80#ifdef USE_SELECT_CENTER
81 float select_center[3];
82 float select_center_ortho_axis[3][3];
83 bool use_select_center;
84#endif
86
87 /* Store data for invoke. */
88 struct {
91};
92
93/* Use dials only as a visualization when hovering over the icons. */
94#define USE_DIAL_HOVER
95
96#define INIT_SCALE_BASE 2.3f
97#define INIT_SCALE_BUTTON 0.15f
98
99static const uchar shape_plus[] = {
100 0x73, 0x73, 0x73, 0x36, 0x8c, 0x36, 0x8c, 0x73, 0xc9, 0x73, 0xc9, 0x8c, 0x8c,
101 0x8c, 0x8c, 0xc9, 0x73, 0xc9, 0x73, 0x8c, 0x36, 0x8c, 0x36, 0x73, 0x36, 0x73,
102};
103
104static void gizmo_mesh_spin_init_setup(const bContext * /*C*/, wmGizmoGroup *gzgroup)
105{
106 /* alpha values for normal/highlighted states */
107 const float alpha = 0.6f;
108 const float alpha_hi = 1.0f;
109 const float scale_base = INIT_SCALE_BASE;
110 const float scale_button = INIT_SCALE_BUTTON;
111
113 gzgroup->customdata = ggd;
114 const wmGizmoType *gzt_dial = WM_gizmotype_find("GIZMO_GT_dial_3d", true);
115 const wmGizmoType *gzt_button = WM_gizmotype_find("GIZMO_GT_button_2d", true);
116
117 for (int i = 0; i < 3; i++) {
118 for (int j = 0; j < 2; j++) {
119 wmGizmo *gz = WM_gizmo_new_ptr(gzt_button, gzgroup, nullptr);
120 PropertyRNA *prop = RNA_struct_find_property(gz->ptr, "shape");
122 gz->ptr, prop, reinterpret_cast<const char *>(shape_plus), ARRAY_SIZE(shape_plus));
123
124 RNA_enum_set(gz->ptr, "draw_options", ED_GIZMO_BUTTON_SHOW_BACKDROP);
125
126 float color[4];
128 color[3] = alpha;
130
131 WM_gizmo_set_scale(gz, scale_button);
132 gz->color[3] = 0.6f;
133
135
136 ggd->gizmos.icon_button[i][j] = gz;
137 }
138 }
139
140 for (int i = 0; i < ARRAY_SIZE(ggd->gizmos.xyz_view); i++) {
141 wmGizmo *gz = WM_gizmo_new_ptr(gzt_dial, gzgroup, nullptr);
144 ggd->gizmos.xyz_view[i] = gz;
145 }
146
147 for (int i = 0; i < 3; i++) {
148 wmGizmo *gz = ggd->gizmos.xyz_view[i];
149#ifndef USE_DIAL_HOVER
150 RNA_enum_set(gz->ptr, "draw_options", ED_GIZMO_DIAL_DRAW_FLAG_CLIP);
151#endif
152 WM_gizmo_set_line_width(gz, 2.0f);
153 float color[4];
155 color[3] = alpha;
157 color[3] = alpha_hi;
160 RNA_float_set(gz->ptr,
161 "arc_partial_angle",
163 }
164
165 {
166 wmGizmo *gz = ggd->gizmos.xyz_view[3];
167 WM_gizmo_set_line_width(gz, 2.0f);
168 float color[4];
169 copy_v3_fl(color, 1.0f);
170 color[3] = alpha;
172 color[3] = alpha_hi;
174 WM_gizmo_set_scale(gz, scale_base);
175 }
176
177#ifdef USE_DIAL_HOVER
178 for (int i = 0; i < 4; i++) {
179 wmGizmo *gz = ggd->gizmos.xyz_view[i];
181 }
182#endif
183
184 ggd->data.ot_spin = WM_operatortype_find("MESH_OT_spin", true);
185 ggd->data.gzgt_axis_prop = RNA_struct_type_find_property(gzgroup->type->srna, "axis");
186}
187
188static void gizmo_mesh_spin_init_refresh(const bContext *C, wmGizmoGroup *gzgroup);
189
191 int axis_index,
192 const float axis_vec[3],
193 const float axis_tan[3])
194{
195 GizmoGroupData_SpinInit *ggd = static_cast<GizmoGroupData_SpinInit *>(gzgroup->customdata);
196 wmGizmo *gz = ggd->gizmos.xyz_view[axis_index];
197 if (axis_tan != nullptr) {
198 WM_gizmo_set_matrix_rotation_from_yz_axis(gz, axis_tan, axis_vec);
199 }
200 else {
202 }
203
204/* Only for display, use icons to access. */
205#ifndef USE_DIAL_HOVER
206 {
207 PointerRNA *ptr = WM_gizmo_operator_set(gz, 0, ggd->data.ot_spin, nullptr);
208 RNA_float_set_array(ptr, "axis", axis_vec);
209 }
210#endif
211 if (axis_index < 3) {
212 for (int j = 0; j < 2; j++) {
213 gz = ggd->gizmos.icon_button[axis_index][j];
214 PointerRNA *ptr = WM_gizmo_operator_set(gz, 0, ggd->data.ot_spin, nullptr);
215 float axis_vec_flip[3];
216 if (0 == j) {
217 negate_v3_v3(axis_vec_flip, axis_vec);
218 }
219 else {
220 copy_v3_v3(axis_vec_flip, axis_vec);
221 }
222 RNA_float_set_array(ptr, "axis", axis_vec_flip);
223 }
224 }
225}
226
228{
229 GizmoGroupData_SpinInit *ggd = static_cast<GizmoGroupData_SpinInit *>(gzgroup->customdata);
231 float viewinv_m3[3][3];
232 copy_m3_m4(viewinv_m3, rv3d->viewinv);
233
234 {
235 Scene *scene = CTX_data_scene(C);
237 scene, SCE_ORIENT_ROTATE);
238 switch (orient_slot->type) {
239 case V3D_ORIENT_VIEW: {
240 if (!equals_m3m3(viewinv_m3, ggd->prev.viewinv_m3)) {
241 /* Take care calling refresh from draw_prepare,
242 * this should be OK because it's only adjusting the cage orientation. */
244 }
245 break;
246 }
247 }
248 }
249
250 /* Refresh handled above when using view orientation. */
251 if (!equals_m3m3(viewinv_m3, ggd->prev.viewinv_m3)) {
252 gizmo_mesh_spin_init_refresh_axis_orientation(gzgroup, 3, rv3d->viewinv[2], nullptr);
253 copy_m3_m4(ggd->prev.viewinv_m3, rv3d->viewinv);
254 }
255
256/* Hack! highlight XYZ dials based on buttons */
257#ifdef USE_DIAL_HOVER
258 {
259 PointerRNA ptr;
260 bToolRef *tref = WM_toolsystem_ref_from_context(const_cast<bContext *>(C));
262 const int axis_flag = RNA_property_enum_get(&ptr, ggd->data.gzgt_axis_prop);
263 for (int i = 0; i < 4; i++) {
264 bool hide = (axis_flag & (1 << i)) == 0;
265 wmGizmo *gz = ggd->gizmos.xyz_view[i];
267 if (!hide) {
268 RNA_float_set(gz->ptr,
269 "arc_partial_angle",
271 }
272 }
273
274 for (int i = 0; i < 3; i++) {
275 for (int j = 0; j < 2; j++) {
276 wmGizmo *gz = ggd->gizmos.icon_button[i][j];
278 WM_gizmo_set_flag(ggd->gizmos.xyz_view[i], WM_GIZMO_HIDDEN, false);
279 RNA_float_set(ggd->gizmos.xyz_view[i]->ptr, "arc_partial_angle", 0.0f);
280 i = 3;
281 break;
282 }
283 }
284 }
285 }
286#endif
287}
288
290 wmGizmoGroup *gzgroup,
291 wmGizmo *gz,
292 const wmEvent * /*event*/)
293{
294 /* Set the initial ortho axis. */
295 GizmoGroupData_SpinInit *ggd = static_cast<GizmoGroupData_SpinInit *>(gzgroup->customdata);
296 ggd->invoke.ortho_axis_active = -1;
297 for (int i = 0; i < 3; i++) {
298 if (ELEM(gz, UNPACK2(ggd->gizmos.icon_button[i]))) {
299 ggd->invoke.ortho_axis_active = i;
300 break;
301 }
302 }
303}
304
306{
307 GizmoGroupData_SpinInit *ggd = static_cast<GizmoGroupData_SpinInit *>(gzgroup->customdata);
308 RegionView3D *rv3d = ED_view3d_context_rv3d(const_cast<bContext *>(C));
309 const float *gizmo_center = nullptr;
310 {
311 Scene *scene = CTX_data_scene(C);
312 const View3DCursor *cursor = &scene->cursor;
313 gizmo_center = cursor->location;
314 }
315
316 for (int i = 0; i < ARRAY_SIZE(ggd->gizmos.xyz_view); i++) {
317 wmGizmo *gz = ggd->gizmos.xyz_view[i];
318 WM_gizmo_set_matrix_location(gz, gizmo_center);
319 }
320
321 for (int i = 0; i < ARRAY_SIZE(ggd->gizmos.icon_button); i++) {
322 for (int j = 0; j < 2; j++) {
323 wmGizmo *gz = ggd->gizmos.icon_button[i][j];
324 WM_gizmo_set_matrix_location(gz, gizmo_center);
325 }
326 }
327
329 for (int i = 0; i < 3; i++) {
330 const int axis_ortho = (i + ORTHO_AXIS_OFFSET) % 3;
331 const float *axis_ortho_vec = ggd->data.orient_mat[axis_ortho];
332#ifdef USE_SELECT_CENTER
333 if (ggd->data.use_select_center) {
334 float delta[3];
335 sub_v3_v3v3(delta, ggd->data.select_center, gizmo_center);
337 ggd->data.select_center_ortho_axis[i], delta, ggd->data.orient_mat[i]);
338 if (normalize_v3(ggd->data.select_center_ortho_axis[i]) != 0.0f) {
339 axis_ortho_vec = ggd->data.select_center_ortho_axis[i];
340 }
341 }
342#endif
344 gzgroup, i, ggd->data.orient_mat[i], axis_ortho_vec);
345 }
346
347 {
348 gizmo_mesh_spin_init_refresh_axis_orientation(gzgroup, 3, rv3d->viewinv[2], nullptr);
349 }
350
351#ifdef USE_SELECT_CENTER
352 {
353 Object *obedit = CTX_data_edit_object(C);
355 float select_center[3] = {0};
356 int totsel = 0;
357
358 BMVert *eve;
359 BMIter iter;
360
361 BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
364 totsel++;
365 add_v3_v3(select_center, eve->co);
366 }
367 }
368 }
369 if (totsel) {
370 mul_v3_fl(select_center, 1.0f / totsel);
371 mul_m4_v3(obedit->object_to_world().ptr(), select_center);
372 copy_v3_v3(ggd->data.select_center, select_center);
373 ggd->data.use_select_center = true;
374 }
375 else {
376 ggd->data.use_select_center = false;
377 }
378 }
379#endif
380
381 for (int i = 0; i < ARRAY_SIZE(ggd->gizmos.icon_button); i++) {
382 const int axis_ortho = (i + ORTHO_AXIS_OFFSET) % 3;
383 const float *axis_ortho_vec = ggd->data.orient_mat[axis_ortho];
384 float offset = INIT_SCALE_BASE / INIT_SCALE_BUTTON;
385 float offset_vec[3];
386
387#ifdef USE_SELECT_CENTER
388 if (ggd->data.use_select_center && !is_zero_v3(ggd->data.select_center_ortho_axis[i])) {
389 axis_ortho_vec = ggd->data.select_center_ortho_axis[i];
390 }
391#endif
392
393 mul_v3_v3fl(offset_vec, axis_ortho_vec, offset);
394 for (int j = 0; j < 2; j++) {
395 wmGizmo *gz = ggd->gizmos.icon_button[i][j];
396 float mat3[3][3];
397 axis_angle_to_mat3(mat3, ggd->data.orient_mat[i], dial_angle_partial * (j ? -0.5f : 0.5f));
398 mul_v3_m3v3(gz->matrix_offset[3], mat3, offset_vec);
399 }
400 }
401
402 {
403 PointerRNA ptr;
404 bToolRef *tref = WM_toolsystem_ref_from_context(const_cast<bContext *>(C));
406 const int axis_flag = RNA_property_enum_get(&ptr, ggd->data.gzgt_axis_prop);
407 for (int i = 0; i < ARRAY_SIZE(ggd->gizmos.icon_button); i++) {
408 for (int j = 0; j < 2; j++) {
409 wmGizmo *gz = ggd->gizmos.icon_button[i][j];
410 WM_gizmo_set_flag(gz, WM_GIZMO_HIDDEN, (axis_flag & (1 << i)) == 0);
411 }
412 }
413 }
414
415 /* Needed to test view orientation changes. */
416 copy_m3_m4(ggd->prev.viewinv_m3, rv3d->viewinv);
417}
418
420 wmGizmoGroup *gzgroup,
421 wmMsgBus *mbus)
422{
423 GizmoGroupData_SpinInit *ggd = static_cast<GizmoGroupData_SpinInit *>(gzgroup->customdata);
424 Scene *scene = CTX_data_scene(C);
425 ARegion *region = CTX_wm_region(C);
426
427 /* Subscribe to view properties */
428 wmMsgSubscribeValue msg_sub_value_gz_tag_refresh{};
429 msg_sub_value_gz_tag_refresh.owner = region;
430 msg_sub_value_gz_tag_refresh.user_data = gzgroup->parent_gzmap;
431 msg_sub_value_gz_tag_refresh.notify = WM_gizmo_do_msg_notify_tag_refresh;
432
434 &scene->id, RNA_View3DCursor, &scene->cursor);
435 /* All cursor properties. */
436 WM_msg_subscribe_rna(mbus, &cursor_ptr, nullptr, &msg_sub_value_gz_tag_refresh, __func__);
437
438 wmMsgParams_RNA params{};
439 params.ptr.type = gzgroup->type->srna;
440 params.prop = ggd->data.gzgt_axis_prop,
441 WM_msg_subscribe_rna_params(mbus, &params, &msg_sub_value_gz_tag_refresh, __func__);
442}
443
445{
446 gzgt->name = "Mesh Spin Init";
447 gzgt->idname = "MESH_GGT_spin";
448
450
453
456 /* This works well with right click selection but overrides left-mouse selection
457 * when clicking which is needed to create a full 360 degree revolution, see: #89912. */
458 // gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_maybe_drag;
463
464 RNA_def_enum_flag(gzgt->srna, "axis", rna_enum_axis_flag_xyz_items, (1 << 2), "Axis", "");
465}
466
467#undef INIT_SCALE_BASE
468#undef INIT_SCALE_BUTTON
469
471
472/* -------------------------------------------------------------------- */
475
481#define USE_ANGLE_Z_ORIENT
482
484 /* Translate XYZ. */
486 /* Spin angle */
488
489 /* Translate XY constrained ('orient_mat'). */
491 /* Rotate XY constrained ('orient_mat'). */
493
494 /* Rotate on view axis. */
496
497 struct {
498 float plane_co[3];
499 float plane_no[3];
501
503
504 /* We could store more vars here! */
505 struct {
508 wmOperator *op;
512
513#ifdef USE_ANGLE_Z_ORIENT
514 /* Apply 'orient_mat' for the final value. */
515 float orient_axis_relative[3];
516#endif
517 /* The orientation, since the operator doesn't store this, we store our own.
518 * this is kept in sync with the operator,
519 * rotating the orientation when it doesn't match.
520 *
521 * Initialize to a sensible value where possible.
522 */
523 float orient_mat[3][3];
524
526};
527
534{
535 if (ggd->is_init) {
536 wmGizmo *gz = ggd->angle_z;
537 PropertyRNA *prop = RNA_struct_find_property(gz->ptr, "click_value");
538 RNA_property_unset(gz->ptr, prop);
539 ggd->is_init = false;
540 }
541
542 wmOperator *op = ggd->data.op;
543 if (op == WM_operator_last_redo(ggd->data.context)) {
544 ED_undo_operator_repeat(ggd->data.context, op);
545 }
546}
547
549 const float plane_no[3])
550{
551 float mat[3][3];
552 rotation_between_vecs_to_mat3(mat, ggd->data.orient_mat[2], plane_no);
553 mul_m3_m3m3(ggd->data.orient_mat, mat, ggd->data.orient_mat);
554 /* Not needed, just set for numeric stability. */
555 copy_v3_v3(ggd->data.orient_mat[2], plane_no);
556}
557
559{
560 wmOperator *op = ggd->data.op;
561 float plane_co[3], plane_no[3];
562 RNA_property_float_get_array(op->ptr, ggd->data.prop_axis_co, plane_co);
563 RNA_property_float_get_array(op->ptr, ggd->data.prop_axis_no, plane_no);
564 if (normalize_v3(plane_no) == 0.0f) [[unlikely]] {
565 return;
566 }
567 const bool is_plane_co_eq = equals_v3v3(plane_co, ggd->prev.plane_co);
568 const bool is_plane_no_eq = equals_v3v3(plane_no, ggd->prev.plane_no);
569 if (is_plane_co_eq && is_plane_no_eq) {
570 return;
571 }
572 copy_v3_v3(ggd->prev.plane_co, plane_co);
573 copy_v3_v3(ggd->prev.plane_no, plane_no);
574
575 if (is_plane_no_eq == false) {
577 }
578
579 for (int i = 0; i < 2; i++) {
580 WM_gizmo_set_matrix_location(ggd->rotate_xy[i], plane_co);
583 }
586 /* translate_c location comes from the property. */
587
588 for (int i = 0; i < 2; i++) {
590 WM_gizmo_set_matrix_rotation_from_z_axis(ggd->rotate_xy[i], ggd->data.orient_mat[i]);
591 }
592#ifdef USE_ANGLE_Z_ORIENT
593 {
594 float plane_tan[3];
595 float orient_axis[3];
596 mul_v3_m3v3(orient_axis, ggd->data.orient_mat, ggd->data.orient_axis_relative);
597 project_plane_normalized_v3_v3v3(plane_tan, orient_axis, plane_no);
598 if (normalize_v3(plane_tan) != 0.0f) {
599 WM_gizmo_set_matrix_rotation_from_yz_axis(ggd->angle_z, plane_tan, plane_no);
600 }
601 else {
603 }
604 }
605#else
607#endif
608}
609
610/* depth callbacks */
611static void gizmo_spin_prop_depth_get(const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p)
612{
615 wmOperator *op = ggd->data.op;
616 float *value = static_cast<float *>(value_p);
617
618 BLI_assert(gz_prop->type->array_length == 1);
619 UNUSED_VARS_NDEBUG(gz_prop);
620
621 const float *plane_no = gz->matrix_basis[2];
622 float plane_co[3];
623 RNA_property_float_get_array(op->ptr, ggd->data.prop_axis_co, plane_co);
624
625 value[0] = dot_v3v3(plane_no, plane_co) - dot_v3v3(plane_no, gz->matrix_basis[3]);
626}
627
628static void gizmo_spin_prop_depth_set(const wmGizmo *gz,
629 wmGizmoProperty *gz_prop,
630 const void *value_p)
631{
634 wmOperator *op = ggd->data.op;
635 const float *value = static_cast<const float *>(value_p);
636
637 BLI_assert(gz_prop->type->array_length == 1);
638 UNUSED_VARS_NDEBUG(gz_prop);
639
640 float plane_co[3], plane[4];
641 RNA_property_float_get_array(op->ptr, ggd->data.prop_axis_co, plane_co);
642 normalize_v3_v3(plane, gz->matrix_basis[2]);
643
644 plane[3] = -value[0] - dot_v3v3(plane, gz->matrix_basis[3]);
645
646 /* Keep our location, may be offset simply to be inside the viewport. */
647 closest_to_plane_normalized_v3(plane_co, plane, plane_co);
648
649 RNA_property_float_set_array(op->ptr, ggd->data.prop_axis_co, plane_co);
650
651 gizmo_spin_exec(ggd);
652}
653
654/* translate callbacks */
656 wmGizmoProperty *gz_prop,
657 void *value_p)
658{
661 wmOperator *op = ggd->data.op;
662 float *value = static_cast<float *>(value_p);
663
664 BLI_assert(gz_prop->type->array_length == 3);
665 UNUSED_VARS_NDEBUG(gz_prop);
666
667 RNA_property_float_get_array(op->ptr, ggd->data.prop_axis_co, value);
668}
669
671 wmGizmoProperty *gz_prop,
672 const void *value)
673{
676 wmOperator *op = ggd->data.op;
677
678 BLI_assert(gz_prop->type->array_length == 3);
679 UNUSED_VARS_NDEBUG(gz_prop);
680
681 RNA_property_float_set_array(op->ptr, ggd->data.prop_axis_co, static_cast<const float *>(value));
682
683 gizmo_spin_exec(ggd);
684}
685
686/* angle callbacks */
688 wmGizmoProperty *gz_prop,
689 void *value_p)
690{
693 wmOperator *op = ggd->data.op;
694 float *value = static_cast<float *>(value_p);
695
696 BLI_assert(gz_prop->type->array_length == 1);
697 UNUSED_VARS_NDEBUG(gz_prop);
698
699 float plane_no[4];
700 RNA_property_float_get_array(op->ptr, ggd->data.prop_axis_no, plane_no);
701 normalize_v3(plane_no);
702
703 const float *rotate_axis = gz->matrix_basis[2];
704 float rotate_up[3];
705 ortho_v3_v3(rotate_up, rotate_axis);
706
707 float plane_no_proj[3];
708 project_plane_normalized_v3_v3v3(plane_no_proj, plane_no, rotate_axis);
709
710 if (!is_zero_v3(plane_no_proj)) {
711 const float angle = -angle_signed_on_axis_v3v3_v3(plane_no_proj, rotate_up, rotate_axis);
712 value[0] = angle;
713 }
714 else {
715 value[0] = 0.0f;
716 }
717}
718
720 wmGizmoProperty *gz_prop,
721 const void *value_p)
722{
725 wmOperator *op = ggd->data.op;
726 const float *value = static_cast<const float *>(value_p);
727
728 BLI_assert(gz_prop->type->array_length == 1);
729 UNUSED_VARS_NDEBUG(gz_prop);
730
731 float plane_no[4];
732 RNA_property_float_get_array(op->ptr, ggd->data.prop_axis_no, plane_no);
733 normalize_v3(plane_no);
734
735 const float *rotate_axis = gz->matrix_basis[2];
736 float rotate_up[3];
737 ortho_v3_v3(rotate_up, rotate_axis);
738
739 float plane_no_proj[3];
740 project_plane_normalized_v3_v3v3(plane_no_proj, plane_no, rotate_axis);
741
742 if (!is_zero_v3(plane_no_proj)) {
743 const float angle = -angle_signed_on_axis_v3v3_v3(plane_no_proj, rotate_up, rotate_axis);
744 const float angle_delta = angle - angle_compat_rad(value[0], angle);
745 if (angle_delta != 0.0f) {
746 float mat[3][3];
747 axis_angle_normalized_to_mat3(mat, rotate_axis, angle_delta);
748 mul_m3_v3(mat, plane_no);
749
750 /* re-normalize - seems acceptable */
751 RNA_property_float_set_array(op->ptr, ggd->data.prop_axis_no, plane_no);
752
753 gizmo_spin_exec(ggd);
754 }
755 }
756}
757
758/* angle callbacks */
759static void gizmo_spin_prop_angle_get(const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p)
760{
763 wmOperator *op = ggd->data.op;
764 float *value = static_cast<float *>(value_p);
765
766 BLI_assert(gz_prop->type->array_length == 1);
767 UNUSED_VARS_NDEBUG(gz_prop);
768 value[0] = RNA_property_float_get(op->ptr, ggd->data.prop_angle);
769}
770
771static void gizmo_spin_prop_angle_set(const wmGizmo *gz,
772 wmGizmoProperty *gz_prop,
773 const void *value_p)
774{
777 wmOperator *op = ggd->data.op;
778 BLI_assert(gz_prop->type->array_length == 1);
779 UNUSED_VARS_NDEBUG(gz_prop);
780 const float *value = static_cast<const float *>(value_p);
781 RNA_property_float_set(op->ptr, ggd->data.prop_angle, value[0]);
782
783 gizmo_spin_exec(ggd);
784}
785
787{
788 if (ED_gizmo_poll_or_unlink_delayed_from_operator(C, gzgt, "MESH_OT_spin")) {
789 if (ED_gizmo_poll_or_unlink_delayed_from_tool_ex(C, gzgt, "MESH_GGT_spin")) {
790 return true;
791 }
792 }
793 return false;
794}
795
797{
798 /* Start off dragging. */
799 GizmoGroupData_SpinRedo *ggd = static_cast<GizmoGroupData_SpinRedo *>(gzgroup->customdata);
800 wmWindow *win = CTX_wm_window(C);
801 wmGizmo *gz = ggd->angle_z;
802 wmGizmoMap *gzmap = gzgroup->parent_gzmap;
803
804 ggd->is_init = true;
805
806 WM_gizmo_modal_set_from_setup(gzmap, const_cast<bContext *>(C), gz, 0, win->runtime->eventstate);
807}
808
810{
811 wmOperatorType *ot = WM_operatortype_find("MESH_OT_spin", true);
813
814 if ((op == nullptr) || (op->type != ot)) {
815 return;
816 }
817
819 gzgroup->customdata = ggd;
820
821 const wmGizmoType *gzt_arrow = WM_gizmotype_find("GIZMO_GT_arrow_3d", true);
822 const wmGizmoType *gzt_move = WM_gizmotype_find("GIZMO_GT_move_3d", true);
823 const wmGizmoType *gzt_dial = WM_gizmotype_find("GIZMO_GT_dial_3d", true);
824
825 /* Rotate View Axis (rotate_view) */
826 {
827 wmGizmo *gz = WM_gizmo_new_ptr(gzt_dial, gzgroup, nullptr);
829 zero_v4(gz->color);
830 copy_v3_fl(gz->color_hi, 1.0f);
831 gz->color_hi[3] = 0.1f;
833 RNA_enum_set(gz->ptr,
834 "draw_options",
837 ggd->rotate_view = gz;
838 }
839
840 /* Translate Center (translate_c) */
841 {
842 wmGizmo *gz = WM_gizmo_new_ptr(gzt_move, gzgroup, nullptr);
844 gz->color[3] = 0.6f;
845 RNA_enum_set(gz->ptr, "draw_style", ED_GIZMO_MOVE_STYLE_RING_2D);
847 WM_gizmo_set_scale(gz, 0.15);
848 WM_gizmo_set_line_width(gz, 2.0f);
849 ggd->translate_c = gz;
850 }
851
852 /* Spin Angle (angle_z) */
853 {
854 wmGizmo *gz = WM_gizmo_new_ptr(gzt_dial, gzgroup, nullptr);
855 copy_v3_v3(gz->color, gz->color_hi);
856 gz->color[3] = 0.5f;
857 RNA_boolean_set(gz->ptr, "wrap_angle", false);
859 RNA_float_set(gz->ptr, "arc_inner_factor", 0.9f);
860 RNA_float_set(gz->ptr, "click_value", M_PI * 2);
862 WM_gizmo_set_scale(gz, 2.0f);
863 WM_gizmo_set_line_width(gz, 1.0f);
864 ggd->angle_z = gz;
865 }
866
867 /* Translate X/Y Tangents (translate_xy) */
868 for (int i = 0; i < 2; i++) {
869 wmGizmo *gz = WM_gizmo_new_ptr(gzt_arrow, gzgroup, nullptr);
871 RNA_enum_set(gz->ptr, "draw_style", ED_GIZMO_ARROW_STYLE_NORMAL);
872 RNA_enum_set(gz->ptr, "draw_options", 0);
873 WM_gizmo_set_scale(gz, 1.2f);
874 ggd->translate_xy[i] = gz;
875 }
876
877 /* Rotate X/Y Tangents (rotate_xy) */
878 for (int i = 0; i < 2; i++) {
879 wmGizmo *gz = WM_gizmo_new_ptr(gzt_dial, gzgroup, nullptr);
881 gz->color[3] = 0.6f;
883 WM_gizmo_set_line_width(gz, 3.0f);
884 /* show the axis instead of mouse cursor */
885 RNA_enum_set(gz->ptr,
886 "draw_options",
889 ggd->rotate_xy[i] = gz;
890 }
891
892 {
893 ggd->data.context = const_cast<bContext *>(C);
894 ggd->data.ot = ot;
895 ggd->data.op = op;
896 ggd->data.prop_axis_co = RNA_struct_type_find_property(ot->srna, "center");
897 ggd->data.prop_axis_no = RNA_struct_type_find_property(ot->srna, "axis");
898 ggd->data.prop_angle = RNA_struct_type_find_property(ot->srna, "angle");
899 }
900
901 /* The spin operator only knows about an axis,
902 * while the manipulator has X/Y orientation for the gizmos.
903 * Initialize the orientation from the spin gizmo if possible.
904 */
905 {
906 ARegion *region = CTX_wm_region(C);
907 wmGizmoMap *gzmap = region->runtime->gizmo_map;
908 wmGizmoGroup *gzgroup_init = WM_gizmomap_group_find(gzmap, "MESH_GGT_spin");
909 /* NOTE(@ideasman42): the intention here is to initialize one gizmo from another.
910 * This works when activating the tool but can fail when switching tools & space types,
911 * In this case setting an identity matrix is used when changing contexts.
912 * Having a spin start in one region, then continuing to adjust this in another region
913 * with the orientation matrix properly set would be good to support though. See: #140339. */
914 if (gzgroup_init && gzgroup_init->customdata) {
915 GizmoGroupData_SpinInit *ggd_init = static_cast<GizmoGroupData_SpinInit *>(
916 gzgroup_init->customdata);
917 copy_m3_m3(ggd->data.orient_mat, ggd_init->data.orient_mat);
918 if (ggd_init->invoke.ortho_axis_active != -1) {
919 copy_v3_v3(ggd->data.orient_axis_relative,
920 ggd_init->gizmos.xyz_view[ggd_init->invoke.ortho_axis_active]->matrix_basis[1]);
921 ggd_init->invoke.ortho_axis_active = -1;
922 }
923 }
924 else {
925 unit_m3(ggd->data.orient_mat);
926 }
927 }
928
929#ifdef USE_ANGLE_Z_ORIENT
930 {
931 wmWindow *win = CTX_wm_window(C);
932 View3D *v3d = CTX_wm_view3d(C);
933 ARegion *region = CTX_wm_region(C);
934 const wmEvent *event = win->runtime->eventstate;
935 float plane_co[3], plane_no[3];
936 RNA_property_float_get_array(op->ptr, ggd->data.prop_axis_co, plane_co);
937 RNA_property_float_get_array(op->ptr, ggd->data.prop_axis_no, plane_no);
938
940
941 /* Use cursor as fallback if it's not set by the 'ortho_axis_active'. */
942 if (is_zero_v3(ggd->data.orient_axis_relative)) {
943 float cursor_co[3];
944 const int mval[2] = {event->xy[0] - region->winrct.xmin, event->xy[1] - region->winrct.ymin};
945 float plane[4];
946 plane_from_point_normal_v3(plane, plane_co, plane_no);
947 if (!ED_view3d_win_to_3d_on_plane_int(region, plane, mval, false, cursor_co)) [[unlikely]] {
948 ED_view3d_win_to_3d_int(v3d, region, plane, mval, cursor_co);
949 }
950 sub_v3_v3v3(ggd->data.orient_axis_relative, cursor_co, plane_co);
951 }
952
953 if (!is_zero_v3(ggd->data.orient_axis_relative)) {
954 normalize_v3(ggd->data.orient_axis_relative);
955 float imat3[3][3];
956 invert_m3_m3(imat3, ggd->data.orient_mat);
957 mul_m3_v3(imat3, ggd->data.orient_axis_relative);
958 }
959 }
960#endif
961
963
964 /* Setup property callbacks */
965 {
966 {
970 params.range_get_fn = nullptr;
971 params.user_data = nullptr;
972 WM_gizmo_target_property_def_func(ggd->translate_c, "offset", &params);
973 }
974
975 {
979 params.range_get_fn = nullptr;
980 params.user_data = nullptr;
981 WM_gizmo_target_property_def_func(ggd->rotate_view, "offset", &params);
982 }
983
984 for (int i = 0; i < 2; i++) {
985 {
989 params.user_data = nullptr,
990 WM_gizmo_target_property_def_func(ggd->rotate_xy[i], "offset", &params);
991 }
992 {
996 params.range_get_fn = nullptr;
997 params.user_data = nullptr;
998 WM_gizmo_target_property_def_func(ggd->translate_xy[i], "offset", &params);
999 }
1000 }
1001
1002 wmGizmoPropertyFnParams params{};
1005 params.range_get_fn = nullptr;
1006 params.user_data = nullptr;
1007 WM_gizmo_target_property_def_func(ggd->angle_z, "offset", &params);
1008 }
1009
1010 wmWindow *win = CTX_wm_window(C);
1011 if (win && win->active) {
1012 bScreen *screen = WM_window_get_active_screen(win);
1013 if (screen->active_region) {
1014 ARegion *region = CTX_wm_region(C);
1015 if (screen->active_region == region) {
1016 /* Become modal as soon as it's started. */
1018 }
1019 }
1020 }
1021}
1022
1023static void gizmo_mesh_spin_redo_draw_prepare(const bContext * /*C*/, wmGizmoGroup *gzgroup)
1024{
1025 GizmoGroupData_SpinRedo *ggd = static_cast<GizmoGroupData_SpinRedo *>(gzgroup->customdata);
1026 if (ggd->data.op->next) {
1027 ggd->data.op = WM_operator_last_redo(ggd->data.context);
1028 }
1029
1030 /* Not essential, just avoids feedback loop where matrices
1031 * could shift because of float precision.
1032 * Updates in this case are also redundant. */
1033 bool is_modal = false;
1034 for (wmGizmo &gz : gzgroup->gizmos) {
1035 if (gz.state & WM_GIZMO_STATE_MODAL) {
1036 is_modal = true;
1037 break;
1038 }
1039 }
1040 if (!is_modal) {
1042 }
1043
1044 RegionView3D *rv3d = ED_view3d_context_rv3d(ggd->data.context);
1046 {
1047 float view_up[3];
1048 project_plane_normalized_v3_v3v3(view_up, ggd->data.orient_mat[2], rv3d->viewinv[2]);
1049 if (normalize_v3(view_up) != 0.0f) {
1051 }
1052 else {
1054 }
1055 }
1056}
1057
1059{
1060 gzgt->name = "Mesh Spin Redo";
1061 gzgt->idname = "MESH_GGT_spin_redo";
1062
1064
1067
1071}
1072
1074
1075} // namespace blender
#define M_PI_2
#define M_PI
Read Blender memory allocation and freeing.
#define C
Definition RandGen.cpp:29
#define WM_toolsystem_ref_properties_ensure_from_gizmo_group(tref, gzgroup, r_ptr)
#define UNPACK2(a)
#define UNUSED_VARS_NDEBUG(...)
#define ELEM(...)
#define BM_elem_flag_test(ele, hflag)
#define BM_ITER_MESH(ele, iter, bm, itype)
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
Definition btVector3.h:356
#define INIT_SCALE_BASE
#define ORTHO_AXIS_OFFSET
#define INIT_SCALE_BUTTON
void calc_orientation_from_type(const bContext *C, float r_mat[3][3])
void get_color_3fv(int colorid, float col[3])
BMesh Iterators.
void WM_gizmo_set_matrix_rotation_from_z_axis(wmGizmo *gz, const float z_axis[3])
Definition wm_gizmo.cc:273
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
MINLINE void negate_v3_v3(float r[3], const float a[3])
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
static const float dial_angle_partial_margin
void mul_m3_v3(const float M[3][3], float r[3])
bool ED_gizmo_poll_or_unlink_delayed_from_tool_ex(const bContext *C, wmGizmoGroupType *gzgt, const char *gzgt_idname)
void WM_gizmo_modal_set_from_setup(wmGizmoMap *gzmap, bContext *C, wmGizmo *gz, int part_index, const wmEvent *event)
Definition wm_gizmo.cc:415
bool ED_undo_operator_repeat(bContext *C, wmOperator *op)
Definition ed_undo.cc:879
void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *values)
static const uchar shape_plus[]
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
void WM_gizmo_do_msg_notify_tag_refresh(bContext *, wmMsgSubscribeKey *, wmMsgSubscribeValue *msg_val)
static void gizmo_spin_prop_axis_angle_set(const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value_p)
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
void copy_m3_m4(float m1[3][3], const float m2[4][4])
void RNA_property_string_set_bytes(PointerRNA *ptr, PropertyRNA *prop, const char *value, int len)
static void gizmo_spin_prop_depth_set(const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value_p)
void WM_gizmo_target_property_def_func(wmGizmo *gz, const char *idname, const wmGizmoPropertyFnParams *params)
static void gizmo_spin_prop_axis_angle_get(const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p)
bool ED_view3d_win_to_3d_on_plane_int(const ARegion *region, const float plane[4], const int mval[2], bool do_clip, float r_out[3])
void copy_m3_m3(float m1[3][3], const float m2[3][3])
void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
static void gizmo_spin_exec(GizmoGroupData_SpinRedo *ggd)
void WM_gizmo_set_color(wmGizmo *gz, const float color[4])
Definition wm_gizmo.cc:327
float angle_compat_rad(float angle, float angle_compat)
bool invert_m3_m3(float inverse[3][3], const float mat[3][3])
void ED_gizmo_arrow3d_reset_offset(wmGizmo *gz)
const wmGizmoType * WM_gizmotype_find(const StringRef idname, bool quiet)
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
static const float dial_angle_partial
const EnumPropertyItem rna_enum_axis_flag_xyz_items[]
void axis_angle_to_mat3(float R[3][3], const float axis[3], float angle)
wmWindow * CTX_wm_window(const bContext *C)
void WM_gizmo_set_color_highlight(wmGizmo *gz, const float color_hi[4])
Definition wm_gizmo.cc:336
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const float *values)
void project_plane_normalized_v3_v3v3(float out[3], const float p[3], const float v_plane[3])
RegionView3D * ED_view3d_context_rv3d(bContext *C)
void WM_msg_subscribe_rna_params(wmMsgBus *mbus, const wmMsgParams_RNA *msg_key_params, const wmMsgSubscribeValue *msg_val_params, const char *id_repr)
void WM_gizmo_set_line_width(wmGizmo *gz, const float line_width)
Definition wm_gizmo.cc:318
void closest_to_plane_normalized_v3(float r_close[3], const float plane[4], const float pt[3])
Definition math_geom.cc:458
void plane_from_point_normal_v3(float r_plane[4], const float plane_co[3], const float plane_no[3])
Definition math_geom.cc:225
static void gizmo_mesh_spin_redo_setup(const bContext *C, wmGizmoGroup *gzgroup)
float angle_signed_on_axis_v3v3_v3(const float v1[3], const float v2[3], const float axis[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void mul_v3_fl(float r[3], float f)
void WM_gizmo_set_scale(wmGizmo *gz, const float scale)
Definition wm_gizmo.cc:313
static void gizmo_spin_prop_angle_set(const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value_p)
MINLINE void zero_v4(float r[4])
void mul_m4_v3(const float M[4][4], float r[3])
MINLINE bool equals_v3v3(const float v1[3], const float v2[3]) ATTR_WARN_UNUSED_RESULT
static void gizmo_mesh_spin_redo_update_from_op(GizmoGroupData_SpinRedo *ggd)
void WM_gizmo_set_flag(wmGizmo *gz, const int flag, const bool enable)
Definition wm_gizmo.cc:303
static void gizmo_spin_prop_angle_get(const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
unsigned char uchar
Definition BKE_text.h:58
static void gizmo_mesh_spin_redo_update_orient_axis(GizmoGroupData_SpinRedo *ggd, const float plane_no[3])
BMesh const char void * data
TransformOrientationSlot * BKE_scene_orientation_slot_get(Scene *scene, int slot_index)
Definition scene.cc:2639
Object * CTX_data_edit_object(const bContext *C)
void RNA_property_unset(PointerRNA *ptr, PropertyRNA *prop)
static void gizmo_spin_prop_translate_set(const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value)
PointerRNA * WM_gizmo_operator_set(wmGizmo *gz, int part_index, wmOperatorType *ot, IDProperty *properties)
Definition wm_gizmo.cc:199
constexpr size_t ARRAY_SIZE(const T(&arg)[N]) noexcept
static void gizmo_spin_prop_translate_get(const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p)
@ ED_GIZMO_MOVE_STYLE_RING_2D
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
PropertyRNA * RNA_struct_type_find_property(StructRNA *srna, const char *identifier)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
static void gizmo_mesh_spin_init_refresh(const bContext *C, wmGizmoGroup *gzgroup)
static void gizmo_mesh_spin_redo_modal_from_setup(const bContext *C, wmGizmoGroup *gzgroup)
static void gizmo_mesh_spin_init_setup(const bContext *, wmGizmoGroup *gzgroup)
static void gizmo_spin_prop_depth_get(const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p)
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
void MESH_GGT_spin(wmGizmoGroupType *gzgt)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
void ortho_v3_v3(float out[3], const float v[3])
@ ED_GIZMO_ARROW_STYLE_NORMAL
static void gizmo_mesh_spin_redo_draw_prepare(const bContext *, wmGizmoGroup *gzgroup)
MINLINE float normalize_v3_v3(float r[3], const float a[3])
void WM_msg_subscribe_rna(wmMsgBus *mbus, PointerRNA *ptr, const PropertyRNA *prop, const wmMsgSubscribeValue *msg_val_params, const char *id_repr)
@ WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
@ WM_GIZMO_OPERATOR_TOOL_INIT
@ WM_GIZMO_DRAW_OFFSET_SCALE
@ WM_GIZMO_DRAW_VALUE
@ WM_GIZMO_HIDDEN_SELECT
float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop)
MINLINE float normalize_v3(float n[3])
static void gizmo_mesh_spin_init_refresh_axis_orientation(wmGizmoGroup *gzgroup, int axis_index, const float axis_vec[3], const float axis_tan[3])
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
void MESH_GGT_spin_redo(wmGizmoGroupType *gzgt)
@ WM_GIZMO_STATE_MODAL
@ WM_GIZMO_STATE_HIGHLIGHT
static void gizmo_mesh_spin_init_invoke_prepare(const bContext *, wmGizmoGroup *gzgroup, wmGizmo *gz, const wmEvent *)
void unit_m3(float m[3][3])
MINLINE void copy_v3_fl(float r[3], float f)
bToolRef * WM_toolsystem_ref_from_context(const bContext *C)
static void gizmo_mesh_spin_init_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
static void gizmo_mesh_spin_init_message_subscribe(const bContext *C, wmGizmoGroup *gzgroup, wmMsgBus *mbus)
wmOperator * WM_operator_last_redo(const bContext *C)
wmGizmoGroup * WM_gizmomap_group_find(wmGizmoMap *gzmap, const char *idname)
const BMesh * BKE_editmesh_bmesh_get(const Object *ob)
Definition editmesh.cc:65
PropertyRNA * RNA_def_enum_flag(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
void ED_view3d_win_to_3d_int(const View3D *v3d, const ARegion *region, const float depth_pt[3], const int mval[2], float r_out[3])
Scene * CTX_data_scene(const bContext *C)
void mul_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3])
bool ED_gizmo_poll_or_unlink_delayed_from_tool(const bContext *C, wmGizmoGroupType *gzgt)
void WM_gizmo_set_matrix_location(wmGizmo *gz, const float origin[3])
Definition wm_gizmo.cc:283
@ ED_GIZMO_BUTTON_SHOW_BACKDROP
void mul_v3_m3v3(float r[3], const float M[3][3], const float a[3])
wmGizmo * WM_gizmo_new_ptr(const wmGizmoType *gzt, wmGizmoGroup *gzgroup, PointerRNA *properties)
Definition wm_gizmo.cc:84
bScreen * WM_window_get_active_screen(const wmWindow *win)
void axis_angle_normalized_to_mat3(float R[3][3], const float axis[3], float angle)
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
ARegion * CTX_wm_region(const bContext *C)
bool ED_gizmo_poll_or_unlink_delayed_from_operator(const bContext *C, wmGizmoGroupType *gzgt, const char *idname)
MINLINE bool is_zero_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
void rotation_between_vecs_to_mat3(float m[3][3], const float v1[3], const float v2[3])
View3D * CTX_wm_view3d(const bContext *C)
@ ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR
@ ED_GIZMO_DIAL_DRAW_FLAG_CLIP
@ ED_GIZMO_DIAL_DRAW_FLAG_FILL
@ ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y
@ ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE
static bool gizmo_mesh_spin_redo_poll(const bContext *C, wmGizmoGroupType *gzgt)
bool equals_m3m3(const float mat1[3][3], const float mat2[3][3])
bke::ARegionRuntime * runtime
struct blender::GizmoGroupData_SpinInit::@223065025320243347260335125001234364106130012153 invoke
struct blender::GizmoGroupData_SpinInit::@171344066002274307231167035365100216233013064141 data
struct blender::GizmoGroupData_SpinInit::@366026042215072254256264270056164337100064161052 prev
struct blender::GizmoGroupData_SpinInit::@357257024074242355214230206351035061136300156222 gizmos
struct blender::GizmoGroupData_SpinRedo::@220126131175035141015013162237150267310100244071 data
struct blender::GizmoGroupData_SpinRedo::@374111325273242021216213201313004354270006251326 prev
StructRNA * type
Definition RNA_types.hh:63
View3DCursor cursor
struct ARegion * active_region
wmGizmoGroupFnMsgBusSubscribe message_subscribe
wmGizmoGroupFnRefresh refresh
wmGizmoGroupFnInvokePrepare invoke_prepare
wmGizmoMapType_Params gzmap_params
wmGizmoGroupFnDrawPrepare draw_prepare
eWM_GizmoFlagGroupTypeFlag flag
wmGizmoGroupType * type
ListBaseT< wmGizmo > gizmos
wmGizmoPropertyFnSet value_set_fn
wmGizmoPropertyFnRangeGet range_get_fn
wmGizmoPropertyFnGet value_get_fn
const wmGizmoPropertyType * type
float matrix_basis[4][4]
float matrix_offset[4][4]
wmGizmoGroup * parent_gzgroup
eWM_GizmoFlag flag
eWM_GizmoFlagState state
const PropertyRNA * prop
struct wmOperatorType * type
bke::WindowRuntime * runtime