[Bf-blender-cvs] [90e5ce6ab51] master: Cleanup: Loop through socket listbase instead of array

Aaron Carlisle noreply at git.blender.org
Sat Jan 8 05:54:05 CET 2022


Commit: 90e5ce6ab513e733dddecddb65ed4f303c5589f7
Author: Aaron Carlisle
Date:   Fri Jan 7 23:38:35 2022 -0500
Branches: master
https://developer.blender.org/rB90e5ce6ab513e733dddecddb65ed4f303c5589f7

Cleanup: Loop through socket listbase instead of array

The socket arrays will be removed when using the new socket builder.
So instead we have to loop through the node outputs list.

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

M	source/blender/nodes/shader/nodes/node_shader_attribute.cc
M	source/blender/nodes/shader/nodes/node_shader_tex_coord.cc

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

diff --git a/source/blender/nodes/shader/nodes/node_shader_attribute.cc b/source/blender/nodes/shader/nodes/node_shader_attribute.cc
index 780d0a72ef8..3e9c57df7cf 100644
--- a/source/blender/nodes/shader/nodes/node_shader_attribute.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_attribute.cc
@@ -76,7 +76,8 @@ static int node_shader_gpu_attribute(GPUMaterial *mat,
   GPU_stack_link(mat, node, "node_attribute", in, out, cd_attr);
 
   /* for each output. */
-  for (int i = 0; sh_node_attribute_out[i].type != -1; i++) {
+  int i;
+  LISTBASE_FOREACH_INDEX (bNodeSocket *, sock, &node->outputs, i) {
     node_shader_gpu_bump_tex_coord(mat, node, &out[i].link);
   }
 
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc b/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc
index 9372d29456d..723458b7321 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc
@@ -63,8 +63,8 @@ static int node_shader_gpu_tex_coord(GPUMaterial *mat,
   GPU_stack_link(
       mat, node, "node_tex_coord", in, out, viewpos, worldnor, inv_obmat, texcofacs, orco, mtface);
 
-  /* for each output. */
-  for (int i = 0; sh_node_tex_coord_out[i].type != -1; i++) {
+  int i;
+  LISTBASE_FOREACH_INDEX (bNodeSocket *, sock, &node->outputs, i) {
     node_shader_gpu_bump_tex_coord(mat, node, &out[i].link);
     /* Normalize some vectors after dFdx/dFdy offsets.
      * This is the case for interpolated, non linear functions.



More information about the Bf-blender-cvs mailing list