Blender  V3.3
transform_gizmo_2d.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
11 #include "MEM_guardedalloc.h"
12 
13 #include "BLI_math.h"
14 
15 #include "DNA_object_types.h"
16 #include "DNA_screen_types.h"
17 #include "DNA_space_types.h"
18 #include "DNA_view3d_types.h"
19 
20 #include "BKE_context.h"
21 #include "BKE_global.h"
22 #include "BKE_layer.h"
23 
24 #include "RNA_access.h"
25 
26 #include "UI_resources.h"
27 #include "UI_view2d.h"
28 
29 #include "WM_api.h"
30 #include "WM_message.h"
31 #include "WM_types.h"
32 
33 #include "ED_gizmo_library.h"
34 #include "ED_gizmo_utils.h"
35 #include "ED_image.h"
36 #include "ED_screen.h"
37 #include "ED_uvedit.h"
38 
39 #include "SEQ_channels.h"
40 #include "SEQ_iterator.h"
41 #include "SEQ_sequencer.h"
42 #include "SEQ_time.h"
43 #include "SEQ_transform.h"
44 
45 #include "transform.h" /* own include */
46 
47 /* -------------------------------------------------------------------- */
51 static bool gizmo2d_generic_poll(const bContext *C, wmGizmoGroupType *gzgt)
52 {
54  return false;
55  }
56 
57  if ((U.gizmo_flag & USER_GIZMO_DRAW) == 0) {
58  return false;
59  }
60 
61  if (G.moving) {
62  return false;
63  }
64 
66  if (area == NULL) {
67  return false;
68  }
69 
70  /* NOTE: below this is assumed to be a tool gizmo.
71  * If there are cases that need to check other flags - this function could be split. */
72  switch (area->spacetype) {
73  case SPACE_IMAGE: {
74  const SpaceImage *sima = area->spacedata.first;
75  Object *obedit = CTX_data_edit_object(C);
76  if (!ED_space_image_show_uvedit(sima, obedit)) {
77  return false;
78  }
79  break;
80  }
81  case SPACE_SEQ: {
82  const SpaceSeq *sseq = area->spacedata.first;
84  return false;
85  }
86  if (sseq->mainb != SEQ_DRAW_IMG_IMBUF) {
87  return false;
88  }
91  if (ed == NULL) {
92  return false;
93  }
94  break;
95  }
96  }
97 
98  return true;
99 }
100 
102  struct wmMsgBus *mbus,
103  /* Additional args. */
104  bScreen *screen,
105  ScrArea *area,
106  ARegion *region)
107 {
108  wmMsgSubscribeValue msg_sub_value_gz_tag_refresh = {
109  .owner = region,
110  .user_data = gzgroup->parent_gzmap,
112  };
113 
114  switch (area->spacetype) {
115  case SPACE_IMAGE: {
116  SpaceImage *sima = area->spacedata.first;
117  PointerRNA ptr;
118  RNA_pointer_create(&screen->id, &RNA_SpaceImageEditor, sima, &ptr);
119  {
120  const PropertyRNA *props[] = {
121  &rna_SpaceImageEditor_pivot_point,
122  (sima->around == V3D_AROUND_CURSOR) ? &rna_SpaceImageEditor_cursor_location : NULL,
123  };
124  for (int i = 0; i < ARRAY_SIZE(props); i++) {
125  if (props[i] == NULL) {
126  continue;
127  }
128  WM_msg_subscribe_rna(mbus, &ptr, props[i], &msg_sub_value_gz_tag_refresh, __func__);
129  }
130  }
131  break;
132  }
133  }
134 }
135 
138 /* -------------------------------------------------------------------- */
148 /* axes as index */
149 enum {
152 
154 };
155 
156 typedef struct GizmoGroup2D {
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 
166  bool no_cage;
167 
169 
170 /* **************** Utilities **************** */
171 
172 static void gizmo2d_get_axis_color(const int axis_idx, float *r_col, float *r_col_hi)
173 {
174  const float alpha = 0.6f;
175  const float alpha_hi = 1.0f;
176  int col_id;
177 
178  switch (axis_idx) {
179  case MAN2D_AXIS_TRANS_X:
180  col_id = TH_AXIS_X;
181  break;
182  case MAN2D_AXIS_TRANS_Y:
183  col_id = TH_AXIS_Y;
184  break;
185  default:
186  BLI_assert(0);
187  col_id = TH_AXIS_Y;
188  break;
189  }
190 
191  UI_GetThemeColor4fv(col_id, r_col);
192 
193  copy_v4_v4(r_col_hi, r_col);
194  r_col[3] *= alpha;
195  r_col_hi[3] *= alpha_hi;
196 }
197 
199 {
200  const wmGizmoType *gzt_arrow = WM_gizmotype_find("GIZMO_GT_arrow_3d", true);
201  const wmGizmoType *gzt_cage = WM_gizmotype_find("GIZMO_GT_cage_2d", true);
202  const wmGizmoType *gzt_button = WM_gizmotype_find("GIZMO_GT_button_2d", true);
203 
204  GizmoGroup2D *ggd = MEM_callocN(sizeof(GizmoGroup2D), __func__);
205 
206  ggd->translate_xy[0] = WM_gizmo_new_ptr(gzt_arrow, gzgroup, NULL);
207  ggd->translate_xy[1] = WM_gizmo_new_ptr(gzt_arrow, gzgroup, NULL);
208  ggd->translate_xy[2] = WM_gizmo_new_ptr(gzt_button, gzgroup, NULL);
209  ggd->cage = WM_gizmo_new_ptr(gzt_cage, gzgroup, NULL);
210 
211  RNA_enum_set(ggd->cage->ptr,
212  "transform",
215 
216  return ggd;
217 }
218 
222 static bool gizmo2d_calc_bounds(const bContext *C, float *r_center, float *r_min, float *r_max)
223 {
224  float min_buf[2], max_buf[2];
225  if (r_min == NULL) {
226  r_min = min_buf;
227  }
228  if (r_max == NULL) {
229  r_max = max_buf;
230  }
231 
233  bool has_select = false;
234  if (area->spacetype == SPACE_IMAGE) {
236  ViewLayer *view_layer = CTX_data_view_layer(C);
237  uint objects_len = 0;
239  view_layer, NULL, &objects_len);
240  if (ED_uvedit_minmax_multi(scene, objects, objects_len, r_min, r_max)) {
241  has_select = true;
242  }
243  MEM_freeN(objects);
244  }
245  else if (area->spacetype == SPACE_SEQ) {
248  ListBase *seqbase = SEQ_active_seqbase_get(ed);
252  int selected_strips = SEQ_collection_len(strips);
253  if (selected_strips > 0) {
254  has_select = true;
256  scene, strips, selected_strips != 1, r_min, r_max);
257  }
258  SEQ_collection_free(strips);
259  if (selected_strips > 1) {
260  /* Don't draw the cage as transforming multiple strips isn't currently very useful as it
261  * doesn't behave as one would expect.
262  *
263  * This is because our current transform system doesn't support shearing which would make the
264  * scaling transforms of the bounding box behave weirdly.
265  * In addition to this, the rotation of the bounding box can not currently be hooked up
266  * properly to read the result from the transform system (when transforming multiple strips).
267  */
268  const int pivot_point = scene->toolsettings->sequencer_tool_settings->pivot_point;
269  if (pivot_point == V3D_AROUND_CURSOR) {
270  SpaceSeq *sseq = area->spacedata.first;
271  SEQ_image_preview_unit_to_px(scene, sseq->cursor, r_center);
272  }
273  else {
274  mid_v2_v2v2(r_center, r_min, r_max);
275  }
276  zero_v2(r_min);
277  zero_v2(r_max);
278  return has_select;
279  }
280  }
281 
282  if (has_select == false) {
283  zero_v2(r_min);
284  zero_v2(r_max);
285  }
286 
287  mid_v2_v2v2(r_center, r_min, r_max);
288  return has_select;
289 }
290 
292 {
294  if (area->spacetype != SPACE_SEQ) {
295  return V3D_ORIENT_GLOBAL;
296  }
297 
300  ListBase *seqbase = SEQ_active_seqbase_get(ed);
304 
305  bool use_local_orient = SEQ_collection_len(strips) == 1;
306  SEQ_collection_free(strips);
307 
308  if (use_local_orient) {
309  return V3D_ORIENT_LOCAL;
310  }
311  return V3D_ORIENT_GLOBAL;
312 }
313 
314 static float gizmo2d_calc_rotation(const bContext *C)
315 {
317  if (area->spacetype != SPACE_SEQ) {
318  return 0.0f;
319  }
320 
323  ListBase *seqbase = SEQ_active_seqbase_get(ed);
327 
328  if (SEQ_collection_len(strips) == 1) {
329  /* Only return the strip rotation if only one is selected. */
330  Sequence *seq;
331  SEQ_ITERATOR_FOREACH (seq, strips) {
333  float mirror[2];
335  SEQ_collection_free(strips);
336  return transform->rotation * mirror[0] * mirror[1];
337  }
338  }
339 
340  SEQ_collection_free(strips);
341  return 0.0f;
342 }
343 
344 static bool seq_get_strip_pivot_median(const Scene *scene, float r_pivot[2])
345 {
346  zero_v2(r_pivot);
347 
349  ListBase *seqbase = SEQ_active_seqbase_get(ed);
353  bool has_select = SEQ_collection_len(strips) != 0;
354 
355  if (has_select) {
356  Sequence *seq;
357  SEQ_ITERATOR_FOREACH (seq, strips) {
358  float origin[2];
360  add_v2_v2(r_pivot, origin);
361  }
362  mul_v2_fl(r_pivot, 1.0f / SEQ_collection_len(strips));
363  }
364 
365  SEQ_collection_free(strips);
366  return has_select;
367 }
368 
369 static bool gizmo2d_calc_transform_pivot(const bContext *C, float r_pivot[2])
370 {
373  bool has_select = false;
374 
375  if (area->spacetype == SPACE_IMAGE) {
376  SpaceImage *sima = area->spacedata.first;
377  ViewLayer *view_layer = CTX_data_view_layer(C);
378  ED_uvedit_center_from_pivot_ex(sima, scene, view_layer, r_pivot, sima->around, &has_select);
379  }
380  else if (area->spacetype == SPACE_SEQ) {
381  SpaceSeq *sseq = area->spacedata.first;
382  const int pivot_point = scene->toolsettings->sequencer_tool_settings->pivot_point;
383 
384  if (pivot_point == V3D_AROUND_CURSOR) {
385  SEQ_image_preview_unit_to_px(scene, sseq->cursor, r_pivot);
386 
388  ListBase *seqbase = SEQ_active_seqbase_get(ed);
391  scene, channels, seqbase, scene->r.cfra, 0);
393  has_select = SEQ_collection_len(strips) != 0;
394  SEQ_collection_free(strips);
395  }
396  else {
397  has_select = seq_get_strip_pivot_median(scene, r_pivot);
398  }
399  }
400  else {
401  BLI_assert_msg(0, "Unhandled space type!");
402  }
403  return has_select;
404 }
405 
409 BLI_INLINE void gizmo2d_origin_to_region(ARegion *region, float *r_origin)
410 {
411  UI_view2d_view_to_region_fl(&region->v2d, r_origin[0], r_origin[1], &r_origin[0], &r_origin[1]);
412 }
413 
418  wmGizmo *widget,
419  const wmEvent *UNUSED(event),
420  eWM_GizmoFlagTweak UNUSED(tweak_flag))
421 {
422  ARegion *region = CTX_wm_region(C);
423  float origin[3];
424 
426  gizmo2d_origin_to_region(region, origin);
427  WM_gizmo_set_matrix_location(widget, origin);
428 
430 
431  return OPERATOR_RUNNING_MODAL;
432 }
433 
434 static void gizmo2d_xform_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)
435 {
436  wmOperatorType *ot_translate = WM_operatortype_find("TRANSFORM_OT_translate", true);
437  GizmoGroup2D *ggd = gizmogroup2d_init(gzgroup);
438  gzgroup->customdata = ggd;
439 
440  for (int i = 0; i < ARRAY_SIZE(ggd->translate_xy); i++) {
441  wmGizmo *gz = ggd->translate_xy[i];
442 
443  /* custom handler! */
445 
446  if (i < 2) {
447  float color[4], color_hi[4];
448  gizmo2d_get_axis_color(i, color, color_hi);
449 
450  /* set up widget data */
451  RNA_float_set(gz->ptr, "length", 0.8f);
452  float axis[3] = {0.0f};
453  axis[i] = 1.0f;
455 
456  float offset[3] = {0, 0, 0};
457  offset[2] = 0.18f;
460 
463  WM_gizmo_set_color_highlight(gz, color_hi);
464 
465  WM_gizmo_set_scale(gz, 1.0f);
466  }
467  else {
468  float color[4], color_hi[4];
470  copy_v4_v4(color_hi, color);
471  color[3] *= 0.6f;
472 
473  PropertyRNA *prop = RNA_struct_find_property(gz->ptr, "icon");
474  RNA_property_enum_set(gz->ptr, prop, ICON_NONE);
475 
476  RNA_enum_set(gz->ptr, "draw_options", ED_GIZMO_BUTTON_SHOW_BACKDROP);
477  /* Make the center low alpha. */
478  WM_gizmo_set_line_width(gz, 2.0f);
479  RNA_float_set(gz->ptr, "backdrop_fill_alpha", 0.0);
481  WM_gizmo_set_color_highlight(gz, color_hi);
482 
483  WM_gizmo_set_scale(gz, 0.2f);
484  }
485 
486  /* Assign operator. */
487  PointerRNA *ptr = WM_gizmo_operator_set(gz, 0, ot_translate, NULL);
488  if (i < 2) {
489  bool constraint[3] = {false};
490  constraint[i] = true;
491  if (RNA_struct_find_property(ptr, "constraint_axis")) {
492  RNA_boolean_set_array(ptr, "constraint_axis", constraint);
493  }
494  }
495 
496  RNA_boolean_set(ptr, "release_confirm", true);
497  }
498 
499  {
500  wmOperatorType *ot_resize = WM_operatortype_find("TRANSFORM_OT_resize", true);
501  wmOperatorType *ot_rotate = WM_operatortype_find("TRANSFORM_OT_rotate", true);
502  PointerRNA *ptr;
503 
504  /* assign operator */
505  ptr = WM_gizmo_operator_set(ggd->cage, 0, ot_translate, NULL);
506  RNA_boolean_set(ptr, "release_confirm", 1);
507 
508  const bool constraint_x[3] = {1, 0, 0};
509  const bool constraint_y[3] = {0, 1, 0};
510 
512  PropertyRNA *prop_release_confirm = RNA_struct_find_property(ptr, "release_confirm");
513  PropertyRNA *prop_constraint_axis = RNA_struct_find_property(ptr, "constraint_axis");
514  RNA_property_boolean_set(ptr, prop_release_confirm, true);
515  RNA_property_boolean_set_array(ptr, prop_constraint_axis, constraint_x);
517  RNA_property_boolean_set(ptr, prop_release_confirm, true);
518  RNA_property_boolean_set_array(ptr, prop_constraint_axis, constraint_x);
520  RNA_property_boolean_set(ptr, prop_release_confirm, true);
521  RNA_property_boolean_set_array(ptr, prop_constraint_axis, constraint_y);
523  RNA_property_boolean_set(ptr, prop_release_confirm, true);
524  RNA_property_boolean_set_array(ptr, prop_constraint_axis, constraint_y);
525 
528  RNA_property_boolean_set(ptr, prop_release_confirm, true);
531  RNA_property_boolean_set(ptr, prop_release_confirm, true);
534  RNA_property_boolean_set(ptr, prop_release_confirm, true);
537  RNA_property_boolean_set(ptr, prop_release_confirm, true);
539  RNA_property_boolean_set(ptr, prop_release_confirm, true);
540  }
541 }
542 
543 static void rotate_around_center_v2(float point[2], const float center[2], const float angle)
544 {
545  float tmp[2];
546 
547  sub_v2_v2v2(tmp, point, center);
548  rotate_v2_v2fl(point, tmp, angle);
550 }
551 
552 static void gizmo2d_xform_refresh(const bContext *C, wmGizmoGroup *gzgroup)
553 {
554  GizmoGroup2D *ggd = gzgroup->customdata;
555  bool has_select;
556  if (ggd->no_cage) {
557  has_select = gizmo2d_calc_transform_pivot(C, ggd->origin);
558  }
559  else {
560  has_select = gizmo2d_calc_bounds(C, ggd->origin, ggd->min, ggd->max);
562  }
563 
564  bool show_cage = !ggd->no_cage && !equals_v2v2(ggd->min, ggd->max);
565 
566  if (has_select == false) {
567  /* Nothing selected. Disable gizmo drawing and return. */
568  ggd->cage->flag |= WM_GIZMO_HIDDEN;
569  for (int i = 0; i < ARRAY_SIZE(ggd->translate_xy); i++) {
570  ggd->translate_xy[i]->flag |= WM_GIZMO_HIDDEN;
571  }
572  return;
573  }
574 
575  if (!show_cage) {
576  /* Disable cage gizmo drawing and return. */
577  ggd->cage->flag |= WM_GIZMO_HIDDEN;
578  for (int i = 0; i < ARRAY_SIZE(ggd->translate_xy); i++) {
579  ggd->translate_xy[i]->flag &= ~WM_GIZMO_HIDDEN;
580  }
581  return;
582  }
583 
584  /* We will show the cage gizmo! Setup all necessary data. */
585  ggd->cage->flag &= ~WM_GIZMO_HIDDEN;
586  for (int i = 0; i < ARRAY_SIZE(ggd->translate_xy); i++) {
587  ggd->translate_xy[i]->flag |= WM_GIZMO_HIDDEN;
588  }
589 }
590 
591 static void gizmo2d_xform_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
592 {
593  ARegion *region = CTX_wm_region(C);
594  GizmoGroup2D *ggd = gzgroup->customdata;
595  float origin[3] = {UNPACK2(ggd->origin), 0.0f};
596 
597  gizmo2d_origin_to_region(region, origin);
598 
599  for (int i = 0; i < ARRAY_SIZE(ggd->translate_xy); i++) {
600  wmGizmo *gz = ggd->translate_xy[i];
601  WM_gizmo_set_matrix_location(gz, origin);
602  }
603 
605  /* Define the bounding box of the gizmo in the offset transform matrix. */
606  unit_m4(ggd->cage->matrix_offset);
607  ggd->cage->matrix_offset[0][0] = (ggd->max[0] - ggd->min[0]);
608  ggd->cage->matrix_offset[1][1] = (ggd->max[1] - ggd->min[1]);
609 
611 
612  if (area->spacetype == SPACE_SEQ) {
615 
616  float matrix_rotate[4][4];
617  unit_m4(matrix_rotate);
618  copy_v3_v3(matrix_rotate[3], origin);
619  rotate_m4(matrix_rotate, 'Z', ggd->rotation);
620  unit_m4(ggd->cage->matrix_basis);
621  mul_m4_m4m4(ggd->cage->matrix_basis, matrix_rotate, ggd->cage->matrix_basis);
622 
623  float mid[2];
624  sub_v2_v2v2(mid, origin, ggd->origin);
625  mul_v2_fl(mid, -1.0f);
626  copy_v2_v2(ggd->cage->matrix_offset[3], mid);
627  }
628  else {
629  const float origin_aa[3] = {UNPACK2(ggd->origin), 0.0f};
630  WM_gizmo_set_matrix_offset_location(ggd->cage, origin_aa);
631  }
632 }
633 
635  wmGizmoGroup *gzgroup,
636  wmGizmo *UNUSED(gz),
637  const wmEvent *UNUSED(event))
638 {
639  GizmoGroup2D *ggd = gzgroup->customdata;
640  wmGizmoOpElem *gzop;
641  const float *mid = ggd->origin;
642  const float *min = ggd->min;
643  const float *max = ggd->max;
644 
645  /* Define the different transform center points that will be used when grabbing the corners or
646  * rotating with the gizmo.
647  *
648  * The coordinates are referred to as their cardinal directions:
649  * N
650  * o
651  *NW | NE
652  * x-----------x
653  * | |
654  *W| C |E
655  * | |
656  * x-----------x
657  *SW S SE
658  */
659  float n[3] = {mid[0], max[1], 0.0f};
660  float w[3] = {min[0], mid[1], 0.0f};
661  float e[3] = {max[0], mid[1], 0.0f};
662  float s[3] = {mid[0], min[1], 0.0f};
663 
664  float nw[3] = {min[0], max[1], 0.0f};
665  float ne[3] = {max[0], max[1], 0.0f};
666  float sw[3] = {min[0], min[1], 0.0f};
667  float se[3] = {max[0], min[1], 0.0f};
668 
669  float c[3] = {mid[0], mid[1], 0.0f};
670 
671  float orient_matrix[3][3];
672  unit_m3(orient_matrix);
673 
675 
676  if (ggd->rotation != 0.0f && area->spacetype == SPACE_SEQ) {
677  float origin[3];
680  /* We need to rotate the cardinal points so they align with the rotated bounding box. */
681 
682  rotate_around_center_v2(n, origin, ggd->rotation);
683  rotate_around_center_v2(w, origin, ggd->rotation);
684  rotate_around_center_v2(e, origin, ggd->rotation);
685  rotate_around_center_v2(s, origin, ggd->rotation);
686 
687  rotate_around_center_v2(nw, origin, ggd->rotation);
688  rotate_around_center_v2(ne, origin, ggd->rotation);
689  rotate_around_center_v2(sw, origin, ggd->rotation);
690  rotate_around_center_v2(se, origin, ggd->rotation);
691 
692  rotate_around_center_v2(c, origin, ggd->rotation);
693 
694  axis_angle_to_mat3_single(orient_matrix, 'Z', ggd->rotation);
695  }
696 
697  int orient_type = gizmo2d_calc_transform_orientation(C);
698 
700  PropertyRNA *prop_center_override = RNA_struct_find_property(&gzop->ptr, "center_override");
701  PropertyRNA *prop_mouse_dir = RNA_struct_find_property(&gzop->ptr, "mouse_dir_constraint");
702  RNA_property_float_set_array(&gzop->ptr, prop_center_override, e);
703  RNA_property_float_set_array(&gzop->ptr, prop_mouse_dir, orient_matrix[0]);
704  RNA_enum_set(&gzop->ptr, "orient_type", orient_type);
706  RNA_property_float_set_array(&gzop->ptr, prop_center_override, w);
707  RNA_property_float_set_array(&gzop->ptr, prop_mouse_dir, orient_matrix[0]);
708  RNA_enum_set(&gzop->ptr, "orient_type", orient_type);
710  RNA_property_float_set_array(&gzop->ptr, prop_center_override, n);
711  RNA_property_float_set_array(&gzop->ptr, prop_mouse_dir, orient_matrix[1]);
712  RNA_enum_set(&gzop->ptr, "orient_type", orient_type);
714  RNA_property_float_set_array(&gzop->ptr, prop_center_override, s);
715  RNA_property_float_set_array(&gzop->ptr, prop_mouse_dir, orient_matrix[1]);
716  RNA_enum_set(&gzop->ptr, "orient_type", orient_type);
717 
719  RNA_property_float_set_array(&gzop->ptr, prop_center_override, ne);
721  RNA_property_float_set_array(&gzop->ptr, prop_center_override, se);
723  RNA_property_float_set_array(&gzop->ptr, prop_center_override, nw);
725  RNA_property_float_set_array(&gzop->ptr, prop_center_override, sw);
726 
728  RNA_property_float_set_array(&gzop->ptr, prop_center_override, c);
729 }
730 
732 {
733  gzgt->poll = gizmo2d_generic_poll;
734  gzgt->setup = gizmo2d_xform_setup;
739 }
740 
741 static void gizmo2d_xform_setup_no_cage(const bContext *C, wmGizmoGroup *gzgroup)
742 {
743  gizmo2d_xform_setup(C, gzgroup);
744  GizmoGroup2D *ggd = gzgroup->customdata;
745  ggd->no_cage = true;
746 }
747 
749  struct wmGizmoGroup *gzgroup,
750  struct wmMsgBus *mbus)
751 {
752  bScreen *screen = CTX_wm_screen(C);
754  ARegion *region = CTX_wm_region(C);
755  gizmo2d_pivot_point_message_subscribe(gzgroup, mbus, screen, area, region);
756 }
757 
759 {
763 }
764 
767 /* -------------------------------------------------------------------- */
776 typedef struct GizmoGroup_Resize2D {
778  float origin[2];
779  float rotation;
781 
783 {
784  const wmGizmoType *gzt_arrow = WM_gizmotype_find("GIZMO_GT_arrow_3d", true);
785  const wmGizmoType *gzt_button = WM_gizmotype_find("GIZMO_GT_button_2d", true);
786 
787  GizmoGroup_Resize2D *ggd = MEM_callocN(sizeof(GizmoGroup_Resize2D), __func__);
788 
789  ggd->gizmo_xy[0] = WM_gizmo_new_ptr(gzt_arrow, gzgroup, NULL);
790  ggd->gizmo_xy[1] = WM_gizmo_new_ptr(gzt_arrow, gzgroup, NULL);
791  ggd->gizmo_xy[2] = WM_gizmo_new_ptr(gzt_button, gzgroup, NULL);
792 
793  return ggd;
794 }
795 
796 static void gizmo2d_resize_refresh(const bContext *C, wmGizmoGroup *gzgroup)
797 {
798  GizmoGroup_Resize2D *ggd = gzgroup->customdata;
799  float origin[3];
800  const bool has_select = gizmo2d_calc_transform_pivot(C, origin);
801 
802  if (has_select == false) {
803  for (int i = 0; i < ARRAY_SIZE(ggd->gizmo_xy); i++) {
804  ggd->gizmo_xy[i]->flag |= WM_GIZMO_HIDDEN;
805  }
806  }
807  else {
808  for (int i = 0; i < ARRAY_SIZE(ggd->gizmo_xy); i++) {
809  ggd->gizmo_xy[i]->flag &= ~WM_GIZMO_HIDDEN;
810  }
811  copy_v2_v2(ggd->origin, origin);
813  }
814 }
815 
816 static void gizmo2d_resize_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
817 {
818  ARegion *region = CTX_wm_region(C);
819  GizmoGroup_Resize2D *ggd = gzgroup->customdata;
820  float origin[3] = {UNPACK2(ggd->origin), 0.0f};
821 
822  gizmo2d_origin_to_region(region, origin);
823 
824  for (int i = 0; i < ARRAY_SIZE(ggd->gizmo_xy); i++) {
825  wmGizmo *gz = ggd->gizmo_xy[i];
826  WM_gizmo_set_matrix_location(gz, origin);
827 
828  if (i < 2) {
829  float axis[3] = {0.0f}, rotated_axis[3];
830  axis[i] = 1.0f;
831  rotate_v3_v3v3fl(rotated_axis, axis, (float[3]){0, 0, 1}, ggd->rotation);
833  }
834  }
835 }
836 
837 static void gizmo2d_resize_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)
838 {
839 
840  wmOperatorType *ot_resize = WM_operatortype_find("TRANSFORM_OT_resize", true);
842  gzgroup->customdata = ggd;
843 
844  for (int i = 0; i < ARRAY_SIZE(ggd->gizmo_xy); i++) {
845  wmGizmo *gz = ggd->gizmo_xy[i];
846 
847  /* custom handler! */
849 
850  if (i < 2) {
851  float color[4], color_hi[4];
852  gizmo2d_get_axis_color(i, color, color_hi);
853 
854  /* set up widget data */
855  RNA_float_set(gz->ptr, "length", 1.0f);
856  RNA_enum_set(gz->ptr, "draw_style", ED_GIZMO_ARROW_STYLE_BOX);
857 
860  WM_gizmo_set_color_highlight(gz, color_hi);
861 
862  WM_gizmo_set_scale(gz, 1.0f);
863  }
864  else {
865  float color[4], color_hi[4];
867  copy_v4_v4(color_hi, color);
868  color[3] *= 0.6f;
869 
870  PropertyRNA *prop = RNA_struct_find_property(gz->ptr, "icon");
871  RNA_property_enum_set(gz->ptr, prop, ICON_NONE);
872 
873  RNA_enum_set(gz->ptr, "draw_options", ED_GIZMO_BUTTON_SHOW_BACKDROP);
874  /* Make the center low alpha. */
875  WM_gizmo_set_line_width(gz, 2.0f);
876  RNA_float_set(gz->ptr, "backdrop_fill_alpha", 0.0);
878  WM_gizmo_set_color_highlight(gz, color_hi);
879 
880  WM_gizmo_set_scale(gz, 1.2f);
881  }
882 
883  /* Assign operator. */
884  PointerRNA *ptr = WM_gizmo_operator_set(gz, 0, ot_resize, NULL);
885  if (i < 2) {
886  bool constraint[3] = {false};
887  constraint[i] = true;
888  if (RNA_struct_find_property(ptr, "constraint_axis")) {
889  RNA_boolean_set_array(ptr, "constraint_axis", constraint);
890  }
891  }
892  RNA_boolean_set(ptr, "release_confirm", true);
893  }
894 }
895 
897  wmGizmoGroup *UNUSED(gzgroup),
898  wmGizmo *gz,
899  const wmEvent *UNUSED(event))
900 {
901  wmGizmoOpElem *gzop;
902  int orient_type = gizmo2d_calc_transform_orientation(C);
903 
904  gzop = WM_gizmo_operator_get(gz, 0);
905  RNA_enum_set(&gzop->ptr, "orient_type", orient_type);
906 }
907 
908 static void gizmo2d_resize_message_subscribe(const struct bContext *C,
909  struct wmGizmoGroup *gzgroup,
910  struct wmMsgBus *mbus)
911 {
912  bScreen *screen = CTX_wm_screen(C);
914  ARegion *region = CTX_wm_region(C);
915  gizmo2d_pivot_point_message_subscribe(gzgroup, mbus, screen, area, region);
916 }
917 
919 {
920  gzgt->poll = gizmo2d_generic_poll;
921  gzgt->setup = gizmo2d_resize_setup;
927 }
928 
931 /* -------------------------------------------------------------------- */
940 typedef struct GizmoGroup_Rotate2D {
942  float origin[2];
944 
946 {
947  const wmGizmoType *gzt_button = WM_gizmotype_find("GIZMO_GT_button_2d", true);
948 
949  GizmoGroup_Rotate2D *ggd = MEM_callocN(sizeof(GizmoGroup_Rotate2D), __func__);
950 
951  ggd->gizmo = WM_gizmo_new_ptr(gzt_button, gzgroup, NULL);
952 
953  return ggd;
954 }
955 
956 static void gizmo2d_rotate_refresh(const bContext *C, wmGizmoGroup *gzgroup)
957 {
958  GizmoGroup_Rotate2D *ggd = gzgroup->customdata;
959  float origin[3];
960  const bool has_select = gizmo2d_calc_transform_pivot(C, origin);
961 
962  if (has_select == false) {
963  ggd->gizmo->flag |= WM_GIZMO_HIDDEN;
964  }
965  else {
966  ggd->gizmo->flag &= ~WM_GIZMO_HIDDEN;
967  copy_v2_v2(ggd->origin, origin);
968  }
969 }
970 
971 static void gizmo2d_rotate_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
972 {
973  ARegion *region = CTX_wm_region(C);
974  GizmoGroup_Rotate2D *ggd = gzgroup->customdata;
975  float origin[3] = {UNPACK2(ggd->origin), 0.0f};
976 
977  gizmo2d_origin_to_region(region, origin);
978 
979  wmGizmo *gz = ggd->gizmo;
980  WM_gizmo_set_matrix_location(gz, origin);
981 }
982 
983 static void gizmo2d_rotate_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)
984 {
985 
986  wmOperatorType *ot_resize = WM_operatortype_find("TRANSFORM_OT_rotate", true);
988  gzgroup->customdata = ggd;
989 
990  /* Other setup functions iterate over axis. */
991  {
992  wmGizmo *gz = ggd->gizmo;
993 
994  /* custom handler! */
996  WM_gizmo_set_scale(gz, 1.2f);
997 
998  {
999  float color[4];
1001 
1002  PropertyRNA *prop = RNA_struct_find_property(gz->ptr, "icon");
1003  RNA_property_enum_set(gz->ptr, prop, ICON_NONE);
1004 
1005  RNA_enum_set(gz->ptr, "draw_options", ED_GIZMO_BUTTON_SHOW_BACKDROP);
1006  /* Make the center low alpha. */
1007  WM_gizmo_set_line_width(gz, 2.0f);
1008  RNA_float_set(gz->ptr, "backdrop_fill_alpha", 0.0);
1011  }
1012 
1013  /* Assign operator. */
1014  PointerRNA *ptr = WM_gizmo_operator_set(gz, 0, ot_resize, NULL);
1015  RNA_boolean_set(ptr, "release_confirm", true);
1016  }
1017 }
1018 
1019 static void gizmo2d_rotate_message_subscribe(const struct bContext *C,
1020  struct wmGizmoGroup *gzgroup,
1021  struct wmMsgBus *mbus)
1022 {
1023  bScreen *screen = CTX_wm_screen(C);
1024  ScrArea *area = CTX_wm_area(C);
1025  ARegion *region = CTX_wm_region(C);
1026  gizmo2d_pivot_point_message_subscribe(gzgroup, mbus, screen, area, region);
1027 }
1028 
1030 {
1031  gzgt->poll = gizmo2d_generic_poll;
1032  gzgt->setup = gizmo2d_rotate_setup;
1037 }
1038 
struct ScrArea * CTX_wm_area(const bContext *C)
Definition: context.c:738
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
struct Object * CTX_data_edit_object(const bContext *C)
Definition: context.c:1370
struct ViewLayer * CTX_data_view_layer(const bContext *C)
Definition: context.c:1100
struct bScreen * CTX_wm_screen(const bContext *C)
Definition: context.c:733
struct ARegion * CTX_wm_region(const bContext *C)
Definition: context.c:749
#define BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(view_layer, v3d, r_len)
Definition: BKE_layer.h:550
#define BLI_assert(a)
Definition: BLI_assert.h:46
#define BLI_assert_msg(a, msg)
Definition: BLI_assert.h:53
#define BLI_INLINE
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
Definition: math_matrix.c:259
void unit_m3(float m[3][3])
Definition: math_matrix.c:40
void unit_m4(float m[4][4])
Definition: rct.c:1090
void rotate_m4(float mat[4][4], char axis, float angle)
Definition: math_matrix.c:2325
void axis_angle_to_mat3_single(float R[3][3], char axis, float angle)
MINLINE void copy_v4_v4(float r[4], const float a[4])
void rotate_v3_v3v3fl(float r[3], const float p[3], const float axis[3], float angle)
Definition: math_vector.c:800
MINLINE void mul_v2_fl(float r[2], float f)
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void add_v2_v2(float r[2], const float a[2])
MINLINE bool equals_v2v2(const float v1[2], const float v2[2]) ATTR_WARN_UNUSED_RESULT
void mid_v2_v2v2(float r[2], const float a[2], const float b[2])
Definition: math_vector.c:244
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE void zero_v2(float r[2])
void rotate_v2_v2fl(float r[2], const float p[2], float angle)
Definition: math_vector.c:765
unsigned int uint
Definition: BLI_sys_types.h:67
#define UNPACK2(a)
#define ARRAY_SIZE(arr)
#define UNUSED(x)
Object is a sort of wrapper for general info.
@ SPACE_SEQ
@ SPACE_IMAGE
@ SEQ_GIZMO_HIDE
@ SEQ_GIZMO_HIDE_TOOL
@ SEQ_DRAW_IMG_IMBUF
@ USER_GIZMO_DRAW
@ V3D_AROUND_CURSOR
@ V3D_ORIENT_GLOBAL
@ V3D_ORIENT_LOCAL
@ OPERATOR_RUNNING_MODAL
@ ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MAX_Y
@ ED_GIZMO_CAGE2D_PART_ROTATE
@ ED_GIZMO_CAGE2D_PART_SCALE_MAX_Y
@ ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MAX_Y
@ ED_GIZMO_CAGE2D_PART_SCALE_MIN_X
@ ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MIN_Y
@ ED_GIZMO_CAGE2D_PART_SCALE_MAX_X
@ ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MIN_Y
@ ED_GIZMO_CAGE2D_PART_SCALE_MIN_Y
@ ED_GIZMO_BUTTON_SHOW_BACKDROP
@ ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE
@ ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE
@ ED_GIZMO_CAGE2D_XFORM_FLAG_ROTATE
@ ED_GIZMO_ARROW_STYLE_BOX
bool ED_gizmo_poll_or_unlink_delayed_from_tool(const struct bContext *C, struct wmGizmoGroupType *gzgt)
bool ED_space_image_show_uvedit(const struct SpaceImage *sima, struct Object *obedit)
void ED_region_tag_redraw_editor_overlays(struct ARegion *region)
Definition: area.c:690
bool ED_uvedit_minmax_multi(const struct Scene *scene, struct Object **objects_edit, uint objects_len, float r_min[2], float r_max[2])
bool ED_uvedit_center_from_pivot_ex(struct SpaceImage *sima, struct Scene *scene, struct ViewLayer *view_layer, float r_center[2], char mode, bool *r_has_select)
Definition: uvedit_ops.c:317
NSNotificationCenter * center
Read Guarded memory(de)allocation.
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a producing a negative Combine Generate a color from its and blue channels(Deprecated)") DefNode(ShaderNode
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a color
#define C
Definition: RandGen.cpp:25
#define SEQ_ITERATOR_FOREACH(var, collection)
Definition: SEQ_iterator.h:35
@ TH_GIZMO_VIEW_ALIGN
Definition: UI_resources.h:307
@ TH_AXIS_Y
Definition: UI_resources.h:301
@ TH_AXIS_X
Definition: UI_resources.h:300
void UI_GetThemeColor4fv(int colorid, float col[4])
Definition: resources.c:1173
void UI_view2d_view_to_region_fl(const struct View2D *v2d, float x, float y, float *r_region_x, float *r_region_y) ATTR_NONNULL()
void UI_view2d_view_to_region_m4(const struct View2D *v2d, float matrix[4][4]) ATTR_NONNULL()
eWM_GizmoFlagTweak
Gizmo tweak flag. Bit-flag passed to gizmo while tweaking.
@ WM_GIZMO_HIDDEN
@ WM_GIZMO_DRAW_OFFSET_SCALE
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
SIMD_FORCE_INLINE btVector3 transform(const btVector3 &point) const
unsigned int U
Definition: btGjkEpa3.h:78
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
ListBase * SEQ_channels_displayed_get(Editing *ed)
Definition: channels.c:23
Scene scene
SeqCollection * SEQ_query_rendered_strips(const Scene *scene, ListBase *channels, ListBase *seqbase, const int timeline_frame, const int displayed_channel)
Definition: iterator.c:309
uint SEQ_collection_len(const SeqCollection *collection)
Definition: iterator.c:95
void SEQ_filter_selected_strips(SeqCollection *collection)
Definition: iterator.c:366
void SEQ_collection_free(SeqCollection *collection)
Definition: iterator.c:81
ccl_gpu_kernel_postfix ccl_global float int int int sw
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
#define G(x, y, z)
static unsigned c
Definition: RandGen.cpp:83
static void area(int d1, int d2, int e1, int e2, float weights[2])
void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const bool *values)
Definition: rna_access.c:4898
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
Definition: rna_access.c:136
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
Definition: rna_access.c:4874
void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value)
Definition: rna_access.c:3421
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:717
void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value)
Definition: rna_access.c:2180
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
Definition: rna_access.c:4968
void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const float *values)
Definition: rna_access.c:2978
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
Definition: rna_access.c:5015
void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const bool *values)
Definition: rna_access.c:2304
ListBase * SEQ_active_seqbase_get(const Editing *ed)
Definition: sequencer.c:388
Editing * SEQ_editing_get(const Scene *scene)
Definition: sequencer.c:241
#define min(a, b)
Definition: sort.c:35
void SEQ_image_preview_unit_to_px(const Scene *scene, const float co_src[2], float co_dst[2])
void SEQ_image_transform_origin_offset_pixelspace_get(const Scene *scene, const Sequence *seq, float r_origin[2])
void SEQ_image_transform_mirror_factor_get(const Sequence *seq, float r_mirror[2])
void SEQ_image_transform_bounding_box_from_collection(Scene *scene, SeqCollection *strips, bool apply_rotation, float r_min[2], float r_max[2])
wmGizmo * translate_xy[3]
struct ToolSettings * toolsettings
struct RenderData r
float cursor[2]
StripTransform * transform
struct SequencerToolSettings * sequencer_tool_settings
wmGizmoGroupFnSetupKeymap setup_keymap
wmGizmoGroupFnMsgBusSubscribe message_subscribe
wmGizmoGroupFnRefresh refresh
wmGizmoGroupFnInit setup
wmGizmoGroupFnInvokePrepare invoke_prepare
wmGizmoGroupFnPoll poll
wmGizmoGroupFnDrawPrepare draw_prepare
struct wmGizmoMap * parent_gzmap
PointerRNA ptr
float matrix_basis[4][4]
float matrix_offset[4][4]
struct PointerRNA * ptr
float matrix_space[4][4]
eWM_GizmoFlag flag
static void gizmo2d_rotate_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
static void gizmo2d_resize_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)
static void gizmo2d_get_axis_color(const int axis_idx, float *r_col, float *r_col_hi)
void ED_widgetgroup_gizmo2d_xform_no_cage_callbacks_set(wmGizmoGroupType *gzgt)
void ED_widgetgroup_gizmo2d_rotate_callbacks_set(wmGizmoGroupType *gzgt)
static int gizmo2d_calc_transform_orientation(const bContext *C)
static bool gizmo2d_generic_poll(const bContext *C, wmGizmoGroupType *gzgt)
static void gizmo2d_xform_invoke_prepare(const bContext *C, wmGizmoGroup *gzgroup, wmGizmo *UNUSED(gz), const wmEvent *UNUSED(event))
BLI_INLINE void gizmo2d_origin_to_region(ARegion *region, float *r_origin)
static void gizmo2d_xform_no_cage_message_subscribe(const struct bContext *C, struct wmGizmoGroup *gzgroup, struct wmMsgBus *mbus)
static void gizmo2d_resize_refresh(const bContext *C, wmGizmoGroup *gzgroup)
static void gizmo2d_resize_invoke_prepare(const bContext *C, wmGizmoGroup *UNUSED(gzgroup), wmGizmo *gz, const wmEvent *UNUSED(event))
static void gizmo2d_resize_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
void ED_widgetgroup_gizmo2d_resize_callbacks_set(wmGizmoGroupType *gzgt)
static int gizmo2d_modal(bContext *C, wmGizmo *widget, const wmEvent *UNUSED(event), eWM_GizmoFlagTweak UNUSED(tweak_flag))
static void gizmo2d_xform_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
static void rotate_around_center_v2(float point[2], const float center[2], const float angle)
static void gizmo2d_rotate_message_subscribe(const struct bContext *C, struct wmGizmoGroup *gzgroup, struct wmMsgBus *mbus)
void ED_widgetgroup_gizmo2d_xform_callbacks_set(wmGizmoGroupType *gzgt)
struct GizmoGroup_Resize2D GizmoGroup_Resize2D
static GizmoGroup_Resize2D * gizmogroup2d_resize_init(wmGizmoGroup *gzgroup)
static void gizmo2d_rotate_refresh(const bContext *C, wmGizmoGroup *gzgroup)
struct GizmoGroup_Rotate2D GizmoGroup_Rotate2D
static bool gizmo2d_calc_transform_pivot(const bContext *C, float r_pivot[2])
static void gizmo2d_rotate_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)
static void gizmo2d_pivot_point_message_subscribe(struct wmGizmoGroup *gzgroup, struct wmMsgBus *mbus, bScreen *screen, ScrArea *area, ARegion *region)
@ MAN2D_AXIS_LAST
@ MAN2D_AXIS_TRANS_X
@ MAN2D_AXIS_TRANS_Y
static void gizmo2d_resize_message_subscribe(const struct bContext *C, struct wmGizmoGroup *gzgroup, struct wmMsgBus *mbus)
static void gizmo2d_xform_setup_no_cage(const bContext *C, wmGizmoGroup *gzgroup)
static void gizmo2d_xform_refresh(const bContext *C, wmGizmoGroup *gzgroup)
static GizmoGroup_Rotate2D * gizmogroup2d_rotate_init(wmGizmoGroup *gzgroup)
struct GizmoGroup2D GizmoGroup2D
static void gizmo2d_xform_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)
static GizmoGroup2D * gizmogroup2d_init(wmGizmoGroup *gzgroup)
static float gizmo2d_calc_rotation(const bContext *C)
static bool seq_get_strip_pivot_median(const Scene *scene, float r_pivot[2])
static bool gizmo2d_calc_bounds(const bContext *C, float *r_center, float *r_min, float *r_max)
float max
PointerRNA * ptr
Definition: wm_files.c:3480
void WM_gizmo_set_matrix_offset_location(wmGizmo *gz, const float offset[3])
Definition: wm_gizmo.c:299
void WM_gizmo_set_fn_custom_modal(struct wmGizmo *gz, wmGizmoFnModal fn)
Definition: wm_gizmo.c:348
PointerRNA * WM_gizmo_operator_set(wmGizmo *gz, int part_index, wmOperatorType *ot, IDProperty *properties)
Definition: wm_gizmo.c:203
void WM_gizmo_set_color_highlight(wmGizmo *gz, const float color_hi[4])
Definition: wm_gizmo.c:337
void WM_gizmo_set_line_width(wmGizmo *gz, const float line_width)
Definition: wm_gizmo.c:319
wmGizmo * WM_gizmo_new_ptr(const wmGizmoType *gzt, wmGizmoGroup *gzgroup, PointerRNA *properties)
Definition: wm_gizmo.c:81
void WM_gizmo_set_scale(wmGizmo *gz, const float scale)
Definition: wm_gizmo.c:314
void WM_gizmo_set_matrix_location(wmGizmo *gz, const float origin[3])
Definition: wm_gizmo.c:284
void WM_gizmo_set_matrix_rotation_from_z_axis(wmGizmo *gz, const float z_axis[3])
Definition: wm_gizmo.c:274
struct wmGizmoOpElem * WM_gizmo_operator_get(wmGizmo *gz, int part_index)
Definition: wm_gizmo.c:195
void WM_gizmo_set_color(wmGizmo *gz, const float color[4])
Definition: wm_gizmo.c:328
wmKeyMap * WM_gizmogroup_setup_keymap_generic_maybe_drag(const wmGizmoGroupType *UNUSED(gzgt), wmKeyConfig *kc)
void WM_gizmo_do_msg_notify_tag_refresh(bContext *UNUSED(C), wmMsgSubscribeKey *UNUSED(msg_key), wmMsgSubscribeValue *msg_val)
const wmGizmoType * WM_gizmotype_find(const char *idname, bool quiet)
Definition: wm_gizmo_type.c:45
void WM_msg_subscribe_rna(struct wmMsgBus *mbus, PointerRNA *ptr, const PropertyRNA *prop, const wmMsgSubscribeValue *msg_val_params, const char *id_repr)
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)