diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-03-12 17:19:22 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-03-12 17:29:06 +0300 |
commit | 5929dd7129f6e8d41a79a5e01dd8b18f5369d1a8 (patch) | |
tree | d8787b4e4ef02d48a585fa96241f069bd034da1b /source/blender/editors/interface/interface_query.c | |
parent | 85ea7dfc546932dcd804417231824d2e8b842b27 (diff) |
Fix T73212: Gizmo's are still interactive when behind nodes
Diffstat (limited to 'source/blender/editors/interface/interface_query.c')
-rw-r--r-- | source/blender/editors/interface/interface_query.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_query.c b/source/blender/editors/interface/interface_query.c index 03434b12ddb..52488027662 100644 --- a/source/blender/editors/interface/interface_query.c +++ b/source/blender/editors/interface/interface_query.c @@ -505,6 +505,40 @@ bool UI_block_can_add_separator(const uiBlock *block) /** \} */ /* -------------------------------------------------------------------- */ +/** \name Block (#uiBlock) Spatial + * \{ */ + +uiBlock *ui_block_find_mouse_over_ex(const ARegion *region, + const int x, + const int y, + bool only_clip) +{ + if (!ui_region_contains_point_px(region, x, y)) { + return NULL; + } + for (uiBlock *block = region->uiblocks.first; block; block = block->next) { + if (only_clip) { + if ((block->flag & UI_BLOCK_CLIP_EVENTS) == 0) { + continue; + } + } + float mx = x, my = y; + ui_window_to_block_fl(region, block, &mx, &my); + if (BLI_rctf_isect_pt(&block->rect, mx, my)) { + return block; + } + } + return NULL; +} + +uiBlock *ui_block_find_mouse_over(const ARegion *region, const wmEvent *event, bool only_clip) +{ + return ui_block_find_mouse_over_ex(region, event->x, event->y, only_clip); +} + +/** \} */ + +/* -------------------------------------------------------------------- */ /** \name Region (#ARegion) State * \{ */ |