[Bf-blender-cvs] [a736ca33ab0] master: Cleanup: Return early

Hans Goudey noreply at git.blender.org
Sat Sep 3 01:01:59 CEST 2022


Commit: a736ca33ab08bc72d17418d0e55c164aa8e306d8
Author: Hans Goudey
Date:   Fri Sep 2 16:20:01 2022 -0500
Branches: master
https://developer.blender.org/rBa736ca33ab08bc72d17418d0e55c164aa8e306d8

Cleanup: Return early

===================================================================

M	source/blender/editors/space_node/node_relationships.cc

===================================================================

diff --git a/source/blender/editors/space_node/node_relationships.cc b/source/blender/editors/space_node/node_relationships.cc
index 05d0a546b08..cf6e83c9450 100644
--- a/source/blender/editors/space_node/node_relationships.cc
+++ b/source/blender/editors/space_node/node_relationships.cc
@@ -1347,39 +1347,39 @@ static int cut_links_exec(bContext *C, wmOperator *op)
   }
   RNA_END;
 
-  if (i > 1) {
-    bool found = false;
+  if (i == 0) {
+    return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH;
+  }
 
-    ED_preview_kill_jobs(CTX_wm_manager(C), &bmain);
+  bool found = false;
 
-    LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &snode.edittree->links) {
-      if (node_link_is_hidden_or_dimmed(region.v2d, *link)) {
-        continue;
-      }
+  ED_preview_kill_jobs(CTX_wm_manager(C), &bmain);
 
-      if (node_links_intersect(*link, mcoords, i)) {
+  LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &snode.edittree->links) {
+    if (node_link_is_hidden_or_dimmed(region.v2d, *link)) {
+      continue;
+    }
 
-        if (found == false) {
-          /* TODO(sergey): Why did we kill jobs twice? */
-          ED_preview_kill_jobs(CTX_wm_manager(C), &bmain);
-          found = true;
-        }
+    if (node_links_intersect(*link, mcoords, i)) {
 
-        bNode *to_node = link->tonode;
-        nodeRemLink(snode.edittree, link);
-        sort_multi_input_socket_links(snode, *to_node, nullptr, nullptr);
+      if (!found) {
+        /* TODO(sergey): Why did we kill jobs twice? */
+        ED_preview_kill_jobs(CTX_wm_manager(C), &bmain);
+        found = true;
       }
-    }
 
-    ED_node_tree_propagate_change(C, CTX_data_main(C), snode.edittree);
-    if (found) {
-      return OPERATOR_FINISHED;
+      bNode *to_node = link->tonode;
+      nodeRemLink(snode.edittree, link);
+      sort_multi_input_socket_links(snode, *to_node, nullptr, nullptr);
     }
+  }
 
-    return OPERATOR_CANCELLED;
+  ED_node_tree_propagate_change(C, CTX_data_main(C), snode.edittree);
+  if (found) {
+    return OPERATOR_FINISHED;
   }
 
-  return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH;
+  return OPERATOR_CANCELLED;
 }
 
 void NODE_OT_links_cut(wmOperatorType *ot)



More information about the Bf-blender-cvs mailing list