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:
authorLukas Toenne <lukas.toenne@googlemail.com>2012-06-01 16:38:03 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2012-06-01 16:38:03 +0400
commit17935168c07937f9b1d1db1874a9f7ba5d3ae540 (patch)
treef3240b63a6eb251254435878727091fe923002e7 /source/blender/editors/space_node/node_select.c
parent5fbeda7efd62e251dac2af881de9fe042f30a7a7 (diff)
Reroute nodes, by Jeroen Bakker (patch #28443).
By holding shift and "cutting" a node link a new reroute helper node can be inserted. This consists of a single socket that can be used to insert additional connection points into a link. This can be used to keep a connection point in the tree when deleting a node, or to control the path of long connections for layout cleanup.
Diffstat (limited to 'source/blender/editors/space_node/node_select.c')
-rw-r--r--source/blender/editors/space_node/node_select.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c
index 9098c8a4255..0a3678ca901 100644
--- a/source/blender/editors/space_node/node_select.c
+++ b/source/blender/editors/space_node/node_select.c
@@ -38,6 +38,7 @@
#include "BKE_context.h"
#include "BKE_main.h"
+#include "BKE_node.h"
#include "BLI_rect.h"
#include "BLI_utildefines.h"
@@ -58,14 +59,28 @@
/* ****** helpers ****** */
-static bNode *node_under_mouse(bNodeTree *ntree, int mx, int my)
+static bNode *node_under_mouse_select(bNodeTree *ntree, int mx, int my)
{
bNode *node;
for (node=ntree->nodes.last; node; node=node->prev) {
- /* node body (header and scale are in other operators) */
- if (BLI_in_rctf(&node->totr, mx, my))
- return node;
+ if (node->typeinfo->select_area_func) {
+ if (node->typeinfo->select_area_func(node, mx, my))
+ return node;
+ }
+ }
+ return NULL;
+}
+
+static bNode *node_under_mouse_tweak(bNodeTree *ntree, int mx, int my)
+{
+ bNode *node;
+
+ for(node=ntree->nodes.last; node; node=node->prev) {
+ if (node->typeinfo->tweak_area_func) {
+ if (node->typeinfo->tweak_area_func(node, mx, my))
+ return node;
+ }
}
return NULL;
}
@@ -350,7 +365,7 @@ static int node_mouse_select(Main *bmain, SpaceNode *snode, ARegion *ar, const i
}
else {
/* find the closest visible node */
- node = node_under_mouse(snode->edittree, mx, my);
+ node = node_under_mouse_select(snode->edittree, mx, my);
if (node) {
node_toggle(node);
@@ -363,7 +378,7 @@ static int node_mouse_select(Main *bmain, SpaceNode *snode, ARegion *ar, const i
else { /* extend==0 */
/* find the closest visible node */
- node = node_under_mouse(snode->edittree, mx, my);
+ node = node_under_mouse_select(snode->edittree, mx, my);
if (node) {
for (tnode=snode->edittree->nodes.first; tnode; tnode=tnode->next)
@@ -490,7 +505,7 @@ static int node_border_select_invoke(bContext *C, wmOperator *op, wmEvent *event
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &mx, &my);
- if (node_under_mouse(snode->edittree, mx, my))
+ if (node_under_mouse_tweak(snode->edittree, mx, my))
return OPERATOR_CANCELLED|OPERATOR_PASS_THROUGH;
}