[Bf-blender-cvs] [22ee056c3ab] master: Geometry Nodes: Rename bounding box mesh output to "Bounding Box"

Hans Goudey noreply at git.blender.org
Tue Jun 8 18:11:56 CEST 2021


Commit: 22ee056c3abb0b58ca482d57afa51ae61cbed575
Author: Hans Goudey
Date:   Tue Jun 8 11:11:49 2021 -0500
Branches: master
https://developer.blender.org/rB22ee056c3abb0b58ca482d57afa51ae61cbed575

Geometry Nodes: Rename bounding box mesh output to "Bounding Box"

This was decided by the geometry nodes team, because the
important part of this output is not that it's a mesh.

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

M	source/blender/blenloader/intern/versioning_300.c
M	source/blender/nodes/geometry/nodes/node_geo_bounding_box.cc

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

diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c
index 284a30a280d..93e2af1b68e 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -159,6 +159,33 @@ static void version_switch_node_input_prefix(Main *bmain)
   FOREACH_NODETREE_END;
 }
 
+static void version_node_socket_name(bNodeTree *ntree,
+                                     const int node_type,
+                                     const char *old_name,
+                                     const char *new_name)
+{
+  LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
+    if (node->type == node_type) {
+      LISTBASE_FOREACH (bNodeSocket *, socket, &node->inputs) {
+        if (STREQ(socket->name, old_name)) {
+          strcpy(socket->name, new_name);
+        }
+        if (STREQ(socket->identifier, old_name)) {
+          strcpy(socket->identifier, new_name);
+        }
+      }
+      LISTBASE_FOREACH (bNodeSocket *, socket, &node->outputs) {
+        if (STREQ(socket->name, old_name)) {
+          strcpy(socket->name, new_name);
+        }
+        if (STREQ(socket->identifier, old_name)) {
+          strcpy(socket->identifier, new_name);
+        }
+      }
+    }
+  }
+}
+
 /* NOLINTNEXTLINE: readability-function-size */
 void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
 {
@@ -211,5 +238,11 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
    */
   {
     /* Keep this block, even when empty. */
+    FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
+      if (ntree->type == NTREE_GEOMETRY) {
+        version_node_socket_name(ntree, GEO_NODE_BOUNDING_BOX, "Mesh", "Bounding Box");
+      }
+    }
+    FOREACH_NODETREE_END;
   }
 }
diff --git a/source/blender/nodes/geometry/nodes/node_geo_bounding_box.cc b/source/blender/nodes/geometry/nodes/node_geo_bounding_box.cc
index f1731052515..83d3558a7cd 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_bounding_box.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_bounding_box.cc
@@ -25,7 +25,7 @@ static bNodeSocketTemplate geo_node_bounding_box_in[] = {
 };
 
 static bNodeSocketTemplate geo_node_bounding_box_out[] = {
-    {SOCK_GEOMETRY, N_("Mesh")},
+    {SOCK_GEOMETRY, N_("Bounding Box")},
     {SOCK_VECTOR, N_("Min")},
     {SOCK_VECTOR, N_("Max")},
     {-1, ""},
@@ -149,7 +149,7 @@ static void geo_node_bounding_box_exec(GeoNodeExecParams params)
   }
 
   if (min == float3(FLT_MAX)) {
-    params.set_output("Mesh", GeometrySet());
+    params.set_output("Bounding Box", GeometrySet());
     params.set_output("Min", float3(0));
     params.set_output("Max", float3(0));
   }
@@ -158,7 +158,7 @@ static void geo_node_bounding_box_exec(GeoNodeExecParams params)
     const float3 center = min + scale / 2.0f;
     Mesh *mesh = create_cube_mesh(1.0f);
     transform_mesh(mesh, center, float3(0), scale);
-    params.set_output("Mesh", GeometrySet::create_with_mesh(mesh));
+    params.set_output("Bounding Box", GeometrySet::create_with_mesh(mesh));
     params.set_output("Min", min);
     params.set_output("Max", max);
   }



More information about the Bf-blender-cvs mailing list