Fix T73212: Gizmo's are still interactive when behind nodes

This commit is contained in:
2020-03-13 01:19:22 +11:00
parent 85ea7dfc54
commit 5929dd7129
7 changed files with 67 additions and 0 deletions

View File

@@ -8268,6 +8268,13 @@ uiBut *UI_region_but_find_rect_over(const ARegion *region, const rcti *rect_px)
return ui_but_find_rect_over(region, rect_px);
}
uiBlock *UI_region_block_find_mouse_over(const struct ARegion *region,
const int xy[2],
bool only_clip)
{
return ui_block_find_mouse_over_ex(region, xy[0], xy[1], only_clip);
}
/**
* Version of #UI_context_active_but_get that also returns RNA property info.
* Helper function for insert keyframe, reset to default, etc operators.

View File

@@ -951,6 +951,14 @@ bool ui_block_is_popover(const uiBlock *block) ATTR_WARN_UNUSED_RESULT;
bool ui_block_is_pie_menu(const uiBlock *block) ATTR_WARN_UNUSED_RESULT;
bool ui_block_is_popup_any(const uiBlock *block) ATTR_WARN_UNUSED_RESULT;
uiBlock *ui_block_find_mouse_over_ex(const struct ARegion *region,
const int x,
const int y,
bool only_clip);
uiBlock *ui_block_find_mouse_over(const struct ARegion *region,
const struct wmEvent *event,
bool only_clip);
uiBut *ui_region_find_first_but_test_flag(struct ARegion *region,
int flag_include,
int flag_exclude);

View File

@@ -504,6 +504,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
* \{ */