[Bf-blender-cvs] [18151a35864] temp-geometry-nodes-mix-attributes: move utility function to another place

Jacques Lucke noreply at git.blender.org
Wed Dec 9 16:48:19 CET 2020


Commit: 18151a358643fd33a28039ca3c7b289147b2832e
Author: Jacques Lucke
Date:   Wed Dec 9 15:32:32 2020 +0100
Branches: temp-geometry-nodes-mix-attributes
https://developer.blender.org/rB18151a358643fd33a28039ca3c7b289147b2832e

move utility function to another place

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

M	source/blender/nodes/geometry/node_geometry_util.cc
M	source/blender/nodes/geometry/node_geometry_util.hh
M	source/blender/nodes/geometry/nodes/node_geo_attribute_mix.cc

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

diff --git a/source/blender/nodes/geometry/node_geometry_util.cc b/source/blender/nodes/geometry/node_geometry_util.cc
index 41bdb1cfff0..e1d9209de0a 100644
--- a/source/blender/nodes/geometry/node_geometry_util.cc
+++ b/source/blender/nodes/geometry/node_geometry_util.cc
@@ -17,6 +17,27 @@
 #include "node_geometry_util.hh"
 #include "node_util.h"
 
+namespace blender::nodes {
+
+void update_attribute_input_socket_availabilities(bNode &node,
+                                                  const StringRef name,
+                                                  const uint8_t mode)
+{
+  const GeometryNodeAttributeInputMode mode_ = (GeometryNodeAttributeInputMode)mode;
+  LISTBASE_FOREACH (bNodeSocket *, socket, &node.inputs) {
+    if (name == socket->name) {
+      const bool is_available =
+          ((socket->type == SOCK_STRING && mode_ == GEO_NODE_ATTRIBUTE_INPUT_ATTRIBUTE) ||
+           (socket->type == SOCK_FLOAT && mode_ == GEO_NODE_ATTRIBUTE_INPUT_FLOAT) ||
+           (socket->type == SOCK_VECTOR && mode_ == GEO_NODE_ATTRIBUTE_INPUT_VECTOR) ||
+           (socket->type == SOCK_RGBA && mode_ == GEO_NODE_ATTRIBUTE_INPUT_COLOR));
+      nodeSetSocketAvailability(socket, is_available);
+    }
+  }
+}
+
+}  // namespace blender::nodes
+
 bool geo_node_poll_default(bNodeType *UNUSED(ntype), bNodeTree *ntree)
 {
   return STREQ(ntree->idname, "GeometryNodeTree");
diff --git a/source/blender/nodes/geometry/node_geometry_util.hh b/source/blender/nodes/geometry/node_geometry_util.hh
index bb26763642b..532c30f7f19 100644
--- a/source/blender/nodes/geometry/node_geometry_util.hh
+++ b/source/blender/nodes/geometry/node_geometry_util.hh
@@ -37,3 +37,9 @@
 void geo_node_type_base(
     struct bNodeType *ntype, int type, const char *name, short nclass, short flag);
 bool geo_node_poll_default(struct bNodeType *ntype, struct bNodeTree *ntree);
+
+namespace blender::nodes {
+void update_attribute_input_socket_availabilities(bNode &node,
+                                                  const StringRef name,
+                                                  const uint8_t mode);
+}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_mix.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_mix.cc
index 19fcd298f42..c8b75a1a5b7 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_attribute_mix.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_mix.cc
@@ -176,23 +176,6 @@ static void geo_node_attribute_mix_init(bNodeTree *UNUSED(ntree), bNode *node)
   node->storage = data;
 }
 
-static void update_attribute_input_socket_availabilities(bNode &node,
-                                                         const StringRef name,
-                                                         const uint8_t mode)
-{
-  const GeometryNodeAttributeInputMode mode_ = (GeometryNodeAttributeInputMode)mode;
-  LISTBASE_FOREACH (bNodeSocket *, socket, &node.inputs) {
-    if (name == socket->name) {
-      const bool is_available =
-          ((socket->type == SOCK_STRING && mode_ == GEO_NODE_ATTRIBUTE_INPUT_ATTRIBUTE) ||
-           (socket->type == SOCK_FLOAT && mode_ == GEO_NODE_ATTRIBUTE_INPUT_FLOAT) ||
-           (socket->type == SOCK_VECTOR && mode_ == GEO_NODE_ATTRIBUTE_INPUT_VECTOR) ||
-           (socket->type == SOCK_RGBA && mode_ == GEO_NODE_ATTRIBUTE_INPUT_COLOR));
-      nodeSetSocketAvailability(socket, is_available);
-    }
-  }
-}
-
 static void geo_node_attribute_mix_update(bNodeTree *UNUSED(ntree), bNode *node)
 {
   NodeAttributeMix *node_storage = (NodeAttributeMix *)node->storage;



More information about the Bf-blender-cvs mailing list