Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-03-12 17:19:22 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-03-12 17:29:06 +0300
commit5929dd7129f6e8d41a79a5e01dd8b18f5369d1a8 (patch)
treed8787b4e4ef02d48a585fa96241f069bd034da1b /source/blender/editors
parent85ea7dfc546932dcd804417231824d2e8b842b27 (diff)
Fix T73212: Gizmo's are still interactive when behind nodes
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/include/UI_interface.h3
-rw-r--r--source/blender/editors/interface/interface_handlers.c7
-rw-r--r--source/blender/editors/interface/interface_intern.h8
-rw-r--r--source/blender/editors/interface/interface_query.c34
-rw-r--r--source/blender/editors/space_node/space_node.c1
5 files changed, 53 insertions, 0 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 277f330ad50..dba95c5106e 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -2382,6 +2382,9 @@ struct ID *UI_context_active_but_get_tab_ID(struct bContext *C);
uiBut *UI_region_active_but_get(struct ARegion *region);
uiBut *UI_region_but_find_rect_over(const struct ARegion *region, const struct rcti *isect);
+uiBlock *UI_region_block_find_mouse_over(const struct ARegion *region,
+ const int xy[2],
+ bool only_clip);
/* uiFontStyle.align */
typedef enum eFontStyle_Align {
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 6da9bacd865..833631f871d 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -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.
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 24977848ae4..a2e239884a3 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -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);
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
* \{ */
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index d3c7374e782..951c26b69e0 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -981,6 +981,7 @@ void ED_spacetype_node(void)
art->listener = node_region_listener;
art->cursor = node_cursor;
art->event_cursor = true;
+ art->clip_gizmo_events_by_ui = true;
BLI_addhead(&st->regiontypes, art);