[Bf-blender-cvs] [eeeb85baf8a] master: Cleanup: Comment formatting in node_draw.cc

Hans Goudey noreply at git.blender.org
Wed Feb 17 20:34:57 CET 2021


Commit: eeeb85baf8ab203e913513bffe1831eb05e129c5
Author: Hans Goudey
Date:   Wed Feb 17 13:34:49 2021 -0600
Branches: master
https://developer.blender.org/rBeeeb85baf8ab203e913513bffe1831eb05e129c5

Cleanup: Comment formatting in node_draw.cc

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

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

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

diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc
index aaceadcc011..9e96af5e03d 100644
--- a/source/blender/editors/space_node/node_draw.cc
+++ b/source/blender/editors/space_node/node_draw.cc
@@ -127,11 +127,8 @@ void ED_node_tag_update_id(ID *id)
     return;
   }
 
-  /* TODO(sergey): With the new dependency graph it
-   * should be just enough to only tag ntree itself,
-   * all the users of this tree will have update
-   * flushed from the tree,
-   */
+  /* TODO(sergey): With the new dependency graph it should be just enough to only tag ntree itself.
+   * All the users of this tree will have update flushed from the tree. */
   DEG_id_tag_update(&ntree->id, 0);
 
   if (ntree->type == NTREE_SHADER) {
@@ -158,7 +155,7 @@ void ED_node_tag_update_id(ID *id)
     WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, id);
   }
   else if (id == &ntree->id) {
-    /* node groups */
+    /* Node groups. */
     DEG_id_tag_update(id, 0);
   }
 }
@@ -176,10 +173,10 @@ void ED_node_tag_update_nodetree(Main *bmain, bNodeTree *ntree, bNode *node)
     }
   }
 
-  /* look through all datablocks, to support groups */
+  /* Look through all datablocks to support groups. */
   if (do_tag_update) {
     FOREACH_NODETREE_BEGIN (bmain, tntree, id) {
-      /* check if nodetree uses the group */
+      /* Check if nodetree uses the group. */
       if (ntreeHasTree(tntree, ntree)) {
         ED_node_tag_update_id(id);
       }
@@ -195,20 +192,19 @@ void ED_node_tag_update_nodetree(Main *bmain, bNodeTree *ntree, bNode *node)
 static bool compare_nodes(const bNode *a, const bNode *b)
 {
   /* These tell if either the node or any of the parent nodes is selected.
-   * A selected parent means an unselected node is also in foreground!
-   */
+   * A selected parent means an unselected node is also in foreground! */
   bool a_select = (a->flag & NODE_SELECT) != 0, b_select = (b->flag & NODE_SELECT) != 0;
   bool a_active = (a->flag & NODE_ACTIVE) != 0, b_active = (b->flag & NODE_ACTIVE) != 0;
 
-  /* if one is an ancestor of the other */
+  /* If one is an ancestor of the other. */
   /* XXX there might be a better sorting algorithm for stable topological sort,
-   * this is O(n^2) worst case */
+   * this is O(n^2) worst case. */
   for (bNode *parent = a->parent; parent; parent = parent->parent) {
-    /* if b is an ancestor, it is always behind a */
+    /* If B is an ancestor, it is always behind A. */
     if (parent == b) {
       return true;
     }
-    /* any selected ancestor moves the node forward */
+    /* Any selected ancestor moves the node forward. */
     if (parent->flag & NODE_ACTIVE) {
       a_active = true;
     }
@@ -217,11 +213,11 @@ static bool compare_nodes(const bNode *a, const bNode *b)
     }
   }
   for (bNode *parent = b->parent; parent; parent = parent->parent) {
-    /* if a is an ancestor, it is always behind b */
+    /* If A is an ancestor, it is always behind B. */
     if (parent == a) {
       return false;
     }
-    /* any selected ancestor moves the node forward */
+    /* Any selected ancestor moves the node forward. */
     if (parent->flag & NODE_ACTIVE) {
       b_active = true;
     }
@@ -230,7 +226,7 @@ static bool compare_nodes(const bNode *a, const bNode *b)
     }
   }
 
-  /* if one of the nodes is in the background and the other not */
+  /* One of the nodes is in the background and the other not. */
   if ((a->flag & NODE_BACKGROUND) && !(b->flag & NODE_BACKGROUND)) {
     return false;
   }
@@ -238,7 +234,7 @@ static bool compare_nodes(const bNode *a, const bNode *b)
     return true;
   }
 
-  /* if one has a higher selection state (active > selected > nothing) */
+  /* One has a higher selection state (active > selected > nothing). */
   if (!b_active && a_active) {
     return true;
   }
@@ -249,12 +245,13 @@ static bool compare_nodes(const bNode *a, const bNode *b)
   return false;
 }
 
-/* Sorts nodes by selection: unselected nodes first, then selected,
- * then the active node at the very end. Relative order is kept intact!
+/**
+ * Sort nodes by selection: unselected nodes first, then selected,
+ * then the active node at the very end. Relative order is kept intact.
  */
 void ED_node_sort(bNodeTree *ntree)
 {
-  /* merge sort is the algorithm of choice here */
+  /* Merge sort is the algorithm of choice here. */
   int totnodes = BLI_listbase_count(&ntree->nodes);
 
   int k = 1;
@@ -263,16 +260,16 @@ void ED_node_sort(bNodeTree *ntree)
     bNode *first_b = first_a;
 
     do {
-      /* setup first_b pointer */
+      /* Set up first_b pointer. */
       for (int b = 0; b < k && first_b; b++) {
         first_b = first_b->next;
       }
-      /* all batches merged? */
+      /* All batches merged? */
       if (first_b == nullptr) {
         break;
       }
 
-      /* merge batches */
+      /* Merge batches. */
       bNode *node_a = first_a;
       bNode *node_b = first_b;
       int a = 0;
@@ -291,10 +288,10 @@ void ED_node_sort(bNodeTree *ntree)
         }
       }
 
