Blender V5.3
interface_query.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
10
11#include "BLI_listbase.hh"
13#include "BLI_math_vector_c.hh"
14#include "BLI_rect.hh"
15#include "BLI_string.hh"
16#include "BLI_utildefines.hh"
17
18#include "DNA_screen_types.h"
19
20#include "BKE_screen.hh"
21
22#include "UI_view2d.hh"
23
24#include "RNA_access.hh"
25
26#include "interface_intern.hh"
27
28#include "UI_abstract_view.hh"
29
30#include "WM_api.hh"
31#include "WM_types.hh"
32
33namespace blender::ui {
34
35/* -------------------------------------------------------------------- */
38
49
59
72
73bool button_is_interactive_ex(const Button *but, const bool labeledit, const bool for_tooltip)
74{
75 /* NOTE: #ButtonType::Label is included for highlights, this allows drags. */
77 if (for_tooltip) {
78 /* It's important labels are considered interactive for the purpose of showing tooltip. */
79 if (!button_drag_is_draggable(but) && but->tip_func == nullptr &&
80 but->tip_custom_func == nullptr && but->tip_quick_func == nullptr &&
81 (but->tip == nullptr || but->tip[0] == '\0'))
82 {
83 return false;
84 }
85 }
86 else {
87 if (!button_drag_is_draggable(but)) {
88 return false;
89 }
90 }
91 }
92
93 if (ELEM(but->type,
98 {
99 return false;
100 }
101 if (but->flag & UI_HIDDEN) {
102 return false;
103 }
104 if (but->flag & UI_SCROLLED) {
105 return false;
106 }
107 if ((but->type == ButtonType::Text) &&
109 {
110 /* Make editable text buttons with no emboss interactive. */
111 if (!static_cast<const ButtonText *>(but)->use_label_style) {
112 return false;
113 }
114 }
115 if ((but->type == ButtonType::ListRow) && labeledit) {
116 return false;
117 }
118 if (but->type == ButtonType::ViewItem) {
119 const auto *but_item = static_cast<const ButtonViewItem *>(but);
120 return but_item->view_item->is_interactive();
121 }
122
123 return true;
124}
125
126bool button_is_interactive(const Button *but, const bool labeledit)
127{
128 return button_is_interactive_ex(but, labeledit, false);
129}
130
131bool but_is_utf8(const Button *but)
132{
133 if (but->rnaprop) {
135 }
136 return !(but->flag & BUT_NO_UTF8);
137}
138
139#ifdef USE_UI_POPOVER_ONCE
144#endif
145
147{
148 return (but->rnapoin && but->rnaprop && RNA_property_array_check(but->rnaprop));
149}
150
152bool but_is_tool(const Button *but)
153{
154 /* very evil! */
155 if (but->optype != nullptr) {
156 if (g_ot_tool_set_by_id == nullptr) {
157 g_ot_tool_set_by_id = WM_operatortype_find("WM_OT_tool_set_by_id", false);
158 }
159 if (but->optype == g_ot_tool_set_by_id) {
160 return true;
161 }
162 }
163 return false;
164}
165
167{
168 return (but->drawflag & BUT_HAS_QUICK_TOOLTIP) != 0;
169}
170
171int button_icon(const Button *but)
172{
173 if (!(but->flag & UI_HAS_ICON)) {
174 return ICON_NONE;
175 }
176
177 const bool is_preview = (but->flag & BUT_ICON_PREVIEW) != 0;
178
179 /* While icon is loading, show loading icon at the normal icon size. */
180 if (icon_is_preview_deferred_loading(but->icon, is_preview)) {
181 return ICON_PREVIEW_LOADING;
182 }
183
184 /* Consecutive icons can be toggle between. */
185 if (but->drawflag & BUT_ICON_REVERSE) {
186 return but->icon - but->iconadd;
187 }
188 return but->icon + but->iconadd;
189}
190
192
193/* -------------------------------------------------------------------- */
196
197void button_pie_dir(RadialDirection dir, float vec[2])
198{
199 float angle;
200
202
203 angle = DEG2RADF(float(radial_dir_to_angle[dir]));
204 vec[0] = cosf(angle);
205 vec[1] = sinf(angle);
206}
207
208static bool but_isect_pie_seg(const Block *block, const Button *but)
209{
210 if (block->pie_data->flags & PIE_INVALID_DIR) {
211 return false;
212 }
213
214 /* Plus/minus 45 degrees: `cosf(DEG2RADF(45)) == M_SQRT1_2`. */
215 const float angle_4th_cos = M_SQRT1_2;
216 /* Plus/minus 22.5 degrees: `cosf(DEG2RADF(22.5))`. */
217 const float angle_8th_cos = 0.9238795f;
218
219 /* Use a large bias so edge-cases fall back to comparing with the adjacent direction. */
220 const float eps_bias = 1e-4;
221
222 float but_dir[2];
223 button_pie_dir(but->pie_dir, but_dir);
224
225 const float angle_but_cos = dot_v2v2(but_dir, block->pie_data->pie_dir);
226 /* Outside range (with bias). */
227 if (angle_but_cos < angle_4th_cos - eps_bias) {
228 return false;
229 }
230 /* Inside range (with bias). */
231 if (angle_but_cos > angle_8th_cos + eps_bias) {
232 return true;
233 }
234
235 /* Check if adjacent direction is closer (with tie breaker). */
236 RadialDirection dir_adjacent_8th, dir_adjacent_4th;
237 if (angle_signed_v2v2(but_dir, block->pie_data->pie_dir) < 0.0f) {
238 dir_adjacent_8th = UI_RADIAL_DIRECTION_PREV(but->pie_dir);
239 dir_adjacent_4th = UI_RADIAL_DIRECTION_PREV(dir_adjacent_8th);
240 }
241 else {
242 dir_adjacent_8th = UI_RADIAL_DIRECTION_NEXT(but->pie_dir);
243 dir_adjacent_4th = UI_RADIAL_DIRECTION_NEXT(dir_adjacent_8th);
244 }
245
246 const bool has_8th_adjacent = block->pie_data->pie_dir_mask & (1 << int(dir_adjacent_8th));
247
248 /* Compare with the adjacent direction (even if there is no button). */
249 const RadialDirection dir_adjacent = has_8th_adjacent ? dir_adjacent_8th : dir_adjacent_4th;
250 float but_dir_adjacent[2];
251 button_pie_dir(dir_adjacent, but_dir_adjacent);
252
253 const float angle_adjacent_cos = dot_v2v2(but_dir_adjacent, block->pie_data->pie_dir);
254
255 /* Tie breaker, so one of the buttons is always selected. */
256 if (angle_but_cos == angle_adjacent_cos) [[unlikely]] {
257 return but->pie_dir > dir_adjacent;
258 }
259 return angle_but_cos > angle_adjacent_cos;
260}
261
262bool button_contains_pt(const Button *but, float mx, float my)
263{
264 rctf rect = but->rect;
265 /* Add a magin to allow selecting points at the border of curves maps. */
267 BLI_rctf_pad(&rect, 4, 4);
268 }
269 return BLI_rctf_isect_pt(&rect, mx, my);
270}
271
272bool button_contains_rect(const Button *but, const rctf *rect)
273{
274 return BLI_rctf_isect(&but->rect, rect, nullptr);
275}
276
277bool button_contains_point_px(const Button *but, const ARegion *region, const int xy[2])
278{
279 Block *block = but->block;
280 if (!region_contains_point_px(region, xy)) {
281 return false;
282 }
283
284 float mx = xy[0], my = xy[1];
285 window_to_block_fl(region, block, &mx, &my);
286
287 if (but->pie_dir != UI_RADIAL_NONE) {
288 if (!but_isect_pie_seg(block, but)) {
289 return false;
290 }
291 }
292 else if (!button_contains_pt(but, mx, my)) {
293 return false;
294 }
295
296 return true;
297}
298
299bool but_contains_point_px_icon(const Button *but, ARegion *region, const wmEvent *event)
300{
301 rcti rect;
302 int x = event->xy[0], y = event->xy[1];
303
304 window_to_block(region, but->block, &x, &y);
305
306 BLI_rcti_rctf_copy(&rect, &but->rect);
307
308 if (but->dragflag & BUT_DRAG_FULL_BUT) {
309 /* use button size itself */
310 }
311 else if (but->drawflag & BUT_ICON_LEFT) {
312 rect.xmax = rect.xmin + BLI_rcti_size_y(&rect);
313 }
314 else {
315 const int delta = BLI_rcti_size_x(&rect) - BLI_rcti_size_y(&rect);
316 rect.xmin += delta / 2;
317 rect.xmax -= delta / 2;
318 }
319
320 return BLI_rcti_isect_pt(&rect, x, y);
321}
322
323static Button *but_find(const ARegion *region,
324 const ButtonFindPollFn find_poll,
325 const void *find_custom_data)
326{
327 for (Block &block : region->runtime->uiblocks) {
328 for (Button &but : block.buttons() | std::views::reverse) {
329 if (find_poll && find_poll(&but, find_custom_data) == false) {
330 continue;
331 }
332 return &but;
333 }
334 }
335
336 return nullptr;
337}
338
340 const int xy[2],
341 const bool labeledit,
342 const bool for_tooltip,
343 const ButtonFindPollFn find_poll,
344 const void *find_custom_data)
345{
346 Button *butover = nullptr;
347
348 if (!region_contains_point_px(region, xy)) {
349 return nullptr;
350 }
351 for (Block &block : region->runtime->uiblocks) {
352 float mx = xy[0], my = xy[1];
353 window_to_block_fl(region, &block, &mx, &my);
354 /* Skip when the mouse is hovering auto-scroll handlers. */
355 if ((block.flag & BLOCK_CLIPTOP && block.rect.ymax - UI_MENU_SCROLL_MOUSE < my) ||
356 (block.flag & BLOCK_CLIPBOTTOM && block.rect.ymin + UI_MENU_SCROLL_MOUSE > my))
357 {
358 continue;
359 }
360 for (Button &but : block.buttons() | std::views::reverse) {
361 if (find_poll && find_poll(&but, find_custom_data) == false) {
362 continue;
363 }
364 if (button_is_interactive_ex(&but, labeledit, for_tooltip)) {
365 if (but.pie_dir != UI_RADIAL_NONE) {
366 if (but_isect_pie_seg(&block, &but)) {
367 butover = &but;
368 break;
369 }
370 }
371 else if (button_contains_pt(&but, mx, my)) {
372 butover = &but;
373 break;
374 }
375 }
376 }
377
378 /* CLIP_EVENTS prevents the event from reaching other blocks */
379 if (block.flag & BLOCK_CLIP_EVENTS) {
380 /* check if mouse is inside block */
381 if (BLI_rctf_isect_pt(&block.rect, mx, my)) {
382 break;
383 }
384 }
385 }
386
387 return butover;
388}
389
390Button *but_find_mouse_over(const ARegion *region, const wmEvent *event)
391{
393 region, event->xy, event->modifier & KM_CTRL, false, nullptr, nullptr);
394}
395
396Button *button_find_rect_over(const ARegion *region, const rcti *rect_px)
397{
398 if (!region_contains_rect_px(region, rect_px)) {
399 return nullptr;
400 }
401
402 /* Currently no need to expose this at the moment. */
403 const bool labeledit = true;
404 rctf rect_px_fl;
405 BLI_rctf_rcti_copy(&rect_px_fl, rect_px);
406 Button *butover = nullptr;
407
408 for (Block &block : region->runtime->uiblocks) {
409 rctf rect_block;
410 window_to_block_rctf(region, &block, &rect_block, &rect_px_fl);
411
412 for (Button &but : block.buttons() | std::views::reverse) {
413 if (button_is_interactive(&but, labeledit)) {
414 /* No pie menu support. */
415 BLI_assert(but.pie_dir == UI_RADIAL_NONE);
416 if (button_contains_rect(&but, &rect_block)) {
417 butover = &but;
418 break;
419 }
420 }
421 }
422
423 /* CLIP_EVENTS prevents the event from reaching other blocks */
424 if (block.flag & BLOCK_CLIP_EVENTS) {
425 /* check if mouse is inside block */
426 if (BLI_rctf_isect(&block.rect, &rect_block, nullptr)) {
427 break;
428 }
429 }
430 }
431 return butover;
432}
433
434Button *listbox_find_mouse_over_ex(const ARegion *region, const int xy[2])
435{
436 if (!region_contains_point_px(region, xy)) {
437 return nullptr;
438 }
439 for (Block &block : region->runtime->uiblocks) {
440 float mx = xy[0], my = xy[1];
441 window_to_block_fl(region, &block, &mx, &my);
442 for (Button &but : block.buttons() | std::views::reverse) {
443 if (but.type == ButtonType::ListBox && button_contains_pt(&but, mx, my)) {
444 return &but;
445 }
446 }
447 }
448
449 return nullptr;
450}
451
452Button *listbox_find_mouse_over(const ARegion *region, const wmEvent *event)
453{
454 if (event == nullptr) {
455 /* If there is no info about the mouse, just act as if there is nothing underneath it. */
456 return nullptr;
457 }
458 return listbox_find_mouse_over_ex(region, event->xy);
459}
460
461uiList *uilist_find_mouse_over(const ARegion *region, const wmEvent *event)
462{
463 Button *list_but = listbox_find_mouse_over(region, event);
464 if (!list_but) {
465 return nullptr;
466 }
467
468 return static_cast<uiList *>(list_but->custom_data);
469}
470
471static bool listbox_contains_listrow(const Button *listbox_but, const Button *listrow_but)
472{
473 BLI_assert(listbox_but->type == ButtonType::ListBox);
474 BLI_assert(listrow_but->type == ButtonType::ListRow);
475 /* The list box and its rows have the same RNA data (active data pointer/prop). */
476 return button_rna_equals(listbox_but, listrow_but);
477}
478
479static bool but_is_listrow(const Button *but, const void * /*customdata*/)
480{
481 return but->type == ButtonType::ListRow;
482}
483
484Button *listrow_find_mouse_over(const ARegion *region, const int xy[2])
485{
486 return button_find_mouse_over_ex(region, xy, false, false, but_is_listrow, nullptr);
487}
488
493
494static bool but_is_listrow_at_index(const Button *but, const void *customdata)
495{
496 const ListRowFindIndexData *find_data = static_cast<const ListRowFindIndexData *>(customdata);
497
498 return but_is_listrow(but, nullptr) && listbox_contains_listrow(find_data->listbox, but) &&
499 (but->hardmax == find_data->index);
500}
501
502Button *listrow_find_index(const ARegion *region, const int index, Button *listbox)
503{
506 data.index = index;
507 data.listbox = listbox;
508 return but_find(region, but_is_listrow_at_index, &data);
509}
510
511static bool but_is_view_item_fn(const Button *but, const void * /*customdata*/)
512{
513 return but->type == ButtonType::ViewItem;
514}
515
516Button *view_item_find_mouse_over(const ARegion *region, const int xy[2])
517{
518 return button_find_mouse_over_ex(region, xy, false, false, but_is_view_item_fn, nullptr);
519}
520
521static bool but_is_active_view_item(const Button *but, const void *view)
522{
523 if (but->type != ButtonType::ViewItem) {
524 return false;
525 }
526
527 const auto *view_item_but = static_cast<const ButtonViewItem *>(but);
528 return (!view || &view_item_but->view_item->get_view() == view) &&
529 view_item_but->view_item->is_active();
530}
531
533{
534 return but_find(region, but_is_active_view_item, view);
535}
536
538{
539 return but_find(
540 region,
541 [](const Button *but, const void * /*find_custom_data*/) {
542 if (but->type != ButtonType::ViewItem) {
543 return false;
544 }
545
546 const auto *view_item_but = static_cast<const ButtonViewItem *>(but);
547 return view_item_but->view_item->is_search_highlight();
548 },
549 nullptr);
550}
551
553
554/* -------------------------------------------------------------------- */
557
559{
560 for (Button &button :
561 but->block->buttons() | std::views::take(but->block->but_index(but)) | std::views::reverse)
562 {
563 if (button_is_editable(&button)) {
564 return &button;
565 }
566 }
567 return nullptr;
568}
569
571{
572 for (Button &button : but->block->buttons() | std::views::drop(but->block->but_index(but) + 1)) {
573 if (button_is_editable(&button)) {
574 return &button;
575 }
576 }
577 return nullptr;
578}
579
581{
582 for (Button &but : block->buttons()) {
583 if (button_is_editable(&but)) {
584 return &but;
585 }
586 }
587 return nullptr;
588}
589
591{
592 for (Button &but : block->buttons() | std::views::reverse) {
593 if (button_is_editable(&but)) {
594 return &but;
595 }
596 }
597 return nullptr;
598}
599
601{
602 if (U.uiflag & USER_CONTINUOUS_MOUSE) {
603 if (ELEM(but->type,
611 {
612 return true;
613 }
614 }
615
616 return false;
617}
618
620{
621 return but->rnaprop && (RNA_property_subtype(but->rnaprop) == PROP_PASSWORD);
622}
623
625
626/* -------------------------------------------------------------------- */
629
631{
632 if (but->flag & BUT_HAS_SEP_CHAR) {
633 const size_t sep_index = but->drawstr.find(UI_SEP_CHAR);
634 if (sep_index != std::string::npos) {
635 return sep_index;
636 }
637 }
638 return but->drawstr.size();
639}
640
642{
643 size_t str_len_clip = button_drawstr_len_without_sep_char(but);
644 return StringRef(but->drawstr).substr(0, str_len_clip);
645}
646
648{
649 if (but->tip == nullptr) {
650 return 0;
651 }
652 const int64_t str_step = but->tip.find('\n');
653 if (str_step == StringRef::not_found) {
654 return but->tip.size();
655 }
656 return str_step;
657}
658
660
661/* -------------------------------------------------------------------- */
664
666{
667 for (Button &but : block->buttons()) {
668 if (but.active) {
669 return &but;
670 }
671 }
672
673 return nullptr;
674}
675
676bool block_is_menu(const Block *block)
677{
678 return (((block->flag & BLOCK_LOOP) != 0) &&
679 /* non-menu popups use keep-open, so check this is off */
680 ((block->flag & BLOCK_KEEP_OPEN) == 0));
681}
682
683bool block_is_popover(const Block *block)
684{
685 return (block->flag & BLOCK_POPOVER) != 0;
686}
687
688bool block_is_pie_menu(const Block *block)
689{
690 return ((block->flag & BLOCK_PIE_MENU) != 0);
691}
692
693bool block_is_popup_any(const Block *block)
694{
695 return (block_is_menu(block) || block_is_popover(block) || block_is_pie_menu(block) ||
696 (block->flag & BLOCK_POPUP));
697}
698
699static const Button *but_next_non_separator(const Button *but)
700{
701 if (!but) {
702 return nullptr;
703 }
704 for (Button &button : but->block->buttons() | std::views::drop(but->block->but_index(but) + 1)) {
705 if (!ELEM(button.type, ButtonType::Sepr, ButtonType::SeprLine)) {
706 return &button;
707 }
708 }
709 return nullptr;
710}
711
712bool block_is_empty_ex(const Block *block, const bool skip_title)
713{
714 const Button *but = block->first_but();
715 if (skip_title) {
716 /* Skip the first label, since popups often have a title,
717 * we may want to consider the block empty in this case. */
718 but = but_next_non_separator(but);
719 if (but && but->type == ButtonType::Label) {
720 but = block->next_but(but);
721 }
722 }
723 return (but_next_non_separator(but) == nullptr);
724}
725
726bool block_is_empty(const Block *block)
727{
728 return block_is_empty_ex(block, false);
729}
730
732{
733 if (block_is_menu(block) && !block_is_pie_menu(block)) {
734 const Button *but = block->last_but();
735 return (but && !ELEM(but->type, ButtonType::SeprLine, ButtonType::Sepr));
736 }
737 return true;
738}
739
741{
742 for (const Button &but : block->buttons()) {
743 if ((but.flag & BUT_ACTIVE_DEFAULT) && ((but.flag & UI_HIDDEN) == 0)) {
744 return &but;
745 }
746 }
747 return nullptr;
748}
749
751{
752 return block_active_default_button_find(block) != nullptr;
753}
754
756
757/* -------------------------------------------------------------------- */
760
761Block *block_find_mouse_over_ex(const ARegion *region, const int xy[2], bool only_clip)
762{
763 if (!region_contains_point_px(region, xy)) {
764 return nullptr;
765 }
766 for (Block &block : region->runtime->uiblocks) {
767 if (only_clip) {
768 if ((block.flag & BLOCK_CLIP_EVENTS) == 0) {
769 continue;
770 }
771 }
772 float mx = xy[0], my = xy[1];
773 window_to_block_fl(region, &block, &mx, &my);
774 if (BLI_rctf_isect_pt(&block.rect, mx, my)) {
775 return &block;
776 }
777 }
778 return nullptr;
779}
780
781Block *block_find_mouse_over(const ARegion *region, const wmEvent *event, bool only_clip)
782{
783 return block_find_mouse_over_ex(region, event->xy, only_clip);
784}
785
787
788/* -------------------------------------------------------------------- */
791
793{
794 for (Block &block : region->runtime->uiblocks) {
795 Button *but = block_active_but_get(&block);
796 if (but) {
797 return but;
798 }
799 }
800
801 return nullptr;
802}
803
805 int64_t flag_include,
806 int64_t flag_exclude)
807{
808 for (Block &block : region->runtime->uiblocks) {
809 for (Button &but : block.buttons()) {
810 if (((but.flag & flag_include) == flag_include) && ((but.flag & flag_exclude) == 0)) {
811 return &but;
812 }
813 }
814 }
815
816 return nullptr;
817}
818
820
821/* -------------------------------------------------------------------- */
824
825bool region_contains_point_px(const ARegion *region, const int xy[2])
826{
827 rcti winrct;
828 region_winrct_get_no_margin(region, &winrct);
829 if (!BLI_rcti_isect_pt_v(&winrct, xy)) {
830 return false;
831 }
832
833 /* also, check that with view2d, that the mouse is not over the scroll-bars
834 * NOTE: care is needed here, since the mask rect may include the scroll-bars
835 * even when they are not visible, so we need to make a copy of the mask to
836 * use to check
837 */
838 if (region->v2d.mask.xmin != region->v2d.mask.xmax) {
839 const View2D *v2d = &region->v2d;
840 int mx = xy[0], my = xy[1];
841
842 window_to_region(region, &mx, &my);
843 if (!BLI_rcti_isect_pt(&v2d->mask, mx, my) ||
844 view2d_mouse_in_scrollers(region, &region->v2d, xy))
845 {
846 return false;
847 }
848 }
849
850 return true;
851}
852
853bool region_contains_rect_px(const ARegion *region, const rcti *rect_px)
854{
855 rcti winrct;
856 region_winrct_get_no_margin(region, &winrct);
857 if (!BLI_rcti_isect(&winrct, rect_px, nullptr)) {
858 return false;
859 }
860
861 /* See comment in 'region_contains_point_px' */
862 if (region->v2d.mask.xmin != region->v2d.mask.xmax) {
863 const View2D *v2d = &region->v2d;
864 rcti rect_region;
865 window_to_region_rcti(region, &rect_region, rect_px);
866 if (!BLI_rcti_isect(&v2d->mask, &rect_region, nullptr) ||
867 view2d_rect_in_scrollers(region, &region->v2d, rect_px))
868 {
869 return false;
870 }
871 }
872
873 return true;
874}
875
877
878/* -------------------------------------------------------------------- */
881
883{
884 for (ARegion &region : screen->regionbase) {
885 rcti winrct;
886
887 region_winrct_get_no_margin(&region, &winrct);
888
889 if (BLI_rcti_isect_pt_v(&winrct, xy)) {
890 return &region;
891 }
892 }
893 return nullptr;
894}
895
897{
898 return screen_region_find_mouse_over_ex(screen, event->xy);
899}
900
902
903/* -------------------------------------------------------------------- */
906
911
913
914bool button_opens_link(const Button *button)
915{
916 return button->optype && button->opptr &&
917 STR_ELEM(button->optype->idname, "WM_OT_url_open", "WM_OT_url_open_preset");
918}
919
920} // namespace blender::ui
#define DEG2RADF(_deg)
#define M_SQRT1_2
#define STR_ELEM(...)
#define UI_SEP_CHAR
#define ELEM(...)
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
Definition btVector3.h:356
constexpr StringRef()
static constexpr int64_t not_found
constexpr int64_t size() const
constexpr int64_t find(char c, int64_t pos=0) const
#define UI_RADIAL_DIRECTION_NEXT(dir)
#define UI_RADIAL_DIRECTION_PREV(dir)
#define UI_MENU_SCROLL_MOUSE
size_t button_drawstr_len_without_sep_char(const Button *but)
bool region_contains_rect_px(const ARegion *region, const rcti *rect_px)
Button * block_active_but_get(const Block *block)
Block Block * block_find_mouse_over(const ARegion *region, const wmEvent *event, bool only_clip)
Button * button_prev(Button *but) ATTR_WARN_UNUSED_RESULT
int button_icon(const Button *but)
bool but_contains_point_px_icon(const Button *but, ARegion *region, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
bool icon_is_preview_deferred_loading(const int icon_id, const bool big)
bool button_contains_pt(const Button *but, float mx, float my) ATTR_WARN_UNUSED_RESULT
bool but_contains_password(const Button *but) ATTR_WARN_UNUSED_RESULT
bool button_rna_equals(const Button *a, const Button *b)
Definition interface.cc:790
bool button_is_interactive_ex(const Button *but, const bool labeledit, const bool for_tooltip)
void window_to_block_rctf(const ARegion *region, const Block *block, rctf *rct_dst, const rctf *rct_src)
Definition interface.cc:220
Button * view_item_find_mouse_over(const ARegion *region, const int xy[2]) ATTR_NONNULL(1
static bool but_is_active_view_item(const Button *but, const void *view)
Button * view_item_find_search_highlight(const ARegion *region)
Button * listbox_find_mouse_over_ex(const ARegion *region, const int xy[2]) ATTR_NONNULL(1
bool but_has_quick_tooltip(const Button *but)
bool region_contains_point_px(const ARegion *region, const int xy[2]) ATTR_NONNULL(1
bool button_is_toggle(const Button *but) ATTR_WARN_UNUSED_RESULT
bool button_contains_rect(const Button *but, const rctf *rect)
bool button_is_cursor_warp(const Button *but) ATTR_WARN_UNUSED_RESULT
ARegion * screen_region_find_mouse_over_ex(bScreen *screen, const int xy[2]) ATTR_NONNULL(1
void button_pie_dir(RadialDirection dir, float vec[2])
Button * but_find_mouse_over(const ARegion *region, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
uiList * uilist_find_mouse_over(const ARegion *region, const wmEvent *event)
Button * region_find_first_but_test_flag(ARegion *region, int64_t flag_include, int64_t flag_exclude)
void window_to_block(const ARegion *region, const Block *block, int *x, int *y)
Definition interface.cc:230
static const Button * but_next_non_separator(const Button *but)
bool block_can_add_separator(const Block *block)
char char view2d_mouse_in_scrollers(const ARegion *region, const View2D *v2d, const int xy[2]) ATTR_NONNULL(1
Definition view2d.cc:2044
Button * region_find_active_but(ARegion *region) ATTR_WARN_UNUSED_RESULT
size_t button_tip_len_only_first_line(const Button *but)
bool block_is_menu(const Block *block) ATTR_WARN_UNUSED_RESULT
void interface_tag_script_reload_queries()
bool but_is_utf8(const Button *but)
static bool but_is_listrow_at_index(const Button *but, const void *customdata)
static bool but_is_listrow(const Button *but, const void *)
static wmOperatorType * g_ot_tool_set_by_id
bool block_has_active_default_button(const Block *block)
Button * button_find_mouse_over_ex(const ARegion *region, const int xy[2], bool labeledit, bool for_tooltip, const ButtonFindPollFn find_poll, const void *find_custom_data) ATTR_NONNULL(1
ARegion ARegion * screen_region_find_mouse_over(bScreen *screen, const wmEvent *event)
static bool but_isect_pie_seg(const Block *block, const Button *but)
bool block_is_popover(const Block *block) ATTR_WARN_UNUSED_RESULT
bool(*)(const Button *but, const void *customdata) ButtonFindPollFn
void window_to_region(const ARegion *region, int *x, int *y)
Definition interface.cc:241
Button Button * view_item_find_active(const ARegion *region, const AbstractView *view=nullptr)
Button * listrow_find_index(const ARegion *region, int index, Button *listbox) ATTR_WARN_UNUSED_RESULT
Button * listrow_find_mouse_over(const ARegion *region, const int xy[2]) ATTR_NONNULL(1
void region_winrct_get_no_margin(const ARegion *region, rcti *r_rect)
Definition interface.cc:390
bool block_is_pie_menu(const Block *block) ATTR_WARN_UNUSED_RESULT
bool button_is_editable(const Button *but) ATTR_WARN_UNUSED_RESULT
Button * button_first(Block *block) ATTR_WARN_UNUSED_RESULT
static bool but_is_view_item_fn(const Button *but, const void *)
void window_to_region_rcti(const ARegion *region, rcti *rect_dst, const rcti *rct_src)
Definition interface.cc:247
bool block_is_empty_ex(const Block *block, bool skip_title)
static bool listbox_contains_listrow(const Button *listbox_but, const Button *listrow_but)
bool button_has_array_value(const Button *but) ATTR_WARN_UNUSED_RESULT
bool button_is_interactive(const Button *but, bool labeledit) ATTR_WARN_UNUSED_RESULT
bool button_drag_is_draggable(const Button *but)
Button * button_last(Block *block) ATTR_WARN_UNUSED_RESULT
static Button * but_find(const ARegion *region, const ButtonFindPollFn find_poll, const void *find_custom_data)
bool button_opens_link(const Button *button)
bool block_is_empty(const Block *block)
Button * listbox_find_mouse_over(const ARegion *region, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
Button * button_find_rect_over(const ARegion *region, const rcti *rect_px) ATTR_WARN_UNUSED_RESULT
bool button_contains_point_px(const Button *but, const ARegion *region, const int xy[2]) ATTR_NONNULL(1
bool button_is_editable_as_text(const Button *but) ATTR_WARN_UNUSED_RESULT
bool button_is_popover_once_compat(const Button *but) ATTR_WARN_UNUSED_RESULT
void window_to_block_fl(const ARegion *region, const Block *block, float *x, float *y)
Definition interface.cc:193
char char char char view2d_rect_in_scrollers(const ARegion *region, const View2D *v2d, const rcti *rect) ATTR_NONNULL(1
Definition view2d.cc:2050
const short radial_dir_to_angle[8]
bool block_is_popup_any(const Block *block) ATTR_WARN_UNUSED_RESULT
StringRef button_drawstr_without_sep_char(const Button *but) ATTR_NONNULL()
const Button * block_active_default_button_find(const Block *block)
bool but_is_tool(const Button *but)
Button * button_next(Button *but) ATTR_WARN_UNUSED_RESULT
Block * block_find_mouse_over_ex(const ARegion *region, const int xy[2], bool only_clip) ATTR_NONNULL(1
UserDef U
Definition blender.cc:58
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
__int64 int64_t
Definition BKE_text.h:90
bool BLI_rcti_isect(const struct rcti *src1, const struct rcti *src2, struct rcti *dest)
void BLI_rcti_rctf_copy(struct rcti *dst, const struct rctf *src)
float angle_signed_v2v2(const float v1[2], const float v2[2]) ATTR_WARN_UNUSED_RESULT
bool RNA_property_string_is_utf8(PropertyRNA *prop)
void BLI_rctf_rcti_copy(struct rctf *dst, const struct rcti *src)
bool RNA_property_array_check(PropertyRNA *prop)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition BLI_rect.hh:207
BMesh const char void * data
bool BLI_rctf_isect_pt(const struct rctf *rect, float x, float y)
MINLINE float dot_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition BLI_rect.hh:203
PropertySubType RNA_property_subtype(PropertyRNA *prop)
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
bool BLI_rctf_isect(const struct rctf *src1, const struct rctf *src2, struct rctf *dest)
bool BLI_rcti_isect_pt_v(const struct rcti *rect, const int xy[2])
bool BLI_rcti_isect_pt(const struct rcti *rect, int x, int y)
@ PROP_PASSWORD
Definition RNA_types.hh:298
void BLI_rctf_pad(struct rctf *rect, float pad_x, float pad_y)
Definition rct.cc:651
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
#define sinf
#define cosf
bke::ARegionRuntime * runtime
ListBaseT< ARegion > regionbase
ListBaseT< ui::Block > uiblocks
Button * last_but() const
Definition interface.cc:311
int but_index(const Button *but) const
Definition interface.cc:276
Button * first_but() const
Definition interface.cc:306
std::ranges::transform_view< std::ranges::ref_view< const Vector< std::unique_ptr< Button > > >, Button &(*)(const std::unique_ptr< Button > &)> buttons() const
Button * next_but(const Button *but) const
Definition interface.cc:288
std::unique_ptr< PieMenuData > pie_data
ButtonToolTipCustomFunc tip_custom_func
ButtonToolTipFunc tip_func
std::function< std::string(const Button *)> tip_quick_func
RadialDirection pie_dir
wmOperatorType * optype
wmEventModifierFlag modifier
Definition WM_types.hh:834