[Bf-blender-cvs] [0348bc88e4c] master: Cleanup: Return early

Hans Goudey noreply at git.blender.org
Sat Sep 3 02:06:20 CEST 2022


Commit: 0348bc88e4c1e26724d2469bab9f50c2ac5cf259
Author: Hans Goudey
Date:   Fri Sep 2 19:06:12 2022 -0500
Branches: master
https://developer.blender.org/rB0348bc88e4c1e26724d2469bab9f50c2ac5cf259

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 26e245c3cf5..d06864f4a8b 100644
--- a/source/blender/editors/space_node/node_relationships.cc
+++ b/source/blender/editors/space_node/node_relationships.cc
@@ -1435,48 +1435,48 @@ static int mute_links_exec(bContext *C, wmOperator *op)
   }
   RNA_END;
 
-  if (i > 1) {
-    ED_preview_kill_jobs(CTX_wm_manager(C), &bmain);
+  if (i <= 1) {
+    return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH;
+  }
 
-    /* Count intersected links and clear test flag. */
-    int tot = 0;
-    LISTBASE_FOREACH (bNodeLink *, link, &snode.edittree->links) {
-      if (node_link_is_hidden_or_dimmed(region.v2d, *link)) {
-        continue;
-      }
-      link->flag &= ~NODE_LINK_TEST;
-      if (node_links_intersect(*link, mcoords, i)) {
-        tot++;
-      }
+  ED_preview_kill_jobs(CTX_wm_manager(C), &bmain);
+
+  /* Count intersected links and clear test flag. */
+  int tot = 0;
+  LISTBASE_FOREACH (bNodeLink *, link, &snode.edittree->links) {
+    if (node_link_is_hidden_or_dimmed(region.v2d, *link)) {
+      continue;
     }
-    if (tot == 0) {
-      return OPERATOR_CANCELLED;
+    link->flag &= ~NODE_LINK_TEST;
+    if (node_links_intersect(*link, mcoords, i)) {
+      tot++;
     }
+  }
+  if (tot == 0) {
+    return OPERATOR_CANCELLED;
+  }
 
-    /* Mute links. */
-    LISTBASE_FOREACH (bNodeLink *, link, &snode.edittree->links) {
-      if (node_link_is_hidden_or_dimmed(region.v2d, *link) || (link->flag & NODE_LINK_TEST)) {
-        continue;
-      }
-
-      if (node_links_intersect(*link, mcoords, i)) {
-        nodeMuteLinkToggle(snode.edittree, link);
-      }
+  /* Mute links. */
+  LISTBASE_FOREACH (bNodeLink *, link, &snode.edittree->links) {
+    if (node_link_is_hidden_or_dimmed(region.v2d, *link) || (link->flag & NODE_LINK_TEST)) {
+      continue;
     }
 
-    /* Clear remaining test flags. */
-    LISTBASE_FOREACH (bNodeLink *, link, &snode.edittree->links) {
-      if (node_link_is_hidden_or_dimmed(region.v2d, *link)) {
-        continue;
-      }
-      link->flag &= ~NODE_LINK_TEST;
+    if (node_links_intersect(*link, mcoords, i)) {
+      nodeMuteLinkToggle(snode.edittree, link);
     }
+  }
 
-    ED_node_tree_propagate_change(C, CTX_data_main(C), snode.edittree);
-    return OPERATOR_FINISHED;
+  /* Clear remaining test flags. */
+  LISTBASE_FOREACH (bNodeLink *, link, &snode.edittree->links) {
+    if (node_link_is_hidden_or_dimmed(region.v2d, *link)) {
+      continue;
+    }
+    link->flag &= ~NODE_LINK_TEST;
   }
 
-  return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH;
+  ED_node_tree_propagate_change(C, CTX_data_main(C), snode.edittree);
+  return OPERATOR_FINISHED;
 }
 
 void NODE_OT_links_mute(wmOperatorType *ot)



More information about the Bf-blender-cvs mailing list