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:
-rw-r--r--source/blender/editors/include/UI_interface.h2
-rw-r--r--source/blender/editors/interface/interface.c9
-rw-r--r--source/blender/editors/interface/interface_handlers.c8
-rw-r--r--source/blender/editors/space_node/drawnode.c10
-rw-r--r--source/blender/editors/space_node/node_draw.c40
5 files changed, 52 insertions, 17 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 458fe175fbb..ec6958c8415 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -115,6 +115,7 @@ typedef struct uiLayout uiLayout;
#define UI_BLOCK_OUT_1 1024
#define UI_BLOCK_NO_FLIP 2048
#define UI_BLOCK_POPUP_MEMORY 4096
+#define UI_BLOCK_CLIP_EVENTS 8192 /* stop handling mouse events */
/* uiPopupBlockHandle->menuretval */
#define UI_RETURN_CANCEL 1 /* cancel all menus cascading */
@@ -364,6 +365,7 @@ void uiTextBoundsBlock(uiBlock *block, int addval);
void uiPopupBoundsBlock(uiBlock *block, int addval, int mx, int my);
void uiMenuPopupBoundsBlock(uiBlock *block, int addvall, int mx, int my);
void uiCenteredBoundsBlock(uiBlock *block, int addval);
+void uiExplicitBoundsBlock(uiBlock *block, int minx, int miny, int maxx, int maxy);
int uiBlocksGetYMin (struct ListBase *lb);
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 4b7adbc1064..86961cd84dc 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -434,6 +434,15 @@ void uiCenteredBoundsBlock(uiBlock *block, int addval)
block->dobounds= UI_BLOCK_BOUNDS_POPUP_CENTER;
}
+void uiExplicitBoundsBlock(uiBlock *block, int minx, int miny, int maxx, int maxy)
+{
+ block->minx = minx;
+ block->miny = miny;
+ block->maxx = maxx;
+ block->maxy = maxy;
+ block->dobounds = 0;
+}
+
/* ************** LINK LINE DRAWING ************* */
/* link line drawing is not part of buttons or theme.. so we stick with it here */
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 688e8f95ac7..1ba6acf367a 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -5063,6 +5063,14 @@ static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y)
if(ui_but_contains_pt(but, mx, my))
butover= but;
}
+
+ /* CLIP_EVENTS prevents the event from reaching other blocks */
+ if (block->flag & UI_BLOCK_CLIP_EVENTS) {
+ /* check if mouse is inside block */
+ if(block->minx <= mx && block->maxx >= mx &&
+ block->miny <= my && block->maxy >= my)
+ break;
+ }
}
return butover;
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 29f67844827..4e9ac08d8c8 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -471,6 +471,7 @@ static void node_update_group(const bContext *C, bNodeTree *ntree, bNode *gnode)
float locx, locy;
rctf *rect= &gnode->totr;
float node_group_frame= U.dpi*NODE_GROUP_FRAME/72;
+ float group_header= 26*U.dpi/72;
int counter;
int dy;
@@ -594,6 +595,15 @@ static void node_update_group(const bContext *C, bNodeTree *ntree, bNode *gnode)
gsock = gsock->next;
}
}
+
+ /* Set the block bounds to clip mouse events from underlying nodes.
+ * Add margin for header and input/output columns.
+ */
+ uiExplicitBoundsBlock(gnode->block,
+ rect->xmin - node_group_frame,
+ rect->ymin,
+ rect->xmax + node_group_frame,
+ rect->ymax + group_header);
}
}
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index c4a7f2cb473..024db35a084 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -197,28 +197,16 @@ static void node_uiblocks_init(const bContext *C, bNodeTree *ntree)
bNode *node;
char str[32];
- /* add node uiBlocks in reverse order - prevents events going to overlapping nodes */
+ /* add node uiBlocks in drawing order - prevents events going to overlapping nodes */
- /* process selected nodes first so they're at the start of the uiblocks list */
- for(node= ntree->nodes.last; node; node= node->prev) {
-
- if (node->flag & NODE_SELECT) {
+ for(node= ntree->nodes.first; node; node=node->next) {
/* ui block */
sprintf(str, "node buttons %p", (void *)node);
node->block= uiBeginBlock(C, CTX_wm_region(C), str, UI_EMBOSS);
uiBlockSetHandleFunc(node->block, do_node_internal_buttons, node);
- }
- }
-
- /* then the rest */
- for(node= ntree->nodes.last; node; node= node->prev) {
-
- if (!(node->flag & (NODE_GROUP_EDIT|NODE_SELECT))) {
- /* ui block */
- sprintf(str, "node buttons %p", (void *)node);
- node->block= uiBeginBlock(C, CTX_wm_region(C), str, UI_EMBOSS);
- uiBlockSetHandleFunc(node->block, do_node_internal_buttons, node);
- }
+
+ /* this cancels events for background nodes */
+ uiBlockSetFlag(node->block, UI_BLOCK_CLIP_EVENTS);
}
}
@@ -339,6 +327,15 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
node->totr.xmax= locx + node->width;
node->totr.ymax= locy;
node->totr.ymin= MIN2(dy, locy-2*NODE_DY);
+
+ /* Set the block bounds to clip mouse events from underlying nodes.
+ * Add a margin for sockets on each side.
+ */
+ uiExplicitBoundsBlock(node->block,
+ node->totr.xmin - NODE_SOCKSIZE,
+ node->totr.ymin,
+ node->totr.xmax + NODE_SOCKSIZE,
+ node->totr.ymax);
}
/* based on settings in node, sets drawing rect info. each redraw! */
@@ -391,6 +388,15 @@ static void node_update_hidden(bNode *node)
rad+= drad;
}
}
+
+ /* Set the block bounds to clip mouse events from underlying nodes.
+ * Add a margin for sockets on each side.
+ */
+ uiExplicitBoundsBlock(node->block,
+ node->totr.xmin - NODE_SOCKSIZE,
+ node->totr.ymin,
+ node->totr.xmax + NODE_SOCKSIZE,
+ node->totr.ymax);
}
void node_update_default(const bContext *C, bNodeTree *ntree, bNode *node)