-      /* setup first pointers for next batch */
+      /* Set up first pointers for next batch. */
       first_b = node_b;
       for (; b < k; b++) {
-        /* all nodes sorted? */
+        /* All nodes sorted? */
         if (first_b == nullptr) {
           break;
         }
@@ -319,7 +316,7 @@ static void do_node_internal_buttons(bContext *C, void *UNUSED(node_v), int even
 
 static void node_uiblocks_init(const bContext *C, bNodeTree *ntree)
 {
-  /* add node uiBlocks in drawing order - prevents events going to overlapping nodes */
+  /* Add node uiBlocks in drawing order - prevents events going to overlapping nodes. */
 
   LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
     /* ui block */
@@ -357,26 +354,28 @@ void node_from_view(const bNode *node, float x, float y, float *rx, float *ry)
   nodeFromView(node, x, y, rx, ry);
 }
 
-/* based on settings in node, sets drawing rect info. each redraw! */
+/**
+ * Based on settings and sockets in node, set drawing rect info.
+ */
 static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
 {
   PointerRNA nodeptr;
   RNA_pointer_create(&ntree->id, &RNA_Node, node, &nodeptr);
 
-  /* get "global" coords */
+  /* Get "global" coordinates. */
   float locx, locy;
   node_to_view(node, 0.0f, 0.0f, &locx, &locy);
   float dy = locy;
 
-  /* header */
+  /* Header. */
   dy -= NODE_DY;
 
-  /* little bit space in top */
+  /* Little bit of space in top. */
   if (node->outputs.first) {
     dy -= NODE_DYS / 2;
   }
 
-  /* output sockets */
+  /* Output sockets. */
   bool add_output_space = false;
 
   int buty;
@@ -402,11 +401,11 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
       uiLayoutSetActive(layout, false);
     }
 
-    /* context pointers for current node and socket */
+    /* Context pointers for current node and socket. */
     uiLayoutSetContextPointer(layout, "node", &nodeptr);
     uiLayoutSetContextPointer(layout, "socket", &sockptr);
 
-    /* align output buttons to the right */
+    /* Align output buttons to the right. */
     uiLayout *row = uiLayoutRow(layout, true);
     uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_RIGHT);
     const char *socket_label = nodeSocketLabel(nsock);
@@ -415,11 +414,11 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
     UI_block_align_end(node->block);
     UI_block_layout_resolve(node->block, nullptr, &buty);
 
-    /* ensure minimum socket height in case layout is empty */
+    /* Ensure minimum socket height in case layout is empty. */
     buty = min_ii(buty, dy - NODE_DY);
 
     nsock->locx = locx + NODE_WIDTH(node);
-    /* place the socket circle in the middle of the layout */
+    /* Place the socket circle in the middle of the layout. */
     nsock->locy = 0.5f * (dy + buty);
 
     dy = buty;
@@ -452,8 +451,7 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
       node->prvr.ymin = dy - aspect * (NODE_WIDTH(node) - NODE_DY);
     }
     else {
-      /* width correction of image */
-      /* XXX huh? (ton) */
+      /* Width correction of image. XXX huh? (ton) */
       float dx = (NODE_WIDTH(node) - NODE_DYS) - (NODE_WIDTH(node) - NODE_DYS) / aspect;
 
       node->prvr.ymin = dy - (NODE_WIDTH(node) - NODE_DY);
@@ -464,7 +462,7 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
 
     dy = node->prvr.ymin - NODE_DYS / 2;
 
-    /* make sure that maximums are bigger or equal to minimums */
+    /* Make sure that maximums are bigger or equal to minimums. */
     if (node->prvr.xmax < node->prvr.xmin) {
       SWAP(float, node->prvr.xmax, node->prvr.xmin);
     }
@@ -473,7 +471,7 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
     }
   }
 
-  /* buttons rect? */
+  /* Buttons rect? */
   if (node->typeinfo->draw_buttons && (node->flag & NODE_OPTIONS)) {
     dy -= NODE_DYS / 2;
 
@@ -507,7 +505,7 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
     dy = buty - NODE_DYS / 2;
   }
 
-  /* input sockets */
+  /* Input sockets. */
   LISTBASE_FOREACH (bNodeSocket *, nsock, &node->inputs) {
     if (nodeSocketIsHidden(nsock)) {
       continue;
@@ -540,7 +538,7 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
       uiLayoutSetActive(layout, false);
     }
 
-    /* context pointers for current node and socket */
+    /* Context pointers for current node and socket. */
     uiLayoutSetContextPointer(layout, "node", &nodeptr);
     uiLayoutSetContextPointer(layout, "socket", &sockptr);
 
@@ -552,11 +550,11 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
     UI_block_align_end(node->block);
     UI_block_layout_resolve(node->block, nullptr, &buty);
 
-    /* ensure minimum socket height in case layout is empty */
+    /* Ensure minimum socket height in case layout is empty. */
     buty = min_ii(buty, dy - NODE_DY);
 
     nsock->locx = locx;
-    /* place the socket circle in the middle of the layout */
+    /* Place the socket circle in the middle of the layout. */
     nsock->loc

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list