Blender  V3.3
interface_query.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
9 #include "BLI_listbase.h"
10 #include "BLI_math.h"
11 #include "BLI_rect.h"
12 #include "BLI_string.h"
13 #include "BLI_utildefines.h"
14 
15 #include "DNA_screen_types.h"
16 
17 #include "UI_interface.h"
18 #include "UI_view2d.h"
19 
20 #include "RNA_access.h"
21 
22 #include "interface_intern.h"
23 
24 #include "WM_api.h"
25 #include "WM_types.h"
26 
27 /* -------------------------------------------------------------------- */
31 bool ui_but_is_editable(const uiBut *but)
32 {
33  return !ELEM(but->type,
40 }
41 
43 {
45 }
46 
47 bool ui_but_is_toggle(const uiBut *but)
48 {
49  return ELEM(but->type,
57  UI_BTYPE_ROW);
58 }
59 
60 bool ui_but_is_interactive_ex(const uiBut *but, const bool labeledit, const bool for_tooltip)
61 {
62  /* NOTE: #UI_BTYPE_LABEL is included for highlights, this allows drags. */
63  if (but->type == UI_BTYPE_LABEL) {
64  if (for_tooltip) {
65  /* It's important labels are considered interactive for the purpose of showing tooltip. */
66  if (!ui_but_drag_is_draggable(but) && but->tip_func == nullptr) {
67  return false;
68  }
69  }
70  else {
71  if (!ui_but_drag_is_draggable(but)) {
72  return false;
73  }
74  }
75  }
76 
78  return false;
79  }
80  if (but->flag & UI_HIDDEN) {
81  return false;
82  }
83  if (but->flag & UI_SCROLLED) {
84  return false;
85  }
86  if ((but->type == UI_BTYPE_TEXT) &&
87  (ELEM(but->emboss, UI_EMBOSS_NONE, UI_EMBOSS_NONE_OR_STATUS)) && !labeledit) {
88  return false;
89  }
90  if ((but->type == UI_BTYPE_LISTROW) && labeledit) {
91  return false;
92  }
93 
94  return true;
95 }
96 
97 bool ui_but_is_interactive(const uiBut *but, const bool labeledit)
98 {
99  return ui_but_is_interactive_ex(but, labeledit, false);
100 }
101 
102 bool UI_but_is_utf8(const uiBut *but)
103 {
104  if (but->rnaprop) {
105  const int subtype = RNA_property_subtype(but->rnaprop);
107  }
108  return !(but->flag & UI_BUT_NO_UTF8);
109 }
110 
111 #ifdef USE_UI_POPOVER_ONCE
113 {
114  return (ELEM(but->type, UI_BTYPE_BUT, UI_BTYPE_DECORATOR) || ui_but_is_toggle(but));
115 }
116 #endif
117 
119 {
120  return (but->rnapoin.data && but->rnaprop &&
122  PROP_COLOR,
127  PROP_MATRIX,
128  PROP_EULER,
131  PROP_XYZ,
134  PROP_COORDS));
135 }
136 
138 bool UI_but_is_tool(const uiBut *but)
139 {
140  /* very evil! */
141  if (but->optype != nullptr) {
142  if (g_ot_tool_set_by_id == nullptr) {
143  g_ot_tool_set_by_id = WM_operatortype_find("WM_OT_tool_set_by_id", false);
144  }
145  if (but->optype == g_ot_tool_set_by_id) {
146  return true;
147  }
148  }
149  return false;
150 }
151 
153 {
154  if ((but->drawstr[0] == '\0') && !ui_block_is_popover(but->block)) {
155  return UI_but_is_tool(but);
156  }
157  return false;
158 }
159 
160 int ui_but_icon(const uiBut *but)
161 {
162  if (!(but->flag & UI_HAS_ICON)) {
163  return ICON_NONE;
164  }
165 
166  /* Consecutive icons can be toggle between. */
167  if (but->drawflag & UI_BUT_ICON_REVERSE) {
168  return but->icon - but->iconadd;
169  }
170  return but->icon + but->iconadd;
171 }
172 
175 /* -------------------------------------------------------------------- */
179 void ui_but_pie_dir(RadialDirection dir, float vec[2])
180 {
181  float angle;
182 
183  BLI_assert(dir != UI_RADIAL_NONE);
184 
185  angle = DEG2RADF((float)ui_radial_dir_to_angle[dir]);
186  vec[0] = cosf(angle);
187  vec[1] = sinf(angle);
188 }
189 
190 static bool ui_but_isect_pie_seg(const uiBlock *block, const uiBut *but)
191 {
192  const float angle_range = (block->pie_data.flags & UI_PIE_DEGREES_RANGE_LARGE) ? M_PI_4 :
193  M_PI_4 / 2.0;
194  float vec[2];
195 
196  if (block->pie_data.flags & UI_PIE_INVALID_DIR) {
197  return false;
198  }
199 
200  ui_but_pie_dir(but->pie_dir, vec);
201 
202  if (saacos(dot_v2v2(vec, block->pie_data.pie_dir)) < angle_range) {
203  return true;
204  }
205 
206  return false;
207 }
208 
209 bool ui_but_contains_pt(const uiBut *but, float mx, float my)
210 {
211  return BLI_rctf_isect_pt(&but->rect, mx, my);
212 }
213 
214 bool ui_but_contains_rect(const uiBut *but, const rctf *rect)
215 {
216  return BLI_rctf_isect(&but->rect, rect, nullptr);
217 }
218 
219 bool ui_but_contains_point_px(const uiBut *but, const ARegion *region, const int xy[2])
220 {
221  uiBlock *block = but->block;
222  if (!ui_region_contains_point_px(region, xy)) {
223  return false;
224  }
225 
226  float mx = xy[0], my = xy[1];
227  ui_window_to_block_fl(region, block, &mx, &my);
228 
229  if (but->pie_dir != UI_RADIAL_NONE) {
230  if (!ui_but_isect_pie_seg(block, but)) {
231  return false;
232  }
233  }
234  else if (!ui_but_contains_pt(but, mx, my)) {
235  return false;
236  }
237 
238  return true;
239 }
240 
241 bool ui_but_contains_point_px_icon(const uiBut *but, ARegion *region, const wmEvent *event)
242 {
243  rcti rect;
244  int x = event->xy[0], y = event->xy[1];
245 
246  ui_window_to_block(region, but->block, &x, &y);
247 
248  BLI_rcti_rctf_copy(&rect, &but->rect);
249 
250  if (but->imb || but->type == UI_BTYPE_COLOR) {
251  /* use button size itself */
252  }
253  else if (but->drawflag & UI_BUT_ICON_LEFT) {
254  rect.xmax = rect.xmin + (BLI_rcti_size_y(&rect));
255  }
256  else {
257  const int delta = BLI_rcti_size_x(&rect) - BLI_rcti_size_y(&rect);
258  rect.xmin += delta / 2;
259  rect.xmax -= delta / 2;
260  }
261 
262  return BLI_rcti_isect_pt(&rect, x, y);
263 }
264 
265 static uiBut *ui_but_find(const ARegion *region,
266  const uiButFindPollFn find_poll,
267  const void *find_custom_data)
268 {
269  LISTBASE_FOREACH (uiBlock *, block, &region->uiblocks) {
270  LISTBASE_FOREACH_BACKWARD (uiBut *, but, &block->buttons) {
271  if (find_poll && find_poll(but, find_custom_data) == false) {
272  continue;
273  }
274  return but;
275  }
276  }
277 
278  return nullptr;
279 }
280 
282  const int xy[2],
283  const bool labeledit,
284  const bool for_tooltip,
285  const uiButFindPollFn find_poll,
286  const void *find_custom_data)
287 {
288  uiBut *butover = nullptr;
289 
290  if (!ui_region_contains_point_px(region, xy)) {
291  return nullptr;
292  }
293  LISTBASE_FOREACH (uiBlock *, block, &region->uiblocks) {
294  float mx = xy[0], my = xy[1];
295  ui_window_to_block_fl(region, block, &mx, &my);
296 
297  LISTBASE_FOREACH_BACKWARD (uiBut *, but, &block->buttons) {
298  if (find_poll && find_poll(but, find_custom_data) == false) {
299  continue;
300  }
301  if (ui_but_is_interactive_ex(but, labeledit, for_tooltip)) {
302  if (but->pie_dir != UI_RADIAL_NONE) {
303  if (ui_but_isect_pie_seg(block, but)) {
304  butover = but;
305  break;
306  }
307  }
308  else if (ui_but_contains_pt(but, mx, my)) {
309  butover = but;
310  break;
311  }
312  }
313  }
314 
315  /* CLIP_EVENTS prevents the event from reaching other blocks */
316  if (block->flag & UI_BLOCK_CLIP_EVENTS) {
317  /* check if mouse is inside block */
318  if (BLI_rctf_isect_pt(&block->rect, mx, my)) {
319  break;
320  }
321  }
322  }
323 
324  return butover;
325 }
326 
327 uiBut *ui_but_find_mouse_over(const ARegion *region, const wmEvent *event)
328 {
330  region, event->xy, event->modifier & KM_CTRL, false, nullptr, nullptr);
331 }
332 
333 uiBut *ui_but_find_rect_over(const struct ARegion *region, const rcti *rect_px)
334 {
335  if (!ui_region_contains_rect_px(region, rect_px)) {
336  return nullptr;
337  }
338 
339  /* Currently no need to expose this at the moment. */
340  const bool labeledit = true;
341  rctf rect_px_fl;
342  BLI_rctf_rcti_copy(&rect_px_fl, rect_px);
343  uiBut *butover = nullptr;
344 
345  LISTBASE_FOREACH (uiBlock *, block, &region->uiblocks) {
346  rctf rect_block;
347  ui_window_to_block_rctf(region, block, &rect_block, &rect_px_fl);
348 
349  LISTBASE_FOREACH_BACKWARD (uiBut *, but, &block->buttons) {
350  if (ui_but_is_interactive(but, labeledit)) {
351  /* No pie menu support. */
352  BLI_assert(but->pie_dir == UI_RADIAL_NONE);
353  if (ui_but_contains_rect(but, &rect_block)) {
354  butover = but;
355  break;
356  }
357  }
358  }
359 
360  /* CLIP_EVENTS prevents the event from reaching other blocks */
361  if (block->flag & UI_BLOCK_CLIP_EVENTS) {
362  /* check if mouse is inside block */
363  if (BLI_rctf_isect(&block->rect, &rect_block, nullptr)) {
364  break;
365  }
366  }
367  }
368  return butover;
369 }
370 
371 uiBut *ui_list_find_mouse_over_ex(const ARegion *region, const int xy[2])
372 {
373  if (!ui_region_contains_point_px(region, xy)) {
374  return nullptr;
375  }
376  LISTBASE_FOREACH (uiBlock *, block, &region->uiblocks) {
377  float mx = xy[0], my = xy[1];
378  ui_window_to_block_fl(region, block, &mx, &my);
379  LISTBASE_FOREACH_BACKWARD (uiBut *, but, &block->buttons) {
380  if (but->type == UI_BTYPE_LISTBOX && ui_but_contains_pt(but, mx, my)) {
381  return but;
382  }
383  }
384  }
385 
386  return nullptr;
387 }
388 
389 uiBut *ui_list_find_mouse_over(const ARegion *region, const wmEvent *event)
390 {
391  if (event == nullptr) {
392  /* If there is no info about the mouse, just act as if there is nothing underneath it. */
393  return nullptr;
394  }
395  return ui_list_find_mouse_over_ex(region, event->xy);
396 }
397 
398 uiList *UI_list_find_mouse_over(const ARegion *region, const wmEvent *event)
399 {
400  uiBut *list_but = ui_list_find_mouse_over(region, event);
401  if (!list_but) {
402  return nullptr;
403  }
404 
405  return static_cast<uiList *>(list_but->custom_data);
406 }
407 
408 static bool ui_list_contains_row(const uiBut *listbox_but, const uiBut *listrow_but)
409 {
410  BLI_assert(listbox_but->type == UI_BTYPE_LISTBOX);
411  BLI_assert(listrow_but->type == UI_BTYPE_LISTROW);
412  /* The list box and its rows have the same RNA data (active data pointer/prop). */
413  return ui_but_rna_equals(listbox_but, listrow_but);
414 }
415 
416 static bool ui_but_is_listbox_with_row(const uiBut *but, const void *customdata)
417 {
418  const uiBut *row_but = static_cast<const uiBut *>(customdata);
419  return (but->type == UI_BTYPE_LISTBOX) && ui_list_contains_row(but, row_but);
420 }
421 
422 uiBut *ui_list_find_from_row(const ARegion *region, const uiBut *row_but)
423 {
424  return ui_but_find(region, ui_but_is_listbox_with_row, row_but);
425 }
426 
427 static bool ui_but_is_listrow(const uiBut *but, const void *UNUSED(customdata))
428 {
429  return but->type == UI_BTYPE_LISTROW;
430 }
431 
432 uiBut *ui_list_row_find_mouse_over(const ARegion *region, const int xy[2])
433 {
434  return ui_but_find_mouse_over_ex(region, xy, false, false, ui_but_is_listrow, nullptr);
435 }
436 
438  int index;
440 };
441 
442 static bool ui_but_is_listrow_at_index(const uiBut *but, const void *customdata)
443 {
444  const ListRowFindIndexData *find_data = static_cast<const ListRowFindIndexData *>(customdata);
445 
446  return ui_but_is_listrow(but, nullptr) && ui_list_contains_row(find_data->listbox, but) &&
447  (but->hardmax == find_data->index);
448 }
449 
450 uiBut *ui_list_row_find_from_index(const ARegion *region, const int index, uiBut *listbox)
451 {
452  BLI_assert(listbox->type == UI_BTYPE_LISTBOX);
454  data.index = index;
455  data.listbox = listbox;
456  return ui_but_find(region, ui_but_is_listrow_at_index, &data);
457 }
458 
459 static bool ui_but_is_view_item_fn(const uiBut *but, const void *UNUSED(customdata))
460 {
461  return but->type == UI_BTYPE_VIEW_ITEM;
462 }
463 
464 uiBut *ui_view_item_find_mouse_over(const ARegion *region, const int xy[2])
465 {
466  return ui_but_find_mouse_over_ex(region, xy, false, false, ui_but_is_view_item_fn, nullptr);
467 }
468 
469 static bool ui_but_is_active_view_item(const uiBut *but, const void *UNUSED(customdata))
470 {
471  if (but->type != UI_BTYPE_VIEW_ITEM) {
472  return false;
473  }
474 
475  const uiButViewItem *view_item_but = (const uiButViewItem *)but;
476  return UI_view_item_is_active(view_item_but->view_item);
477 }
478 
480 {
481  return ui_but_find(region, ui_but_is_active_view_item, nullptr);
482 }
483 
486 /* -------------------------------------------------------------------- */
491 {
492  while (but->prev) {
493  but = but->prev;
494  if (ui_but_is_editable(but)) {
495  return but;
496  }
497  }
498  return nullptr;
499 }
500 
502 {
503  while (but->next) {
504  but = but->next;
505  if (ui_but_is_editable(but)) {
506  return but;
507  }
508  }
509  return nullptr;
510 }
511 
513 {
514  LISTBASE_FOREACH (uiBut *, but, &block->buttons) {
515  if (ui_but_is_editable(but)) {
516  return but;
517  }
518  }
519  return nullptr;
520 }
521 
523 {
524  uiBut *but = static_cast<uiBut *>(block->buttons.last);
525  while (but) {
526  if (ui_but_is_editable(but)) {
527  return but;
528  }
529  but = but->prev;
530  }
531  return nullptr;
532 }
533 
534 bool ui_but_is_cursor_warp(const uiBut *but)
535 {
536  if (U.uiflag & USER_CONTINUOUS_MOUSE) {
537  if (ELEM(but->type,
538  UI_BTYPE_NUM,
545  return true;
546  }
547  }
548 
549  return false;
550 }
551 
553 {
554  return but->rnaprop && (RNA_property_subtype(but->rnaprop) == PROP_PASSWORD);
555 }
556 
559 /* -------------------------------------------------------------------- */
564 {
565  if (but->flag & UI_BUT_HAS_SEP_CHAR) {
566  const char *str_sep = strrchr(but->drawstr, UI_SEP_CHAR);
567  if (str_sep != nullptr) {
568  return (str_sep - but->drawstr);
569  }
570  }
571  return strlen(but->drawstr);
572 }
573 
574 size_t ui_but_drawstr_without_sep_char(const uiBut *but, char *str, size_t str_maxlen)
575 {
576  size_t str_len_clip = ui_but_drawstr_len_without_sep_char(but);
577  return BLI_strncpy_rlen(str, but->drawstr, min_zz(str_len_clip + 1, str_maxlen));
578 }
579 
581 {
582  if (but->tip == nullptr) {
583  return 0;
584  }
585 
586  const char *str_sep = strchr(but->tip, '\n');
587  if (str_sep != nullptr) {
588  return (str_sep - but->tip);
589  }
590  return strlen(but->tip);
591 }
592 
595 /* -------------------------------------------------------------------- */
600 {
601  LISTBASE_FOREACH (uiBut *, but, &block->buttons) {
602  if (but->active) {
603  return but;
604  }
605  }
606 
607  return nullptr;
608 }
609 
610 bool ui_block_is_menu(const uiBlock *block)
611 {
612  return (((block->flag & UI_BLOCK_LOOP) != 0) &&
613  /* non-menu popups use keep-open, so check this is off */
614  ((block->flag & UI_BLOCK_KEEP_OPEN) == 0));
615 }
616 
617 bool ui_block_is_popover(const uiBlock *block)
618 {
619  return (block->flag & UI_BLOCK_POPOVER) != 0;
620 }
621 
622 bool ui_block_is_pie_menu(const uiBlock *block)
623 {
624  return ((block->flag & UI_BLOCK_RADIAL) != 0);
625 }
626 
627 bool ui_block_is_popup_any(const uiBlock *block)
628 {
629  return (ui_block_is_menu(block) || ui_block_is_popover(block) || ui_block_is_pie_menu(block));
630 }
631 
632 static const uiBut *ui_but_next_non_separator(const uiBut *but)
633 {
634  for (; but; but = but->next) {
635  if (!ELEM(but->type, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE)) {
636  return but;
637  }
638  }
639  return nullptr;
640 }
641 
642 bool UI_block_is_empty_ex(const uiBlock *block, const bool skip_title)
643 {
644  const uiBut *but = static_cast<const uiBut *>(block->buttons.first);
645  if (skip_title) {
646  /* Skip the first label, since popups often have a title,
647  * we may want to consider the block empty in this case. */
648  but = ui_but_next_non_separator(but);
649  if (but && but->type == UI_BTYPE_LABEL) {
650  but = but->next;
651  }
652  }
653  return (ui_but_next_non_separator(but) == nullptr);
654 }
655 
656 bool UI_block_is_empty(const uiBlock *block)
657 {
658  return UI_block_is_empty_ex(block, false);
659 }
660 
662 {
663  if (ui_block_is_menu(block) && !ui_block_is_pie_menu(block)) {
664  const uiBut *but = static_cast<const uiBut *>(block->buttons.last);
665  return (but && !ELEM(but->type, UI_BTYPE_SEPR_LINE, UI_BTYPE_SEPR));
666  }
667  return true;
668 }
669 
672 /* -------------------------------------------------------------------- */
676 uiBlock *ui_block_find_mouse_over_ex(const ARegion *region, const int xy[2], bool only_clip)
677 {
678  if (!ui_region_contains_point_px(region, xy)) {
679  return nullptr;
680  }
681  LISTBASE_FOREACH (uiBlock *, block, &region->uiblocks) {
682  if (only_clip) {
683  if ((block->flag & UI_BLOCK_CLIP_EVENTS) == 0) {
684  continue;
685  }
686  }
687  float mx = xy[0], my = xy[1];
688  ui_window_to_block_fl(region, block, &mx, &my);
689  if (BLI_rctf_isect_pt(&block->rect, mx, my)) {
690  return block;
691  }
692  }
693  return nullptr;
694 }
695 
696 uiBlock *ui_block_find_mouse_over(const ARegion *region, const wmEvent *event, bool only_clip)
697 {
698  return ui_block_find_mouse_over_ex(region, event->xy, only_clip);
699 }
700 
703 /* -------------------------------------------------------------------- */
708 {
709  LISTBASE_FOREACH (uiBlock *, block, &region->uiblocks) {
710  uiBut *but = ui_block_active_but_get(block);
711  if (but) {
712  return but;
713  }
714  }
715 
716  return nullptr;
717 }
718 
719 uiBut *ui_region_find_first_but_test_flag(ARegion *region, int flag_include, int flag_exclude)
720 {
721  LISTBASE_FOREACH (uiBlock *, block, &region->uiblocks) {
722  LISTBASE_FOREACH (uiBut *, but, &block->buttons) {
723  if (((but->flag & flag_include) == flag_include) && ((but->flag & flag_exclude) == 0)) {
724  return but;
725  }
726  }
727  }
728 
729  return nullptr;
730 }
731 
734 /* -------------------------------------------------------------------- */
738 bool ui_region_contains_point_px(const ARegion *region, const int xy[2])
739 {
740  rcti winrct;
741  ui_region_winrct_get_no_margin(region, &winrct);
742  if (!BLI_rcti_isect_pt_v(&winrct, xy)) {
743  return false;
744  }
745 
746  /* also, check that with view2d, that the mouse is not over the scroll-bars
747  * NOTE: care is needed here, since the mask rect may include the scroll-bars
748  * even when they are not visible, so we need to make a copy of the mask to
749  * use to check
750  */
751  if (region->v2d.mask.xmin != region->v2d.mask.xmax) {
752  const View2D *v2d = &region->v2d;
753  int mx = xy[0], my = xy[1];
754 
755  ui_window_to_region(region, &mx, &my);
756  if (!BLI_rcti_isect_pt(&v2d->mask, mx, my) ||
757  UI_view2d_mouse_in_scrollers(region, &region->v2d, xy)) {
758  return false;
759  }
760  }
761 
762  return true;
763 }
764 
765 bool ui_region_contains_rect_px(const ARegion *region, const rcti *rect_px)
766 {
767  rcti winrct;
768  ui_region_winrct_get_no_margin(region, &winrct);
769  if (!BLI_rcti_isect(&winrct, rect_px, nullptr)) {
770  return false;
771  }
772 
773  /* See comment in 'ui_region_contains_point_px' */
774  if (region->v2d.mask.xmin != region->v2d.mask.xmax) {
775  const View2D *v2d = &region->v2d;
776  rcti rect_region;
777  ui_window_to_region_rcti(region, &rect_region, rect_px);
778  if (!BLI_rcti_isect(&v2d->mask, &rect_region, nullptr) ||
779  UI_view2d_rect_in_scrollers(region, &region->v2d, rect_px)) {
780  return false;
781  }
782  }
783 
784  return true;
785 }
786 
789 /* -------------------------------------------------------------------- */
794 {
795  LISTBASE_FOREACH (ARegion *, region, &screen->regionbase) {
796  rcti winrct;
797 
798  ui_region_winrct_get_no_margin(region, &winrct);
799 
800  if (BLI_rcti_isect_pt_v(&winrct, xy)) {
801  return region;
802  }
803  }
804  return nullptr;
805 }
806 
808 {
809  return ui_screen_region_find_mouse_over_ex(screen, event->xy);
810 }
811 
814 /* -------------------------------------------------------------------- */
819 {
820  g_ot_tool_set_by_id = nullptr;
821 }
822 
#define BLI_assert(a)
Definition: BLI_assert.h:46
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
#define LISTBASE_FOREACH_BACKWARD(type, var, list)
Definition: BLI_listbase.h:348
MINLINE float saacos(float fac)
MINLINE size_t min_zz(size_t a, size_t b)
#define M_PI_4
Definition: BLI_math_base.h:26
#define DEG2RADF(_deg)
MINLINE float dot_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
bool BLI_rcti_isect_pt_v(const struct rcti *rect, const int xy[2])
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition: BLI_rect.h:190
bool BLI_rctf_isect(const struct rctf *src1, const struct rctf *src2, struct rctf *dest)
bool BLI_rcti_isect_pt(const struct rcti *rect, int x, int y)
bool BLI_rcti_isect(const struct rcti *src1, const struct rcti *src2, struct rcti *dest)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition: BLI_rect.h:186
bool BLI_rctf_isect_pt(const struct rctf *rect, float x, float y)
void BLI_rctf_rcti_copy(struct rctf *dst, const struct rcti *src)
void BLI_rcti_rctf_copy(struct rcti *dst, const struct rctf *src)
size_t BLI_strncpy_rlen(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: string.c:120
#define UNUSED(x)
#define ELEM(...)
@ USER_CONTINUOUS_MOUSE
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
@ PROP_MATRIX
Definition: RNA_types.h:158
@ PROP_DIRECTION
Definition: RNA_types.h:155
@ PROP_XYZ
Definition: RNA_types.h:162
@ PROP_ACCELERATION
Definition: RNA_types.h:157
@ PROP_BYTESTRING
Definition: RNA_types.h:133
@ PROP_FILENAME
Definition: RNA_types.h:131
@ PROP_PASSWORD
Definition: RNA_types.h:136
@ PROP_COLOR
Definition: RNA_types.h:153
@ PROP_AXISANGLE
Definition: RNA_types.h:161
@ PROP_EULER
Definition: RNA_types.h:159
@ PROP_COORDS
Definition: RNA_types.h:167
@ PROP_DIRPATH
Definition: RNA_types.h:130
@ PROP_COLOR_GAMMA
Definition: RNA_types.h:165
@ PROP_TRANSLATION
Definition: RNA_types.h:154
@ PROP_XYZ_LENGTH
Definition: RNA_types.h:163
@ PROP_QUATERNION
Definition: RNA_types.h:160
@ PROP_FILEPATH
Definition: RNA_types.h:129
@ PROP_VELOCITY
Definition: RNA_types.h:156
@ UI_BUT_ICON_LEFT
Definition: UI_interface.h:260
@ UI_BUT_ICON_REVERSE
Definition: UI_interface.h:294
@ UI_BUT_NO_UTF8
Definition: UI_interface.h:207
@ UI_BUT_HAS_SEP_CHAR
Definition: UI_interface.h:222
@ UI_EMBOSS_NONE
Definition: UI_interface.h:109
@ UI_EMBOSS_NONE_OR_STATUS
Definition: UI_interface.h:116
#define UI_SEP_CHAR
Definition: UI_interface.h:83
bool UI_view_item_is_active(const uiViewItemHandle *item_handle)
@ UI_BTYPE_BUT
Definition: UI_interface.h:330
@ UI_BTYPE_TOGGLE
Definition: UI_interface.h:340
@ UI_BTYPE_LISTBOX
Definition: UI_interface.h:366
@ UI_BTYPE_ROUNDBOX
Definition: UI_interface.h:359
@ UI_BTYPE_TOGGLE_N
Definition: UI_interface.h:341
@ UI_BTYPE_NUM_SLIDER
Definition: UI_interface.h:339
@ UI_BTYPE_HSVCIRCLE
Definition: UI_interface.h:368
@ UI_BTYPE_LISTROW
Definition: UI_interface.h:367
@ UI_BTYPE_TEXT
Definition: UI_interface.h:332
@ UI_BTYPE_BUT_TOGGLE
Definition: UI_interface.h:345
@ UI_BTYPE_VIEW_ITEM
Definition: UI_interface.h:393
@ UI_BTYPE_HSVCUBE
Definition: UI_interface.h:356
@ UI_BTYPE_LABEL
Definition: UI_interface.h:354
@ UI_BTYPE_CURVE
Definition: UI_interface.h:363
@ UI_BTYPE_ICON_TOGGLE_N
Definition: UI_interface.h:343
@ UI_BTYPE_DECORATOR
Definition: UI_interface.h:391
@ UI_BTYPE_ROW
Definition: UI_interface.h:331
@ UI_BTYPE_SEARCH_MENU
Definition: UI_interface.h:372
@ UI_BTYPE_SEPR_LINE
Definition: UI_interface.h:386
@ UI_BTYPE_PROGRESS_BAR
Definition: UI_interface.h:383
@ UI_BTYPE_CHECKBOX_N
Definition: UI_interface.h:348
@ UI_BTYPE_SEPR
Definition: UI_interface.h:385
@ UI_BTYPE_NUM
Definition: UI_interface.h:337
@ UI_BTYPE_CURVEPROFILE
Definition: UI_interface.h:365
@ UI_BTYPE_TRACK_PREVIEW
Definition: UI_interface.h:369
@ UI_BTYPE_COLOR
Definition: UI_interface.h:349
@ UI_BTYPE_CHECKBOX
Definition: UI_interface.h:347
@ UI_BTYPE_ICON_TOGGLE
Definition: UI_interface.h:342
@ UI_BLOCK_CLIP_EVENTS
Definition: UI_interface.h:150
@ UI_BLOCK_RADIAL
Definition: UI_interface.h:156
@ UI_BLOCK_LOOP
Definition: UI_interface.h:135
@ UI_BLOCK_KEEP_OPEN
Definition: UI_interface.h:144
@ UI_BLOCK_POPOVER
Definition: UI_interface.h:157
char char char char UI_view2d_rect_in_scrollers(const struct ARegion *region, const struct View2D *v2d, const struct rcti *rect) ATTR_NONNULL(1
char char UI_view2d_mouse_in_scrollers(const struct ARegion *region, const struct View2D *v2d, const int xy[2]) ATTR_NONNULL(1
@ KM_CTRL
Definition: WM_types.h:239
unsigned int U
Definition: btGjkEpa3.h:78
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
Definition: btVector3.h:356
#define sinf(x)
Definition: cuda/compat.h:102
#define cosf(x)
Definition: cuda/compat.h:101
#define str(s)
const short ui_radial_dir_to_angle[8]
Definition: interface.cc:1556
void ui_window_to_region_rcti(const ARegion *region, rcti *rect_dst, const rcti *rct_src)
Definition: interface.cc:245
void ui_window_to_region(const ARegion *region, int *r_x, int *r_y)
Definition: interface.cc:239
bool ui_but_rna_equals(const uiBut *a, const uiBut *b)
Definition: interface.cc:705
void ui_window_to_block_fl(const ARegion *region, uiBlock *block, float *r_x, float *r_y)
Definition: interface.cc:191
void ui_window_to_block_rctf(const struct ARegion *region, uiBlock *block, rctf *rct_dst, const rctf *rct_src)
Definition: interface.cc:218
void ui_region_winrct_get_no_margin(const struct ARegion *region, struct rcti *r_rect)
Definition: interface.cc:342
void ui_window_to_block(const ARegion *region, uiBlock *block, int *r_x, int *r_y)
Definition: interface.cc:228
bool ui_but_drag_is_draggable(const uiBut *but)
RadialDirection
@ UI_RADIAL_NONE
bool(* uiButFindPollFn)(const uiBut *but, const void *customdata)
@ UI_PIE_DEGREES_RANGE_LARGE
@ UI_PIE_INVALID_DIR
@ UI_HIDDEN
@ UI_SCROLLED
@ UI_HAS_ICON
uiBut * ui_but_find_rect_over(const struct ARegion *region, const rcti *rect_px)
uiBut * ui_but_prev(uiBut *but)
size_t ui_but_drawstr_len_without_sep_char(const uiBut *but)
static bool ui_but_is_listrow_at_index(const uiBut *but, const void *customdata)
bool UI_block_is_empty_ex(const uiBlock *block, const bool skip_title)
static bool ui_but_is_view_item_fn(const uiBut *but, const void *UNUSED(customdata))
size_t ui_but_drawstr_without_sep_char(const uiBut *but, char *str, size_t str_maxlen)
bool UI_block_can_add_separator(const uiBlock *block)
bool ui_but_contains_point_px(const uiBut *but, const ARegion *region, const int xy[2])
bool ui_block_is_popup_any(const uiBlock *block)
ARegion * ui_screen_region_find_mouse_over_ex(bScreen *screen, const int xy[2])
uiBut * ui_region_find_active_but(ARegion *region)
bool ui_but_is_toggle(const uiBut *but)
bool ui_but_contains_pt(const uiBut *but, float mx, float my)
uiBut * ui_but_last(uiBlock *block)
bool ui_but_contains_rect(const uiBut *but, const rctf *rect)
bool ui_but_contains_password(const uiBut *but)
static bool ui_but_is_active_view_item(const uiBut *but, const void *UNUSED(customdata))
bool UI_but_is_utf8(const uiBut *but)
size_t ui_but_tip_len_only_first_line(const uiBut *but)
bool UI_block_is_empty(const uiBlock *block)
uiBut * ui_list_row_find_mouse_over(const ARegion *region, const int xy[2])
static wmOperatorType * g_ot_tool_set_by_id
static bool ui_list_contains_row(const uiBut *listbox_but, const uiBut *listrow_but)
static bool ui_but_isect_pie_seg(const uiBlock *block, const uiBut *but)
bool ui_but_contains_point_px_icon(const uiBut *but, ARegion *region, const wmEvent *event)
bool ui_block_is_popover(const uiBlock *block)
bool ui_but_is_editable(const uiBut *but)
bool ui_block_is_pie_menu(const uiBlock *block)
uiBut * ui_region_find_first_but_test_flag(ARegion *region, int flag_include, int flag_exclude)
bool ui_but_is_cursor_warp(const uiBut *but)
uiBut * ui_list_find_from_row(const ARegion *region, const uiBut *row_but)
static uiBut * ui_but_find(const ARegion *region, const uiButFindPollFn find_poll, const void *find_custom_data)
uiBut * ui_but_find_mouse_over_ex(const ARegion *region, const int xy[2], const bool labeledit, const bool for_tooltip, const uiButFindPollFn find_poll, const void *find_custom_data)
uiBut * ui_view_item_find_active(const ARegion *region)
uiList * UI_list_find_mouse_over(const ARegion *region, const wmEvent *event)
bool ui_region_contains_point_px(const ARegion *region, const int xy[2])
ARegion * ui_screen_region_find_mouse_over(bScreen *screen, const wmEvent *event)
uiBut * ui_view_item_find_mouse_over(const ARegion *region, const int xy[2])
uiBlock * ui_block_find_mouse_over(const ARegion *region, const wmEvent *event, bool only_clip)
bool ui_but_is_interactive_ex(const uiBut *but, const bool labeledit, const bool for_tooltip)
uiBut * ui_but_find_mouse_over(const ARegion *region, const wmEvent *event)
static const uiBut * ui_but_next_non_separator(const uiBut *but)
uiBut * ui_block_active_but_get(const uiBlock *block)
void ui_interface_tag_script_reload_queries(void)
uiBut * ui_but_next(uiBut *but)
uiBut * ui_list_find_mouse_over_ex(const ARegion *region, const int xy[2])
bool ui_block_is_menu(const uiBlock *block)
uiBut * ui_but_first(uiBlock *block)
bool ui_region_contains_rect_px(const ARegion *region, const rcti *rect_px)
uiBut * ui_list_find_mouse_over(const ARegion *region, const wmEvent *event)
bool ui_but_is_popover_once_compat(const uiBut *but)
bool ui_but_is_interactive(const uiBut *but, const bool labeledit)
void ui_but_pie_dir(RadialDirection dir, float vec[2])
uiBlock * ui_block_find_mouse_over_ex(const ARegion *region, const int xy[2], bool only_clip)
int ui_but_icon(const uiBut *but)
static bool ui_but_is_listbox_with_row(const uiBut *but, const void *customdata)
bool ui_but_is_editable_as_text(const uiBut *but)
bool UI_but_is_tool(const uiBut *but)
static bool ui_but_is_listrow(const uiBut *but, const void *UNUSED(customdata))
uiBut * ui_list_row_find_from_index(const ARegion *region, const int index, uiBut *listbox)
bool UI_but_has_tooltip_label(const uiBut *but)
bool ui_but_has_array_value(const uiBut *but)
PropertySubType RNA_property_subtype(PropertyRNA *prop)
Definition: rna_access.c:1015
ListBase uiblocks
void * last
Definition: DNA_listBase.h:31
void * first
Definition: DNA_listBase.h:31
float pie_dir[2]
void * data
Definition: RNA_types.h:38
ListBase regionbase
int xmin
Definition: DNA_vec_types.h:63
int xmax
Definition: DNA_vec_types.h:63
struct PieMenuData pie_data
ListBase buttons
uiViewItemHandle * view_item
const char * tip
struct uiBut * prev
void * custom_data
struct uiBut * next
RadialDirection pie_dir
struct uiHandleButtonData * active
eButType type
float hardmax
uiBlock * block
eUIEmbossType emboss
uiButToolTipFunc tip_func
struct ImBuf * imb
BIFIconID icon
struct wmOperatorType * optype
short iconadd
char drawstr[UI_MAX_DRAW_STR]
struct PropertyRNA * rnaprop
struct PointerRNA rnapoin
int xy[2]
Definition: WM_types.h:682
uint8_t modifier
Definition: WM_types.h:693
int xy[2]
Definition: wm_draw.c:135
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)