[Bf-blender-cvs] [37d83f0095d] master: Cleanup: Reduce indentation in node attach operator

Hans Goudey noreply at git.blender.org
Wed Oct 12 01:18:12 CEST 2022


Commit: 37d83f0095da9a8cf741ce973dfb6f2cfb38ee3f
Author: Hans Goudey
Date:   Tue Oct 11 16:50:04 2022 -0500
Branches: master
https://developer.blender.org/rB37d83f0095da9a8cf741ce973dfb6f2cfb38ee3f

Cleanup: Reduce indentation in node attach operator

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

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 7cf18e2f828..e631cb5aa42 100644
--- a/source/blender/editors/space_node/node_relationships.cc
+++ b/source/blender/editors/space_node/node_relationships.cc
@@ -1750,29 +1750,31 @@ static int node_attach_invoke(bContext *C, wmOperator * /*op*/, const wmEvent *e
   }
 
   LISTBASE_FOREACH_BACKWARD (bNode *, node, &ntree.nodes) {
-    if (node->flag & NODE_SELECT) {
-      if (node->parent == nullptr) {
-        /* disallow moving a parent into its child */
-        if (nodeAttachNodeCheck(frame, node) == false) {
-          /* attach all unparented nodes */
-          nodeAttachNode(node, frame);
-        }
+    if (!(node->flag & NODE_SELECT)) {
+      continue;
+    }
+
+    if (node->parent == nullptr) {
+      /* disallow moving a parent into its child */
+      if (nodeAttachNodeCheck(frame, node) == false) {
+        /* attach all unparented nodes */
+        nodeAttachNode(node, frame);
       }
-      else {
-        /* attach nodes which share parent with the frame */
-        bNode *parent;
-        for (parent = frame->parent; parent; parent = parent->parent) {
-          if (parent == node->parent) {
-            break;
-          }
+    }
+    else {
+      /* attach nodes which share parent with the frame */
+      bNode *parent;
+      for (parent = frame->parent; parent; parent = parent->parent) {
+        if (parent == node->parent) {
+          break;
         }
+      }
 
-        if (parent) {
-          /* disallow moving a parent into its child */
-          if (nodeAttachNodeCheck(frame, node) == false) {
-            nodeDetachNode(node);
-            nodeAttachNode(node, frame);
-          }
+      if (parent) {
+        /* disallow moving a parent into its child */
+        if (nodeAttachNodeCheck(frame, node) == false) {
+          nodeDetachNode(node);
+          nodeAttachNode(node, frame);
         }
       }
     }



More information about the Bf-blender-cvs mailing list