Blender V5.3
transform_gizmo_2d.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
12
13#include "MEM_guardedalloc.h"
14
15#include "BLI_math_matrix_c.hh"
17#include "BLI_math_vector_c.hh"
19
20#include "DNA_object_types.h"
21#include "DNA_screen_types.h"
22#include "DNA_sequence_types.h"
23#include "DNA_space_types.h"
24#include "DNA_view3d_types.h"
25
26#include "BKE_context.hh"
27#include "BKE_global.hh"
28#include "BKE_layer.hh"
29
30#include "RNA_access.hh"
31
32#include "UI_resources.hh"
33#include "UI_view2d.hh"
34
35#include "WM_api.hh"
36#include "WM_message.hh"
37#include "WM_types.hh"
38
39#include "ED_gizmo_library.hh"
40#include "ED_gizmo_utils.hh"
41#include "ED_image.hh"
42#include "ED_mask.hh"
43#include "ED_screen.hh"
44#include "ED_uvedit.hh"
45
46#include "SEQ_channels.hh"
47#include "SEQ_iterator.hh"
48#include "SEQ_sequencer.hh"
49#include "SEQ_transform.hh"
50
51#include "transform.hh"
52#include "transform_gizmo.hh"
53
54namespace blender::ed::transform {
55
56/* -------------------------------------------------------------------- */
59
61{
63 return false;
64 }
65
66 if ((U.gizmo_flag & USER_GIZMO_DRAW) == 0) {
67 return false;
68 }
69
70 if (G.moving) {
71 return false;
72 }
73
74 ScrArea *area = CTX_wm_area(C);
75 if (area == nullptr) {
76 return false;
77 }
78
79 /* NOTE: below this is assumed to be a tool gizmo.
80 * If there are cases that need to check other flags - this function could be split. */
81 switch (area->spacetype) {
82 case SPACE_IMAGE: {
83 const SpaceImage *sima = area->spacedata.first_as<SpaceImage>();
84 Object *obedit = CTX_data_edit_object(C);
85 if (!(ED_space_image_show_uvedit(sima, obedit) || ED_space_image_show_mask(sima))) {
86 return false;
87 }
88 break;
89 }
90 case SPACE_SEQ: {
91 const SpaceSeq *sseq = area->spacedata.first_as<SpaceSeq>();
93 return false;
94 }
95 if (sseq->mainb != SEQ_DRAW_IMG_IMBUF) {
96 return false;
97 }
99 Editing *ed = seq::editing_get(scene);
100 if (ed == nullptr) {
101 return false;
102 }
103 break;
104 }
105 }
106
107 return true;
108}
109
111 wmMsgBus *mbus, /* Additional args. */
112 bScreen *screen,
113 ScrArea *area,
114 ARegion *region)
115{
116 wmMsgSubscribeValue msg_sub_value_gz_tag_refresh{};
117 msg_sub_value_gz_tag_refresh.owner = region;
118 msg_sub_value_gz_tag_refresh.user_data = gzgroup->parent_gzmap;
119 msg_sub_value_gz_tag_refresh.notify = WM_gizmo_do_msg_notify_tag_refresh;
120
121 switch (area->spacetype) {
122 case SPACE_IMAGE: {
123 SpaceImage *sima = area->spacedata.first_as<SpaceImage>();
124 PointerRNA ptr = RNA_pointer_create_discrete(&screen->id, RNA_SpaceImageEditor, sima);
125 {
126 const PropertyRNA *props[] = {
127 &rna_SpaceImageEditor_pivot_point,
128 (sima->around == V3D_AROUND_CURSOR) ? &rna_SpaceImageEditor_cursor_location : nullptr,
129 };
130 for (int i = 0; i < ARRAY_SIZE(props); i++) {
131 if (props[i] == nullptr) {
132 continue;
133 }
134 WM_msg_subscribe_rna(mbus, &ptr, props[i], &msg_sub_value_gz_tag_refresh, __func__);
135 }
136 }
137 break;
138 }
139 }
140}
141
143
144/* -------------------------------------------------------------------- */
147
148/* Axes as index. */
149enum {
152
154};
155
159
160 /* Current origin in view space, used to update widget origin for possible view changes. */
161 float origin[2];
162 float min[2];
163 float max[2];
164 float rotation;
165
167};
168
170
171/* -------------------------------------------------------------------- */
174
175static void gizmo2d_get_axis_color(const int axis_idx, float *r_col, float *r_col_hi)
176{
177 const float alpha = 0.6f;
178 const float alpha_hi = 1.0f;
179 int col_id;
180
181 switch (axis_idx) {
183 col_id = TH_AXIS_X;
184 break;
186 col_id = TH_AXIS_Y;
187 break;
188 default:
189 BLI_assert(0);
190 col_id = TH_AXIS_Y;
191 break;
192 }
193
194 ui::theme::get_color_4fv(col_id, r_col);
195
196 copy_v4_v4(r_col_hi, r_col);
197 r_col[3] *= alpha;
198 r_col_hi[3] *= alpha_hi;
199}
200
202{
203 const wmGizmoType *gzt_arrow = WM_gizmotype_find("GIZMO_GT_arrow_3d", true);
204 const wmGizmoType *gzt_cage = WM_gizmotype_find("GIZMO_GT_cage_2d", true);
205 const wmGizmoType *gzt_button = WM_gizmotype_find("GIZMO_GT_button_2d", true);
206
208
209 ggd->translate_xy[0] = WM_gizmo_new_ptr(gzt_arrow, gzgroup, nullptr);
210 ggd->translate_xy[1] = WM_gizmo_new_ptr(gzt_arrow, gzgroup, nullptr);
211 ggd->translate_xy[2] = WM_gizmo_new_ptr(gzt_button, gzgroup, nullptr);
212 ggd->cage = WM_gizmo_new_ptr(gzt_cage, gzgroup, nullptr);
213
214 RNA_enum_set(ggd->cage->ptr,
215 "transform",
218 RNA_enum_set(ggd->cage->ptr,
219 "draw_options",
222
223 return ggd;
224}
225
229static bool gizmo2d_calc_bounds(const bContext *C, float *r_center, float *r_min, float *r_max)
230{
231 float min_buf[2], max_buf[2];
232 if (r_min == nullptr) {
233 r_min = min_buf;
234 }
235 if (r_max == nullptr) {
236 r_max = max_buf;
237 }
238
239 ScrArea *area = CTX_wm_area(C);
240 bool has_select = false;
241 if (area->spacetype == SPACE_IMAGE) {
242 const SpaceImage *sima = area->spacedata.first_as<SpaceImage>();
243 switch (sima->mode) {
244 case SI_MODE_UV: {
245 const Main *bmain = CTX_data_main(C);
246 Scene *scene = CTX_data_scene(C);
247 ViewLayer *view_layer = CTX_data_view_layer(C);
248 Vector<Object *> objects =
250 *bmain, scene, view_layer, nullptr);
251 if (ED_uvedit_minmax_multi(scene, objects, r_min, r_max)) {
252 has_select = true;
253 }
254 break;
255 }
256 case SI_MODE_MASK: {
257 if (ED_mask_selected_minmax(C, r_min, r_max, false, false)) {
258 has_select = true;
259 }
260 break;
261 }
262 default:
263 break;
264 }
265 }
266 else if (area->spacetype == SPACE_SEQ) {
268 Editing *ed = seq::editing_get(scene);
269 ListBaseT<Strip> *seqbase = seq::active_seqbase_get(ed);
270 ListBaseT<SeqTimelineChannel> *channels = seq::channels_displayed_get(ed);
271 VectorSet strips = seq::query_rendered_strips(scene, channels, seqbase, scene->r.cfra, 0);
272 strips.remove_if([&](Strip *strip) { return (strip->flag & SEQ_SELECT) == 0; });
273 int selected_strips = strips.size();
274 if (selected_strips > 0) {
275 has_select = true;
277 copy_v2_v2(r_min, box.min);
278 copy_v2_v2(r_max, box.max);
279 }
280 if (selected_strips > 1) {
281 /* Don't draw the cage as transforming multiple strips isn't currently very useful as it
282 * doesn't behave as one would expect.
283 *
284 * This is because our current transform system doesn't support shearing which would make the
285 * scaling transforms of the bounding box behave weirdly.
286 * In addition to this, the rotation of the bounding box can not currently be hooked up
287 * properly to read the result from the transform system (when transforming multiple strips).
288 */
289 const int pivot_point = scene->toolsettings->sequencer_tool_settings->pivot_point;
290 if (pivot_point == V3D_AROUND_CURSOR) {
291 SpaceSeq *sseq = area->spacedata.first_as<SpaceSeq>();
292 const float2 cursor_pixel = seq::image_preview_unit_to_px(scene, sseq->cursor);
293 copy_v2_v2(r_center, cursor_pixel);
294 }
295 else {
296 mid_v2_v2v2(r_center, r_min, r_max);
297 }
298 zero_v2(r_min);
299 zero_v2(r_max);
300 return has_select;
301 }
302 }
303
304 if (has_select == false) {
305 zero_v2(r_min);
306 zero_v2(r_max);
307 }
308
309 mid_v2_v2v2(r_center, r_min, r_max);
310 return has_select;
311}
312
314{
315 ScrArea *area = CTX_wm_area(C);
316 if (area->spacetype != SPACE_SEQ) {
317 return V3D_ORIENT_GLOBAL;
318 }
319
321 Editing *ed = seq::editing_get(scene);
322 ListBaseT<Strip> *seqbase = seq::active_seqbase_get(ed);
323 ListBaseT<SeqTimelineChannel> *channels = seq::channels_displayed_get(ed);
324 VectorSet strips = seq::query_rendered_strips(scene, channels, seqbase, scene->r.cfra, 0);
325 strips.remove_if([&](Strip *strip) { return (strip->flag & SEQ_SELECT) == 0; });
326
327 bool use_local_orient = strips.size() == 1;
328
329 if (use_local_orient) {
330 return V3D_ORIENT_LOCAL;
331 }
332 return V3D_ORIENT_GLOBAL;
333}
334
335static float gizmo2d_calc_rotation(const bContext *C)
336{
337 ScrArea *area = CTX_wm_area(C);
338 if (area->spacetype != SPACE_SEQ) {
339 return 0.0f;
340 }
341
343 Editing *ed = seq::editing_get(scene);
344 ListBaseT<Strip> *seqbase = seq::active_seqbase_get(ed);
345 ListBaseT<SeqTimelineChannel> *channels = seq::channels_displayed_get(ed);
346 VectorSet strips = seq::query_rendered_strips(scene, channels, seqbase, scene->r.cfra, 0);
347 strips.remove_if([&](Strip *strip) { return (strip->flag & SEQ_SELECT) == 0; });
348
349 if (strips.size() == 1) {
350 /* Only return the strip rotation if only one is selected. */
351 for (Strip *strip : strips) {
352 StripTransform *transform = strip->data->transform;
354 return transform->rotation * mirror[0] * mirror[1];
355 }
356 }
357
358 return 0.0f;
359}
360
361static bool seq_get_strip_pivot_median(const Scene *scene, float r_pivot[2])
362{
363 zero_v2(r_pivot);
364
365 Editing *ed = seq::editing_get(scene);
366 ListBaseT<Strip> *seqbase = seq::active_seqbase_get(ed);
367 ListBaseT<SeqTimelineChannel> *channels = seq::channels_displayed_get(ed);
368 VectorSet strips = seq::query_rendered_strips(scene, channels, seqbase, scene->r.cfra, 0);
369 strips.remove_if([&](Strip *strip) { return (strip->flag & SEQ_SELECT) == 0; });
370 bool has_select = !strips.is_empty();
371
372 if (has_select) {
373 for (Strip *strip : strips) {
374 const float2 origin = seq::image_transform_origin_preview_offset_get(scene, strip);
375 add_v2_v2(r_pivot, origin);
376 }
377 mul_v2_fl(r_pivot, 1.0f / strips.size());
378 }
379
380 return has_select;
381}
382
384 bool handles_as_knot_selected_only,
385 float r_pivot[2])
386{
387 ScrArea *area = CTX_wm_area(C);
388 bool has_select = false;
389
390 if (area->spacetype == SPACE_IMAGE) {
391 const Main *bmain = CTX_data_main(C);
392 Scene *scene = CTX_data_scene(C);
393 const SpaceImage *sima = area->spacedata.first_as<SpaceImage>();
394 ViewLayer *view_layer = CTX_data_view_layer(C);
395 switch (sima->mode) {
396 case SI_MODE_UV:
398 *bmain, sima, scene, view_layer, r_pivot, sima->around, &has_select);
399 break;
400 case SI_MODE_MASK:
402 C, area, sima->around, handles_as_knot_selected_only, r_pivot, &has_select);
403 break;
404 default:
405 break;
406 }
407 }
408 else if (area->spacetype == SPACE_SEQ) {
410 SpaceSeq *sseq = area->spacedata.first_as<SpaceSeq>();
411 const int pivot_point = scene->toolsettings->sequencer_tool_settings->pivot_point;
412
413 if (pivot_point == V3D_AROUND_CURSOR) {
414 const float2 cursor_pixel = seq::image_preview_unit_to_px(scene, sseq->cursor);
415 copy_v2_v2(r_pivot, cursor_pixel);
416
417 Editing *ed = seq::editing_get(scene);
418 ListBaseT<Strip> *seqbase = seq::active_seqbase_get(ed);
419 ListBaseT<SeqTimelineChannel> *channels = seq::channels_displayed_get(ed);
420 VectorSet strips = seq::query_rendered_strips(scene, channels, seqbase, scene->r.cfra, 0);
421 strips.remove_if([&](Strip *strip) { return (strip->flag & SEQ_SELECT) == 0; });
422 has_select = !strips.is_empty();
423 }
424 else if (pivot_point == V3D_AROUND_CENTER_BOUNDS) {
425 has_select = gizmo2d_calc_bounds(C, r_pivot, nullptr, nullptr);
426 }
427 else {
428 has_select = seq_get_strip_pivot_median(scene, r_pivot);
429 }
430 }
431 else {
432 BLI_assert_msg(0, "Unhandled space type!");
433 }
434 return has_select;
435}
436
440BLI_INLINE void gizmo2d_origin_to_region(ARegion *region, float *r_origin)
441{
442 ui::view2d_view_to_region_fl(&region->v2d, r_origin[0], r_origin[1], &r_origin[0], &r_origin[1]);
443}
444
449 wmGizmo *widget,
450 const wmEvent * /*event*/,
451 eWM_GizmoFlagTweak /*tweak_flag*/)
452{
453 ARegion *region = CTX_wm_region(C);
454 float origin[3];
455
456 gizmo2d_calc_transform_pivot(C, false, origin);
457 gizmo2d_origin_to_region(region, origin);
458 WM_gizmo_set_matrix_location(widget, origin);
459
461
463}
464
466
467/* -------------------------------------------------------------------- */
475
476static void gizmo2d_xform_setup(const bContext * /*C*/, wmGizmoGroup *gzgroup)
477{
478 wmOperatorType *ot_translate = WM_operatortype_find("TRANSFORM_OT_translate", true);
479 GizmoGroup2D *ggd = gizmogroup2d_init(gzgroup);
480 gzgroup->customdata = ggd;
481
482 for (int i = 0; i < ARRAY_SIZE(ggd->translate_xy); i++) {
483 wmGizmo *gz = ggd->translate_xy[i];
484
485 /* Custom handler! */
487
488 if (i < 2) {
489 float color[4], color_hi[4];
490 gizmo2d_get_axis_color(i, color, color_hi);
491
492 /* Set up widget data. */
493 RNA_float_set(gz->ptr, "length", 0.8f);
494 float axis[3] = {0.0f};
495 axis[i] = 1.0f;
497
498 float offset[3] = {0, 0, 0};
499 offset[2] = 0.18f;
502
505 WM_gizmo_set_color_highlight(gz, color_hi);
506
507 WM_gizmo_set_scale(gz, 1.0f);
508 }
509 else {
510 float color[4], color_hi[4];
512 copy_v4_v4(color_hi, color);
513 color[3] *= 0.6f;
514
515 PropertyRNA *prop = RNA_struct_find_property(gz->ptr, "icon");
516 RNA_property_enum_set(gz->ptr, prop, ICON_NONE);
517
518 RNA_enum_set(gz->ptr, "draw_options", ED_GIZMO_BUTTON_SHOW_BACKDROP);
519 /* Make the center low alpha. */
520 WM_gizmo_set_line_width(gz, 2.0f);
521 RNA_float_set(gz->ptr, "backdrop_fill_alpha", 0.0);
523 WM_gizmo_set_color_highlight(gz, color_hi);
524
525 WM_gizmo_set_scale(gz, 0.2f);
526 }
527
528 /* Assign operator. */
529 PointerRNA *ptr = WM_gizmo_operator_set(gz, 0, ot_translate, nullptr);
530 if (i < 2) {
531 bool constraint[3] = {false};
532 constraint[i] = true;
533 if (RNA_struct_find_property(ptr, "constraint_axis")) {
534 RNA_boolean_set_array(ptr, "constraint_axis", constraint);
535 }
536 }
537
538 RNA_boolean_set(ptr, "release_confirm", true);
539 }
540
541 {
542 wmOperatorType *ot_resize = WM_operatortype_find("TRANSFORM_OT_resize", true);
543 wmOperatorType *ot_rotate = WM_operatortype_find("TRANSFORM_OT_rotate", true);
544 PointerRNA *ptr;
545
546 /* Assign operator. */
547 ptr = WM_gizmo_operator_set(ggd->cage, 0, ot_translate, nullptr);
548 RNA_boolean_set(ptr, "release_confirm", true);
549
550 const bool constraint_x[3] = {true, false, false};
551 const bool constraint_y[3] = {false, true, false};
552
553 ptr = WM_gizmo_operator_set(ggd->cage, ED_GIZMO_CAGE2D_PART_SCALE_MIN_X, ot_resize, nullptr);
554 PropertyRNA *prop_release_confirm = RNA_struct_find_property(ptr, "release_confirm");
555 PropertyRNA *prop_constraint_axis = RNA_struct_find_property(ptr, "constraint_axis");
556 RNA_property_boolean_set(ptr, prop_release_confirm, true);
557 RNA_property_boolean_set_array(ptr, prop_constraint_axis, constraint_x);
558 ptr = WM_gizmo_operator_set(ggd->cage, ED_GIZMO_CAGE2D_PART_SCALE_MAX_X, ot_resize, nullptr);
559 RNA_property_boolean_set(ptr, prop_release_confirm, true);
560 RNA_property_boolean_set_array(ptr, prop_constraint_axis, constraint_x);
561 ptr = WM_gizmo_operator_set(ggd->cage, ED_GIZMO_CAGE2D_PART_SCALE_MIN_Y, ot_resize, nullptr);
562 RNA_property_boolean_set(ptr, prop_release_confirm, true);
563 RNA_property_boolean_set_array(ptr, prop_constraint_axis, constraint_y);
564 ptr = WM_gizmo_operator_set(ggd->cage, ED_GIZMO_CAGE2D_PART_SCALE_MAX_Y, ot_resize, nullptr);
565 RNA_property_boolean_set(ptr, prop_release_confirm, true);
566 RNA_property_boolean_set_array(ptr, prop_constraint_axis, constraint_y);
567
569 ggd->cage, ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MIN_Y, ot_resize, nullptr);
570 RNA_property_boolean_set(ptr, prop_release_confirm, true);
572 ggd->cage, ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MAX_Y, ot_resize, nullptr);
573 RNA_property_boolean_set(ptr, prop_release_confirm, true);
575 ggd->cage, ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MIN_Y, ot_resize, nullptr);
576 RNA_property_boolean_set(ptr, prop_release_confirm, true);
578 ggd->cage, ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MAX_Y, ot_resize, nullptr);
579 RNA_property_boolean_set(ptr, prop_release_confirm, true);
580 ptr = WM_gizmo_operator_set(ggd->cage, ED_GIZMO_CAGE2D_PART_ROTATE, ot_rotate, nullptr);
581 RNA_property_boolean_set(ptr, prop_release_confirm, true);
582 }
583}
584
585static void rotate_around_center_v2(float point[2], const float center[2], const float angle)
586{
587 float tmp[2];
588
589 sub_v2_v2v2(tmp, point, center);
590 rotate_v2_v2fl(point, tmp, angle);
591 add_v2_v2(point, center);
592}
593
594static void gizmo2d_xform_refresh(const bContext *C, wmGizmoGroup *gzgroup)
595{
596 GizmoGroup2D *ggd = static_cast<GizmoGroup2D *>(gzgroup->customdata);
597 bool has_select;
598 if (ggd->no_cage) {
599 has_select = gizmo2d_calc_transform_pivot(C, false, ggd->origin);
600 }
601 else {
602 has_select = gizmo2d_calc_bounds(C, ggd->origin, ggd->min, ggd->max);
604 }
605
606 bool show_cage = !ggd->no_cage && !equals_v2v2(ggd->min, ggd->max);
607
608 if (has_select == false) {
609 /* Nothing selected. Disable gizmo drawing and return. */
610 ggd->cage->flag |= WM_GIZMO_HIDDEN;
611 for (int i = 0; i < ARRAY_SIZE(ggd->translate_xy); i++) {
613 }
614 return;
615 }
616
617 if (!show_cage) {
618 /* Disable cage gizmo drawing and return. */
619 ggd->cage->flag |= WM_GIZMO_HIDDEN;
620 for (int i = 0; i < ARRAY_SIZE(ggd->translate_xy); i++) {
622 }
623 return;
624 }
625
626 /* We will show the cage gizmo! Setup all necessary data. */
627 ggd->cage->flag &= ~WM_GIZMO_HIDDEN;
628 for (int i = 0; i < ARRAY_SIZE(ggd->translate_xy); i++) {
630 }
631}
632
634{
635 ARegion *region = CTX_wm_region(C);
636 GizmoGroup2D *ggd = static_cast<GizmoGroup2D *>(gzgroup->customdata);
637 float origin[3] = {UNPACK2(ggd->origin), 0.0f};
638
639 gizmo2d_origin_to_region(region, origin);
640
641 for (int i = 0; i < ARRAY_SIZE(ggd->translate_xy); i++) {
642 wmGizmo *gz = ggd->translate_xy[i];
644 }
645
647 /* Define the bounding box of the gizmo in the offset transform matrix. */
649 const float min_gizmo_pixel_size = 0.001f; /* Draw Gizmo larger than this many pixels. */
650 const float min_scale_axis_x = min_gizmo_pixel_size / ggd->cage->matrix_space[0][0];
651 const float min_scale_axis_y = min_gizmo_pixel_size / ggd->cage->matrix_space[1][1];
652 ggd->cage->matrix_offset[0][0] = max_ff(min_scale_axis_x, ggd->max[0] - ggd->min[0]);
653 ggd->cage->matrix_offset[1][1] = max_ff(min_scale_axis_y, ggd->max[1] - ggd->min[1]);
654
655 ScrArea *area = CTX_wm_area(C);
656
657 if (area->spacetype == SPACE_SEQ) {
659 seq_get_strip_pivot_median(scene, origin);
660
661 float matrix_rotate[4][4];
662 unit_m4(matrix_rotate);
663 copy_v3_v3(matrix_rotate[3], origin);
664 rotate_m4(matrix_rotate, 'Z', ggd->rotation);
666 mul_m4_m4m4(ggd->cage->matrix_basis, matrix_rotate, ggd->cage->matrix_basis);
667
668 float mid[2];
669 sub_v2_v2v2(mid, origin, ggd->origin);
670 mul_v2_fl(mid, -1.0f);
671 copy_v2_v2(ggd->cage->matrix_offset[3], mid);
672 }
673 else {
674 const float origin_aa[3] = {UNPACK2(ggd->origin), 0.0f};
676 }
677}
678
680 wmGizmoGroup *gzgroup,
681 wmGizmo * /*gz*/,
682 const wmEvent * /*event*/)
683{
684 GizmoGroup2D *ggd = static_cast<GizmoGroup2D *>(gzgroup->customdata);
685 wmGizmoOpElem *gzop;
686 const float *mid = ggd->origin;
687 const float *min = ggd->min;
688 const float *max = ggd->max;
689
690 /* Define the different transform center points that will be used when grabbing the corners or
691 * rotating with the gizmo.
692 *
693 * The coordinates are referred to as their cardinal directions:
694 *
695 * N
696 * o
697 * NW | NE
698 * x-----------x
699 * | |
700 * W| C |E
701 * | |
702 * x-----------x
703 * SW S SE
704 */
705 float n[3] = {mid[0], max[1], 0.0f};
706 float w[3] = {min[0], mid[1], 0.0f};
707 float e[3] = {max[0], mid[1], 0.0f};
708 float s[3] = {mid[0], min[1], 0.0f};
709
710 float nw[3] = {min[0], max[1], 0.0f};
711 float ne[3] = {max[0], max[1], 0.0f};
712 float sw[3] = {min[0], min[1], 0.0f};
713 float se[3] = {max[0], min[1], 0.0f};
714
715 float c[3] = {mid[0], mid[1], 0.0f};
716
717 float orient_matrix[3][3];
718 unit_m3(orient_matrix);
719
720 ScrArea *area = CTX_wm_area(C);
721
722 if (ggd->rotation != 0.0f && area->spacetype == SPACE_SEQ) {
723 float origin[3];
725 seq_get_strip_pivot_median(scene, origin);
726 /* We need to rotate the cardinal points so they align with the rotated bounding box. */
727
728 rotate_around_center_v2(n, origin, ggd->rotation);
729 rotate_around_center_v2(w, origin, ggd->rotation);
730 rotate_around_center_v2(e, origin, ggd->rotation);
731 rotate_around_center_v2(s, origin, ggd->rotation);
732
733 rotate_around_center_v2(nw, origin, ggd->rotation);
734 rotate_around_center_v2(ne, origin, ggd->rotation);
735 rotate_around_center_v2(sw, origin, ggd->rotation);
736 rotate_around_center_v2(se, origin, ggd->rotation);
737
738 rotate_around_center_v2(c, origin, ggd->rotation);
739
740 axis_angle_to_mat3_single(orient_matrix, 'Z', ggd->rotation);
741 }
742
743 int orient_type = gizmo2d_calc_transform_orientation(C);
744
746 PropertyRNA *prop_center_override = RNA_struct_find_property(&gzop->ptr, "center_override");
747 PropertyRNA *prop_mouse_dir = RNA_struct_find_property(&gzop->ptr, "mouse_dir_constraint");
748 RNA_property_float_set_array(&gzop->ptr, prop_center_override, e);
749 RNA_property_float_set_array(&gzop->ptr, prop_mouse_dir, orient_matrix[0]);
750 RNA_enum_set(&gzop->ptr, "orient_type", orient_type);
752 RNA_property_float_set_array(&gzop->ptr, prop_center_override, w);
753 RNA_property_float_set_array(&gzop->ptr, prop_mouse_dir, orient_matrix[0]);
754 RNA_enum_set(&gzop->ptr, "orient_type", orient_type);
756 RNA_property_float_set_array(&gzop->ptr, prop_center_override, n);
757 RNA_property_float_set_array(&gzop->ptr, prop_mouse_dir, orient_matrix[1]);
758 RNA_enum_set(&gzop->ptr, "orient_type", orient_type);
760 RNA_property_float_set_array(&gzop->ptr, prop_center_override, s);
761 RNA_property_float_set_array(&gzop->ptr, prop_mouse_dir, orient_matrix[1]);
762 RNA_enum_set(&gzop->ptr, "orient_type", orient_type);
763
765 RNA_property_float_set_array(&gzop->ptr, prop_center_override, ne);
767 RNA_property_float_set_array(&gzop->ptr, prop_center_override, se);
769 RNA_property_float_set_array(&gzop->ptr, prop_center_override, nw);
771 RNA_property_float_set_array(&gzop->ptr, prop_center_override, sw);
772
774 RNA_property_float_set_array(&gzop->ptr, prop_center_override, c);
775}
776
786
788{
789 gizmo2d_xform_setup(C, gzgroup);
790 GizmoGroup2D *ggd = static_cast<GizmoGroup2D *>(gzgroup->customdata);
791 ggd->no_cage = true;
792}
793
795 wmGizmoGroup *gzgroup,
796 wmMsgBus *mbus)
797{
798 bScreen *screen = CTX_wm_screen(C);
799 ScrArea *area = CTX_wm_area(C);
800 ARegion *region = CTX_wm_region(C);
801 gizmo2d_pivot_point_message_subscribe(gzgroup, mbus, screen, area, region);
802}
803
810
812
813/* -------------------------------------------------------------------- */
821
827
829{
830 const wmGizmoType *gzt_arrow = WM_gizmotype_find("GIZMO_GT_arrow_3d", true);
831 const wmGizmoType *gzt_button = WM_gizmotype_find("GIZMO_GT_button_2d", true);
832
834
835 ggd->gizmo_xy[0] = WM_gizmo_new_ptr(gzt_arrow, gzgroup, nullptr);
836 ggd->gizmo_xy[1] = WM_gizmo_new_ptr(gzt_arrow, gzgroup, nullptr);
837 ggd->gizmo_xy[2] = WM_gizmo_new_ptr(gzt_button, gzgroup, nullptr);
838
839 return ggd;
840}
841
842static void gizmo2d_resize_refresh(const bContext *C, wmGizmoGroup *gzgroup)
843{
844 GizmoGroup_Resize2D *ggd = static_cast<GizmoGroup_Resize2D *>(gzgroup->customdata);
845 float origin[2];
846 const bool has_select = gizmo2d_calc_transform_pivot(C, true, origin);
847
848 if (has_select == false) {
849 for (int i = 0; i < ARRAY_SIZE(ggd->gizmo_xy); i++) {
850 ggd->gizmo_xy[i]->flag |= WM_GIZMO_HIDDEN;
851 }
852 }
853 else {
854 for (int i = 0; i < ARRAY_SIZE(ggd->gizmo_xy); i++) {
855 ggd->gizmo_xy[i]->flag &= ~WM_GIZMO_HIDDEN;
856 }
857 copy_v2_v2(ggd->origin, origin);
859 }
860}
861
863{
864 ARegion *region = CTX_wm_region(C);
865 GizmoGroup_Resize2D *ggd = static_cast<GizmoGroup_Resize2D *>(gzgroup->customdata);
866 float origin[3] = {UNPACK2(ggd->origin), 0.0f};
867
868 gizmo2d_origin_to_region(region, origin);
869
870 for (int i = 0; i < ARRAY_SIZE(ggd->gizmo_xy); i++) {
871 wmGizmo *gz = ggd->gizmo_xy[i];
873
874 if (i < 2) {
875 float axis[3] = {0.0f}, rotated_axis[3];
876 axis[i] = 1.0f;
877 rotate_v3_v3v3fl(rotated_axis, axis, float3{0, 0, 1}, ggd->rotation);
879 }
880 }
881}
882
883static void gizmo2d_resize_setup(const bContext * /*C*/, wmGizmoGroup *gzgroup)
884{
885
886 wmOperatorType *ot_resize = WM_operatortype_find("TRANSFORM_OT_resize", true);
888 gzgroup->customdata = ggd;
889
890 for (int i = 0; i < ARRAY_SIZE(ggd->gizmo_xy); i++) {
891 wmGizmo *gz = ggd->gizmo_xy[i];
892
893 /* Custom handler! */
895
896 if (i < 2) {
897 float color[4], color_hi[4];
898 gizmo2d_get_axis_color(i, color, color_hi);
899
900 /* Set up widget data. */
901 RNA_float_set(gz->ptr, "length", 1.0f);
902 RNA_enum_set(gz->ptr, "draw_style", ED_GIZMO_ARROW_STYLE_BOX);
903
906 WM_gizmo_set_color_highlight(gz, color_hi);
907
908 WM_gizmo_set_scale(gz, 1.0f);
909 }
910 else {
911 float color[4], color_hi[4];
913 copy_v4_v4(color_hi, color);
914 color[3] *= 0.6f;
915
916 PropertyRNA *prop = RNA_struct_find_property(gz->ptr, "icon");
917 RNA_property_enum_set(gz->ptr, prop, ICON_NONE);
918
919 RNA_enum_set(gz->ptr, "draw_options", ED_GIZMO_BUTTON_SHOW_BACKDROP);
920 /* Make the center low alpha. */
921 WM_gizmo_set_line_width(gz, 2.0f);
922 RNA_float_set(gz->ptr, "backdrop_fill_alpha", 0.0);
924 WM_gizmo_set_color_highlight(gz, color_hi);
925
926 WM_gizmo_set_scale(gz, 1.2f);
927 }
928
929 /* Assign operator. */
930 PointerRNA *ptr = WM_gizmo_operator_set(gz, 0, ot_resize, nullptr);
931 if (i < 2) {
932 bool constraint[3] = {false};
933 constraint[i] = true;
934 if (RNA_struct_find_property(ptr, "constraint_axis")) {
935 RNA_boolean_set_array(ptr, "constraint_axis", constraint);
936 }
937 }
938 RNA_boolean_set(ptr, "release_confirm", true);
939 }
940}
941
943 wmGizmoGroup * /*gzgroup*/,
944 wmGizmo *gz,
945 const wmEvent * /*event*/)
946{
947 wmGizmoOpElem *gzop;
948 int orient_type = gizmo2d_calc_transform_orientation(C);
949
950 gzop = WM_gizmo_operator_get(gz, 0);
951 RNA_enum_set(&gzop->ptr, "orient_type", orient_type);
952}
953
955 wmGizmoGroup *gzgroup,
956 wmMsgBus *mbus)
957{
958 bScreen *screen = CTX_wm_screen(C);
959 ScrArea *area = CTX_wm_area(C);
960 ARegion *region = CTX_wm_region(C);
961 gizmo2d_pivot_point_message_subscribe(gzgroup, mbus, screen, area, region);
962}
963
974
976
977/* -------------------------------------------------------------------- */
985
990
992{
993 const wmGizmoType *gzt_button = WM_gizmotype_find("GIZMO_GT_button_2d", true);
994
996
997 ggd->gizmo = WM_gizmo_new_ptr(gzt_button, gzgroup, nullptr);
998
999 return ggd;
1000}
1001
1002static void gizmo2d_rotate_refresh(const bContext *C, wmGizmoGroup *gzgroup)
1003{
1004 GizmoGroup_Rotate2D *ggd = static_cast<GizmoGroup_Rotate2D *>(gzgroup->customdata);
1005 float origin[2];
1006 const bool has_select = gizmo2d_calc_transform_pivot(C, true, origin);
1007
1008 if (has_select == false) {
1009 ggd->gizmo->flag |= WM_GIZMO_HIDDEN;
1010 }
1011 else {
1012 ggd->gizmo->flag &= ~WM_GIZMO_HIDDEN;
1013 copy_v2_v2(ggd->origin, origin);
1014 }
1015}
1016
1018{
1019 ARegion *region = CTX_wm_region(C);
1020 GizmoGroup_Rotate2D *ggd = static_cast<GizmoGroup_Rotate2D *>(gzgroup->customdata);
1021 float origin[3] = {UNPACK2(ggd->origin), 0.0f};
1022
1023 gizmo2d_origin_to_region(region, origin);
1024
1025 wmGizmo *gz = ggd->gizmo;
1026 WM_gizmo_set_matrix_location(gz, origin);
1027}
1028
1029static void gizmo2d_rotate_setup(const bContext * /*C*/, wmGizmoGroup *gzgroup)
1030{
1031
1032 wmOperatorType *ot_resize = WM_operatortype_find("TRANSFORM_OT_rotate", true);
1034 gzgroup->customdata = ggd;
1035
1036 /* Other setup functions iterate over axis. */
1037 {
1038 wmGizmo *gz = ggd->gizmo;
1039
1040 /* Custom handler! */
1042 WM_gizmo_set_scale(gz, 1.2f);
1043
1044 {
1045 float color[4];
1047
1048 PropertyRNA *prop = RNA_struct_find_property(gz->ptr, "icon");
1049 RNA_property_enum_set(gz->ptr, prop, ICON_NONE);
1050
1051 RNA_enum_set(gz->ptr, "draw_options", ED_GIZMO_BUTTON_SHOW_BACKDROP);
1052 /* Make the center low alpha. */
1053 WM_gizmo_set_line_width(gz, 2.0f);
1054 RNA_float_set(gz->ptr, "backdrop_fill_alpha", 0.0);
1057 }
1058
1059 /* Assign operator. */
1060 PointerRNA *ptr = WM_gizmo_operator_set(gz, 0, ot_resize, nullptr);
1061 RNA_boolean_set(ptr, "release_confirm", true);
1062 }
1063}
1064
1066 wmGizmoGroup *gzgroup,
1067 wmMsgBus *mbus)
1068{
1069 bScreen *screen = CTX_wm_screen(C);
1070 ScrArea *area = CTX_wm_area(C);
1071 ARegion *region = CTX_wm_region(C);
1072 gizmo2d_pivot_point_message_subscribe(gzgroup, mbus, screen, area, region);
1073}
1074
1084
1086
1087} // namespace blender::ed::transform
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define C
Definition RandGen.cpp:29
#define UNPACK2(a)
#define BLI_INLINE
#define BLI_assert_msg(a, msg)
btScalar max
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
Definition btVector3.h:356
int64_t size() const
int64_t remove_if(Predicate &&predicate)
const T & data(const Action &owning_action) const
static bool gizmo2d_generic_poll(const bContext *C, wmGizmoGroupType *gzgt)
void ED_widgetgroup_gizmo2d_resize_callbacks_set(wmGizmoGroupType *gzgt)
void ED_widgetgroup_gizmo2d_xform_callbacks_set(wmGizmoGroupType *gzgt)
static void gizmo2d_xform_invoke_prepare(const bContext *C, wmGizmoGroup *gzgroup, wmGizmo *, const wmEvent *)
static float gizmo2d_calc_rotation(const bContext *C)
static void gizmo2d_rotate_refresh(const bContext *C, wmGizmoGroup *gzgroup)
static GizmoGroup_Rotate2D * gizmogroup2d_rotate_init(wmGizmoGroup *gzgroup)
static int gizmo2d_calc_transform_orientation(const bContext *C)
BLI_INLINE void gizmo2d_origin_to_region(ARegion *region, float *r_origin)
static void gizmo2d_resize_invoke_prepare(const bContext *C, wmGizmoGroup *, wmGizmo *gz, const wmEvent *)
static void gizmo2d_resize_setup(const bContext *, wmGizmoGroup *gzgroup)
static void gizmo2d_xform_setup(const bContext *, wmGizmoGroup *gzgroup)
static void gizmo2d_xform_refresh(const bContext *C, wmGizmoGroup *gzgroup)
static void rotate_around_center_v2(float point[2], const float center[2], const float angle)
static GizmoGroup2D * gizmogroup2d_init(wmGizmoGroup *gzgroup)
static void gizmo2d_xform_no_cage_message_subscribe(const bContext *C, wmGizmoGroup *gzgroup, wmMsgBus *mbus)
static void gizmo2d_get_axis_color(const int axis_idx, float *r_col, float *r_col_hi)
static void gizmo2d_xform_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
static void gizmo2d_rotate_message_subscribe(const bContext *C, wmGizmoGroup *gzgroup, wmMsgBus *mbus)
static void gizmo2d_resize_message_subscribe(const bContext *C, wmGizmoGroup *gzgroup, wmMsgBus *mbus)
void ED_widgetgroup_gizmo2d_xform_no_cage_callbacks_set(wmGizmoGroupType *gzgt)
static bool gizmo2d_calc_bounds(const bContext *C, float *r_center, float *r_min, float *r_max)
static bool gizmo2d_calc_transform_pivot(const bContext *C, bool handles_as_knot_selected_only, float r_pivot[2])
static wmOperatorStatus gizmo2d_modal(bContext *C, wmGizmo *widget, const wmEvent *, eWM_GizmoFlagTweak)
static void gizmo2d_rotate_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
static void gizmo2d_xform_setup_no_cage(const bContext *C, wmGizmoGroup *gzgroup)
static void gizmo2d_resize_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
static void gizmo2d_pivot_point_message_subscribe(wmGizmoGroup *gzgroup, wmMsgBus *mbus, bScreen *screen, ScrArea *area, ARegion *region)
static void gizmo2d_resize_refresh(const bContext *C, wmGizmoGroup *gzgroup)
static bool seq_get_strip_pivot_median(const Scene *scene, float r_pivot[2])
static void gizmo2d_rotate_setup(const bContext *, wmGizmoGroup *gzgroup)
static GizmoGroup_Resize2D * gizmogroup2d_resize_init(wmGizmoGroup *gzgroup)
void ED_widgetgroup_gizmo2d_rotate_callbacks_set(wmGizmoGroupType *gzgt)
float2 image_preview_unit_to_px(const Scene *scene, const float2 co_src)
float2 image_transform_mirror_factor_get(const Strip *strip)
ListBaseT< Strip > * active_seqbase_get(const Editing *ed)
Definition sequencer.cc:463
Editing * editing_get(const Scene *scene)
Definition sequencer.cc:304
Bounds< float2 > image_transform_bounding_box_from_strips_get(Scene *scene, Span< Strip * > strips)
float2 image_transform_origin_preview_offset_get(const Scene *scene, const Strip *strip)
ListBaseT< SeqTimelineChannel > * channels_displayed_get(const Editing *ed)
Definition channels.cc:26
VectorSet< Strip * > query_rendered_strips(const Scene *scene, ListBaseT< SeqTimelineChannel > *channels, ListBaseT< Strip > *seqbase, const int timeline_frame, const int displayed_channel)
Definition iterator.cc:239
void get_color_4fv(int colorid, float col[4])
void view2d_view_to_region_fl(const View2D *v2d, float x, float y, float *r_region_x, float *r_region_y) ATTR_NONNULL()
Definition view2d.cc:1720
void view2d_view_to_region_m4(const View2D *v2d, float matrix[4][4]) ATTR_NONNULL()
Definition view2d.cc:1789
void WM_gizmo_set_matrix_rotation_from_z_axis(wmGizmo *gz, const float z_axis[3])
Definition wm_gizmo.cc:273
UserDef U
Definition blender.cc:58
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
ScrArea * CTX_wm_area(const bContext *C)
Scene * CTX_data_sequencer_scene(const bContext *C)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
void WM_gizmo_do_msg_notify_tag_refresh(bContext *, wmMsgSubscribeKey *, wmMsgSubscribeValue *msg_val)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void mul_v2_fl(float r[2], float f)
void WM_gizmo_set_color(wmGizmo *gz, const float color[4])
Definition wm_gizmo.cc:327
MINLINE void copy_v2_v2(float r[2], const float a[2])
const wmGizmoType * WM_gizmotype_find(const StringRef idname, bool quiet)
@ V3D_AROUND_CENTER_BOUNDS
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void WM_gizmo_set_color_highlight(wmGizmo *gz, const float color_hi[4])
Definition wm_gizmo.cc:336
bool ED_uvedit_minmax_multi(const Scene *scene, Span< Object * > objects_edit, float r_min[2], float r_max[2])
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const float *values)
@ TH_GIZMO_VIEW_ALIGN
void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const bool *values)
void WM_gizmo_set_matrix_offset_location(wmGizmo *gz, const float offset[3])
Definition wm_gizmo.cc:298
@ ED_GIZMO_CAGE_XFORM_FLAG_SCALE
@ ED_GIZMO_CAGE_XFORM_FLAG_TRANSLATE
@ ED_GIZMO_CAGE_XFORM_FLAG_ROTATE
void ED_region_tag_redraw_editor_overlays(ARegion *region)
Definition area.cc:745
void WM_gizmo_set_line_width(wmGizmo *gz, const float line_width)
Definition wm_gizmo.cc:318
ViewLayer * CTX_data_view_layer(const bContext *C)
void WM_gizmo_set_scale(wmGizmo *gz, const float scale)
Definition wm_gizmo.cc:313
Global G
Definition blender.cc:57
VecBase< float, 2 > float2
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
MINLINE void add_v2_v2(float r[2], const float a[2])
void rotate_v2_v2fl(float r[2], const float p[2], float angle)
eWM_GizmoFlagTweak
Gizmo tweak flag. Bit-flag passed to gizmo while tweaking.
void WM_gizmo_set_fn_custom_modal(wmGizmo *gz, wmGizmoFnModal fn)
Definition wm_gizmo.cc:347
Object * CTX_data_edit_object(const bContext *C)
bool ED_uvedit_center_from_pivot_ex(const Main &bmain, const SpaceImage *sima, Scene *scene, ViewLayer *view_layer, float r_center[2], char mode, bool *r_has_select)
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
void unit_m4(float m[4][4])
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
void ED_mask_center_from_pivot_ex(const bContext *C, ScrArea *area, char mode, bool handles_as_knot_selected_only, float r_center[2], bool *r_has_select)
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
MINLINE bool equals_v2v2(const float v1[2], const float v2[2]) ATTR_WARN_UNUSED_RESULT
@ ED_GIZMO_ARROW_STYLE_BOX
void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const bool *values)
void WM_msg_subscribe_rna(wmMsgBus *mbus, PointerRNA *ptr, const PropertyRNA *prop, const wmMsgSubscribeValue *msg_val_params, const char *id_repr)
@ WM_GIZMO_DRAW_OFFSET_SCALE
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
void rotate_m4(float mat[4][4], char axis, float angle)
Main * CTX_data_main(const bContext *C)
void unit_m3(float m[3][3])
MINLINE float max_ff(float a, float b)
void mid_v2_v2v2(float r[2], const float a[2], const float b[2])
void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value)
void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value)
Scene * CTX_data_scene(const bContext *C)
bScreen * CTX_wm_screen(const bContext *C)
wmKeyMap * WM_gizmogroup_setup_keymap_generic_maybe_drag(const wmGizmoGroupType *, wmKeyConfig *kc)
MINLINE void copy_v4_v4(float r[4], const float a[4])
@ ED_GIZMO_CAGE_DRAW_FLAG_XFORM_CENTER_HANDLE
@ ED_GIZMO_CAGE_DRAW_FLAG_CORNER_HANDLES
bool ED_mask_selected_minmax(const bContext *C, float min[2], float max[2], bool handles_as_knot, bool handles_as_knot_selected_only)
VecBase< float, 3 > float3
Vector< Object * > BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(const Main &bmain, const Scene *scene, ViewLayer *view_layer, const View3D *v3d)
wmGizmoOpElem * WM_gizmo_operator_get(wmGizmo *gz, int part_index)
Definition wm_gizmo.cc:191
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
wmGizmo * WM_gizmo_new_ptr(const wmGizmoType *gzt, wmGizmoGroup *gzgroup, PointerRNA *properties)
Definition wm_gizmo.cc:84
MINLINE void zero_v2(float r[2])
ARegion * CTX_wm_region(const bContext *C)
bool ED_space_image_show_uvedit(const SpaceImage *sima, Object *obedit)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
void axis_angle_to_mat3_single(float R[3][3], char axis, float angle)
void rotate_v3_v3v3fl(float r[3], const float p[3], const float axis[3], float angle)
bool ED_space_image_show_mask(const SpaceImage *sima)
@ ED_GIZMO_CAGE2D_PART_SCALE_MIN_X
@ ED_GIZMO_CAGE2D_PART_SCALE_MAX_X
@ ED_GIZMO_CAGE2D_PART_ROTATE
@ ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MAX_Y
@ ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MIN_Y
@ ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MAX_Y
@ ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MIN_Y
@ ED_GIZMO_CAGE2D_PART_SCALE_MAX_Y
@ ED_GIZMO_CAGE2D_PART_SCALE_MIN_Y
#define min(a, b)
Definition sort.cc:38
struct RenderData r
struct ToolSettings * toolsettings
ListBaseT< SpaceLink > spacedata
eSpaceImage_Mode mode
eSpaceSeq_Gizmo_Flag gizmo_flag
eSpaceSeq_RegionType mainb
struct SequencerToolSettings * sequencer_tool_settings
wmGizmoGroupFnMsgBusSubscribe message_subscribe
wmGizmoGroupFnRefresh refresh
wmGizmoGroupFnInvokePrepare invoke_prepare
wmGizmoGroupFnSetupKeymap setup_keymap
wmGizmoGroupFnDrawPrepare draw_prepare
float matrix_basis[4][4]
float matrix_space[4][4]
float matrix_offset[4][4]
eWM_GizmoFlag flag
#define GIZMO_AXIS_LINE_WIDTH