Node Editor
authorTon Roosendaal <ton@blender.org>
Wed, 27 Mar 2013 18:28:25 +0000 (18:28 +0000)
committerTon Roosendaal <ton@blender.org>
Wed, 27 Mar 2013 18:28:25 +0000 (18:28 +0000)
To complete previous commit:

New "Activate same type next/prev" operator - replaces the two not working previous ones.
This selects/activates and views the next or previous node of same type.

Shortcuts: Shift ] and Shift [

release/scripts/startup/bl_ui/space_node.py
source/blender/editors/space_node/node_intern.h
source/blender/editors/space_node/node_ops.c
source/blender/editors/space_node/node_select.c

index e739c5ea5d486834298a82cc15cec5d7b1224878..6e92b55f88c38748736e9cc134a177ba663a39ba 100644 (file)
@@ -152,8 +152,8 @@ class NODE_MT_select(Menu):
         layout.operator("node.select_linked_from")
         layout.operator("node.select_linked_to")
         layout.operator("node.select_same_type")
-        layout.operator("node.select_same_type_next")
-        layout.operator("node.select_same_type_prev")
+        layout.operator("node.select_same_type_step").prev = True
+        layout.operator("node.select_same_type_step").prev = False
 
 
 class NODE_MT_node(Menu):
index 6354c467bb1ae891301906552a584223d8d3f205..7e4397a6cb0c375ce1bb415129091a5e538cb4a5 100644 (file)
@@ -121,9 +121,7 @@ void NODE_OT_select_linked_from(struct wmOperatorType *ot);
 void NODE_OT_select_border(struct wmOperatorType *ot);
 void NODE_OT_select_lasso(struct wmOperatorType *ot);
 void NODE_OT_select_same_type(struct wmOperatorType *ot);
-void NODE_OT_select_same_type_next(struct wmOperatorType *ot);
-void NODE_OT_select_same_type_prev(struct wmOperatorType *ot);
-void NODE_OT_activate_connected(struct wmOperatorType *ot);
+void NODE_OT_select_same_type_step(struct wmOperatorType *ot);
 
 /* node_view.c */
 int space_node_view_flag(struct bContext *C, SpaceNode *snode, ARegion *ar, const int node_flag);
index 0c8cd63f1bf2a09b6df22402cbb8b6c21bb69f70..4d229c6fe18f8702610642995da4748e39fe12d9 100644 (file)
@@ -58,9 +58,7 @@ void node_operatortypes(void)
        WM_operatortype_append(NODE_OT_select_border);
        WM_operatortype_append(NODE_OT_select_lasso);
        WM_operatortype_append(NODE_OT_select_same_type);
-       WM_operatortype_append(NODE_OT_select_same_type_next);
-       WM_operatortype_append(NODE_OT_select_same_type_prev);
-       WM_operatortype_append(NODE_OT_activate_connected);
+       WM_operatortype_append(NODE_OT_select_same_type_step);
        
        WM_operatortype_append(NODE_OT_view_all);
        WM_operatortype_append(NODE_OT_view_selected);
@@ -319,12 +317,10 @@ void node_keymap(struct wmKeyConfig *keyconf)
        WM_keymap_add_item(keymap, "NODE_OT_select_linked_to", LKEY, KM_PRESS, KM_SHIFT, 0);
        WM_keymap_add_item(keymap, "NODE_OT_select_linked_from", LKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "NODE_OT_select_same_type", GKEY, KM_PRESS, KM_SHIFT, 0);
-//     WM_keymap_add_item(keymap, "NODE_OT_select_same_type_next", RIGHTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
-//     WM_keymap_add_item(keymap, "NODE_OT_select_same_type_prev", LEFTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
 
-       kmi = WM_keymap_add_item(keymap, "NODE_OT_activate_connected", RIGHTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
+       kmi = WM_keymap_add_item(keymap, "NODE_OT_select_same_type_step", RIGHTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
        RNA_boolean_set(kmi->ptr, "prev", FALSE);
-       kmi = WM_keymap_add_item(keymap, "NODE_OT_activate_connected", LEFTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
+       kmi = WM_keymap_add_item(keymap, "NODE_OT_select_same_type_step", LEFTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
        RNA_boolean_set(kmi->ptr, "prev", TRUE);
        
        node_group_operators(keymap, "ShaderNodeGroup");
index 894c4898029494d5476e301bb1b27c59b4c1785f..cdb89a66867c8799d1253f2fac743334719f4c38 100644 (file)
@@ -762,65 +762,10 @@ void NODE_OT_select_same_type(wmOperatorType *ot)
 
 /* ****** Select The Next/Prev Node Of The Same Type ****** */
 
-static int node_select_same_type_next_exec(bContext *C, wmOperator *UNUSED(op))
-{
-       SpaceNode *snode = CTX_wm_space_node(C);
-
-       node_select_same_type_np(snode, 0);
-
-       ED_node_sort(snode->edittree);
-
-       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 *UNUSED(op))
-{
-       SpaceNode *snode = CTX_wm_space_node(C);
-
-       node_select_same_type_np(snode, 1);
-
-       ED_node_sort(snode->edittree);
-
-       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;
-}
-
 /* ************************** */
 
 
-static int node_activate_connected_exec(bContext *C, wmOperator *op)
+static int node_select_same_type_step_exec(bContext *C, wmOperator *op)
 {
        SpaceNode *snode = CTX_wm_space_node(C);
        ARegion *ar = CTX_wm_region(C);
@@ -889,15 +834,15 @@ static int node_activate_connected_exec(bContext *C, wmOperator *op)
        return OPERATOR_FINISHED;
 }
 
-void NODE_OT_activate_connected(wmOperatorType *ot)
+void NODE_OT_select_same_type_step(wmOperatorType *ot)
 {
        /* identifiers */
-       ot->name = "Activate/View Connected";
-       ot->description = "Activate and view connected nodes, step by step";
-       ot->idname = "NODE_OT_activate_connected";
+       ot->name = "Activate Same Type Next/Prev";
+       ot->description = "Activate and view same node type, step by step";
+       ot->idname = "NODE_OT_select_same_type_step";
        
        /* api callbacks */
-       ot->exec = node_activate_connected_exec;
+       ot->exec = node_select_same_type_step_exec;
        ot->poll = ED_operator_node_active;
        
        /* flags */