Bugfix 25683
authorTon Roosendaal <ton@blender.org>
Mon, 17 Jan 2011 18:38:44 +0000 (18:38 +0000)
committerTon Roosendaal <ton@blender.org>
Mon, 17 Jan 2011 18:38:44 +0000 (18:38 +0000)
Compositor operators now have better poll check, so they won't
show up in operator search or hotkeys for other node views.

- backimage move, size
- read renderlayers

source/blender/editors/space_node/node_edit.c

index dc2396f0d15797c8b3940915e5bf4d54aa911e6b..90e2ef5ebc70703b3e7c104269584c02175b29ba 100644 (file)
@@ -194,6 +194,17 @@ void snode_composite_job(const bContext *C, ScrArea *sa)
 
 /* ***************************************** */
 
+/* operator poll callback */
+static int composite_node_active(bContext *C)
+{
+       if( ED_operator_node_active(C)) {
+               SpaceNode *snode= CTX_wm_space_node(C);
+               if(snode->treetype==NTREE_COMPOSIT)
+                       return 1;
+       }
+       return 0;
+}
+
 /* also checks for edited groups */
 bNode *editnode_get_active(bNodeTree *ntree)
 {
@@ -821,7 +832,7 @@ void NODE_OT_backimage_move(wmOperatorType *ot)
        /* api callbacks */
        ot->invoke= snode_bg_viewmove_invoke;
        ot->modal= snode_bg_viewmove_modal;
-       ot->poll= ED_operator_node_active;
+       ot->poll= composite_node_active;
        
        /* flags */
        ot->flag= OPTYPE_BLOCKING;
@@ -849,7 +860,7 @@ void NODE_OT_backimage_zoom(wmOperatorType *ot)
        
        /* api callbacks */
        ot->exec= backimage_zoom;
-       ot->poll= ED_operator_node_active;
+       ot->poll= composite_node_active;
        
        /* flags */
        ot->flag= OPTYPE_BLOCKING;
@@ -1898,6 +1909,7 @@ void NODE_OT_links_cut(wmOperatorType *ot)
 /* ******************************** */
 // XXX some code needing updating to operators...
 
+
 /* goes over all scenes, reads render layers */
 static int node_read_renderlayers_exec(bContext *C, wmOperator *UNUSED(op))
 {
@@ -1935,7 +1947,7 @@ void NODE_OT_read_renderlayers(wmOperatorType *ot)
        
        ot->exec= node_read_renderlayers_exec;
        
-       ot->poll= ED_operator_node_active;
+       ot->poll= composite_node_active;
        
        /* flags */
        ot->flag= 0;
@@ -1966,7 +1978,7 @@ void NODE_OT_read_fullsamplelayers(wmOperatorType *ot)
        
        ot->exec= node_read_fullsamplelayers_exec;
        
-       ot->poll= ED_operator_node_active;
+       ot->poll= composite_node_active;
        
        /* flags */
        ot->flag= 0;
@@ -2369,7 +2381,7 @@ void NODE_OT_add_file(wmOperatorType *ot)
        /* callbacks */
        ot->exec= node_add_file_exec;
        ot->invoke= node_add_file_invoke;
-       ot->poll= ED_operator_node_active;
+       ot->poll= composite_node_active;
        
        /* flags */
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;