diff options
Diffstat (limited to 'source/blender/editors/space_node/node_select.c')
-rw-r--r-- | source/blender/editors/space_node/node_select.c | 93 |
1 files changed, 81 insertions, 12 deletions
diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index b690059fc12..ec08cdf07ac 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -32,9 +32,6 @@ #include "DNA_scene_types.h" #include "BKE_context.h" -#include "BKE_node.h" -#include "BKE_global.h" -#include "BKE_utildefines.h" #include "BLI_rect.h" @@ -112,9 +109,6 @@ static int node_select_exec(bContext *C, wmOperator *op) /* perform the select */ node= node_mouse_select(snode, ar, mval, extend); - /* need refresh/a notifier vs compo notifier */ - WM_event_add_notifier(C, NC_SCENE|ND_NODES, NULL); /* Do we need to pass the scene? */ - /* WATCH THIS, there are a few other ways to change the active material */ if(node) { if (node->id && ELEM(GS(node->id->name), ID_MA, ID_TE)) { @@ -123,7 +117,7 @@ static int node_select_exec(bContext *C, wmOperator *op) } /* send notifiers */ - WM_event_add_notifier(C, NC_NODE|ND_NODE_SELECT, NULL); + WM_event_add_notifier(C, NC_NODE|NA_SELECTED, NULL); /* allow tweak event to work too */ return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH; @@ -191,7 +185,7 @@ static int node_borderselect_exec(bContext *C, wmOperator *op) } } - WM_event_add_notifier(C, NC_SCENE|ND_NODES, NULL); /* Do we need to pass the scene? */ + WM_event_add_notifier(C, NC_NODE|NA_SELECTED, NULL); return OPERATOR_FINISHED; } @@ -267,14 +261,14 @@ static int node_select_all_exec(bContext *C, wmOperator *op) node->flag |= NODE_SELECT; } - WM_event_add_notifier(C, NC_SCENE|ND_NODES, NULL); + WM_event_add_notifier(C, NC_NODE|NA_SELECTED, NULL); return OPERATOR_FINISHED; } void NODE_OT_select_all(wmOperatorType *ot) { /* identifiers */ - ot->name = "Select/Deselect All"; + ot->name = "Select or Deselect All"; ot->description = "(De)select all nodes"; ot->idname = "NODE_OT_select_all"; @@ -307,7 +301,7 @@ static int node_select_linked_to_exec(bContext *C, wmOperator *op) node->flag |= NODE_SELECT; } - WM_event_add_notifier(C, NC_SCENE|ND_NODES, NULL); + WM_event_add_notifier(C, NC_NODE|NA_SELECTED, NULL); return OPERATOR_FINISHED; } @@ -347,7 +341,7 @@ static int node_select_linked_from_exec(bContext *C, wmOperator *op) node->flag |= NODE_SELECT; } - WM_event_add_notifier(C, NC_SCENE|ND_NODES, NULL); + WM_event_add_notifier(C, NC_NODE|NA_SELECTED, NULL); return OPERATOR_FINISHED; } @@ -366,3 +360,78 @@ void NODE_OT_select_linked_from(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; } +/* ****** Select Same Type ****** */ + +static int node_select_same_type_exec(bContext *C, wmOperator *op) +{ + SpaceNode *snode = CTX_wm_space_node(C); + + node_select_same_type(snode); + WM_event_add_notifier(C, NC_NODE|NA_SELECTED, NULL); + return OPERATOR_FINISHED; +} + +void NODE_OT_select_same_type(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Select Same Type"; + ot->description = "Select all the same type"; + ot->idname = "NODE_OT_select_same_type"; + + /* api callbacks */ + ot->exec = node_select_same_type_exec; + ot->poll = ED_operator_node_active; + + /* flags */ + ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; +} + +/* ****** Select The Next/Prev Node Of The Same Type ****** */ + +static int node_select_same_type_next_exec(bContext *C, wmOperator *op) +{ + SpaceNode *snode = CTX_wm_space_node(C); + + node_select_same_type_np(snode, 0); + WM_event_add_notifier(C, NC_NODE|NA_SELECTED, NULL); + return OPERATOR_FINISHED; +} + +void NODE_OT_select_same_type_next(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Select Same Type Next"; + ot->description = "Select the next node of the same type."; + ot->idname = "NODE_OT_select_same_type_next"; + + /* api callbacks */ + ot->exec = node_select_same_type_next_exec; + ot->poll = ED_operator_node_active; + + /* flags */ + ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; +} + +static int node_select_same_type_prev_exec(bContext *C, wmOperator *op) +{ + SpaceNode *snode = CTX_wm_space_node(C); + + node_select_same_type_np(snode, 1); + WM_event_add_notifier(C, NC_NODE|NA_SELECTED, NULL); + return OPERATOR_FINISHED; +} + +void NODE_OT_select_same_type_prev(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Select Same Type Prev"; + ot->description = "Select the prev node of the same type."; + ot->idname = "NODE_OT_select_same_type_prev"; + + /* api callbacks */ + ot->exec = node_select_same_type_prev_exec; + ot->poll = ED_operator_node_active; + + /* flags */ + ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; +} |