dont re-combute composite nodes when knife and add-socket operators don't add any...
authorCampbell Barton <ideasman42@gmail.com>
Fri, 3 Aug 2012 23:44:19 +0000 (23:44 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 3 Aug 2012 23:44:19 +0000 (23:44 +0000)
source/blender/editors/space_node/node_add.c
source/blender/editors/space_node/node_relationships.c

index 20429d832b570457bb6056770a6fe8e5667bf957..c7bc9146965f61597060b0e3db73fd7e43e89cee 100644 (file)
@@ -155,13 +155,14 @@ static int add_reroute_exec(bContext *C, wmOperator *op)
                bNodeLink *link;
                float insertPoint[2];
 
-               ED_preview_kill_jobs(C);
-
                for (link = snode->edittree->links.first; link; link = link->next) {
                        if (add_reroute_intersect_check(link, mcoords, i, insertPoint)) {
                                bNodeTemplate ntemp;
                                bNode *rerouteNode;
 
+                               /* always first */
+                               ED_preview_kill_jobs(C);
+
                                node_deselect_all(snode);
 
                                ntemp.type = NODE_REROUTE;
@@ -178,15 +179,17 @@ static int add_reroute_exec(bContext *C, wmOperator *op)
                                link->fromnode = rerouteNode;
                                link->fromsock = rerouteNode->outputs.first;
 
-                               break; // add one reroute at the time.
+                               /* always last */
+                               ntreeUpdateTree(snode->edittree);
+                               snode_notify(C, snode);
+                               snode_dag_update(C, snode);
+
+                               return OPERATOR_FINISHED; // add one reroute at the time.
                        }
                }
 
-               ntreeUpdateTree(snode->edittree);
-               snode_notify(C, snode);
-               snode_dag_update(C, snode);
+               return OPERATOR_CANCELLED;
 
-               return OPERATOR_FINISHED;
        }
 
        return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH;
index cda736d199a5f1d53294330c7a1779ff66dec12c..5c59555a0ed1da4d085f6c46d0ad580a61c6d29a 100644 (file)
@@ -836,24 +836,35 @@ static int cut_links_exec(bContext *C, wmOperator *op)
        RNA_END;
 
        if (i > 1) {
+               int found = FALSE;
                bNodeLink *link, *next;
 
-               ED_preview_kill_jobs(C);
-
                for (link = snode->edittree->links.first; link; link = next) {
                        next = link->next;
 
                        if (cut_links_intersect(link, mcoords, i)) {
+
+                               if (found == FALSE) {
+                                       ED_preview_kill_jobs(C);
+                                       found = TRUE;
+                               }
+
                                snode_update(snode, link->tonode);
                                nodeRemLink(snode->edittree, link);
                        }
                }
 
-               ntreeUpdateTree(snode->edittree);
-               snode_notify(C, snode);
-               snode_dag_update(C, snode);
+               if (found) {
+                       ntreeUpdateTree(snode->edittree);
+                       snode_notify(C, snode);
+                       snode_dag_update(C, snode);
+
+                       return OPERATOR_FINISHED;
+               }
+               else {
+                       return OPERATOR_CANCELLED;
+               }
 
-               return OPERATOR_FINISHED;
        }
 
        return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH;