[Bf-blender-cvs] [15f2f69694c] master: Cleanup: Reduce variable scope

Hans Goudey noreply at git.blender.org
Tue Dec 15 00:49:05 CET 2020


Commit: 15f2f69694cb23d04989d3faea4853468a3b140a
Author: Hans Goudey
Date:   Mon Dec 14 17:48:57 2020 -0600
Branches: master
https://developer.blender.org/rB15f2f69694cb23d04989d3faea4853468a3b140a

Cleanup: Reduce variable scope

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

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

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

diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index fc7fa3a6caa..5a2eb0cc3a0 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -344,8 +344,6 @@ void node_from_view(struct bNode *node, float x, float y, float *rx, float *ry)
 /* based on settings in node, sets drawing rect info. each redraw! */
 static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
 {
-  uiLayout *layout, *row;
-
   PointerRNA nodeptr;
   RNA_pointer_create(&ntree->id, &RNA_Node, node, &nodeptr);
 
@@ -374,15 +372,15 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
     PointerRNA sockptr;
     RNA_pointer_create(&ntree->id, &RNA_NodeSocket, nsock, &sockptr);
 
-    layout = UI_block_layout(node->block,
-                             UI_LAYOUT_VERTICAL,
-                             UI_LAYOUT_PANEL,
-                             locx + NODE_DYS,
-                             dy,
-                             NODE_WIDTH(node) - NODE_DY,
-                             NODE_DY,
-                             0,
-                             UI_style_get_dpi());
+    uiLayout *layout = UI_block_layout(node->block,
+                                       UI_LAYOUT_VERTICAL,
+                                       UI_LAYOUT_PANEL,
+                                       locx + NODE_DYS,
+                                       dy,
+                                       NODE_WIDTH(node) - NODE_DY,
+                                       NODE_DY,
+                                       0,
+                                       UI_style_get_dpi());
 
     if (node->flag & NODE_MUTED) {
       uiLayoutSetActive(layout, false);
@@ -393,7 +391,7 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
     uiLayoutSetContextPointer(layout, "socket", &sockptr);
 
     /* align output buttons to the right */
-    row = uiLayoutRow(layout, 1);
+    uiLayout *row = uiLayoutRow(layout, true);
     uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_RIGHT);
     const char *socket_label = nodeSocketLabel(nsock);
     nsock->typeinfo->draw((bContext *)C, row, &sockptr, &nodeptr, IFACE_(socket_label));
@@ -469,15 +467,15 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
     node->butr.ymin = 0;
     node->butr.ymax = 0;
 
-    layout = UI_block_layout(node->block,
-                             UI_LAYOUT_VERTICAL,
-                             UI_LAYOUT_PANEL,
-                             locx + NODE_DYS,
-                             dy,
-                             node->butr.xmax,
-                             0,
-                             0,
-                             UI_style_get_dpi());
+    uiLayout *layout = UI_block_layout(node->block,
+                                       UI_LAYOUT_VERTICAL,
+                                       UI_LAYOUT_PANEL,
+                                       locx + NODE_DYS,
+                                       dy,
+                                       node->butr.xmax,
+                                       0,
+                                       0,
+                                       UI_style_get_dpi());
 
     if (node->flag & NODE_MUTED) {
       uiLayoutSetActive(layout, false);
@@ -502,15 +500,15 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
     PointerRNA sockptr;
     RNA_pointer_create(&ntree->id, &RNA_NodeSocket, nsock, &sockptr);
 
-    layout = UI_block_layout(node->block,
-                             UI_LAYOUT_VERTICAL,
-                             UI_LAYOUT_PANEL,
-                             locx + NODE_DYS,
-                             dy,
-                             NODE_WIDTH(node) - NODE_DY,
-                             NODE_DY,
-                             0,
-                             UI_style_get_dpi());
+    uiLayout *layout = UI_block_layout(node->block,
+                                       UI_LAYOUT_VERTICAL,
+                                       UI_LAYOUT_PANEL,
+                                       locx + NODE_DYS,
+                                       dy,
+                                       NODE_WIDTH(node) - NODE_DY,
+                                       NODE_DY,
+                                       0,
+                                       UI_style_get_dpi());
 
     if (node->flag & NODE_MUTED) {
       uiLayoutSetActive(layout, false);
@@ -520,7 +518,7 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
     uiLayoutSetContextPointer(layout, "node", &nodeptr);
     uiLayoutSetContextPointer(layout, "socket", &sockptr);
 
-    row = uiLayoutRow(layout, 1);
+    uiLayout *row = uiLayoutRow(layout, true);
 
     const char *socket_label = nodeSocketLabel(nsock);
     nsock->typeinfo->draw((bContext *)C, row, &sockptr, &nodeptr, IFACE_(socket_label));
@@ -771,7 +769,6 @@ void node_socket_color_get(
     bContext *C, bNodeTree *ntree, PointerRNA *node_ptr, bNodeSocket *sock, float r_color[4])
 {
   PointerRNA ptr;
-
   BLI_assert(RNA_struct_is_a(node_ptr->type, &RNA_Node));
   RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, sock, &ptr);



More information about the Bf-blender-cvs mailing list