[Bf-blender-cvs] [ba698f08127] master: Geometry Nodes: update callbacks with 2 new socket types

Wannes Malfait noreply at git.blender.org
Mon May 17 11:11:59 CEST 2021


Commit: ba698f081270f807820a63355a3c7bb83f5f5a38
Author: Wannes Malfait
Date:   Mon May 17 11:11:25 2021 +0200
Branches: master
https://developer.blender.org/rBba698f081270f807820a63355a3c7bb83f5f5a38

Geometry Nodes: update callbacks with 2 new socket types

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

M	source/blender/nodes/geometry/node_geometry_tree.cc

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

diff --git a/source/blender/nodes/geometry/node_geometry_tree.cc b/source/blender/nodes/geometry/node_geometry_tree.cc
index f13ddabbf2c..f4cd00b88ed 100644
--- a/source/blender/nodes/geometry/node_geometry_tree.cc
+++ b/source/blender/nodes/geometry/node_geometry_tree.cc
@@ -86,12 +86,13 @@ static void foreach_nodeclass(Scene *UNUSED(scene), void *calldata, bNodeClassCa
 
 static bool geometry_node_tree_validate_link(bNodeTree *UNUSED(ntree), bNodeLink *link)
 {
-  /* Geometry, string, object and collection sockets can only be connected to themselves. */
-  if (ELEM(link->fromsock->type, SOCK_GEOMETRY, SOCK_STRING, SOCK_OBJECT, SOCK_COLLECTION) ||
-      ELEM(link->tosock->type, SOCK_GEOMETRY, SOCK_STRING, SOCK_OBJECT, SOCK_COLLECTION)) {
-    return (link->tosock->type == link->fromsock->type);
+  /* Geometry, string, object, material, texture and collection sockets can only be connected to
+   * themselves. The other types can be converted between each other. */
+  if (ELEM(link->fromsock->type, SOCK_FLOAT, SOCK_VECTOR, SOCK_RGBA, SOCK_BOOLEAN, SOCK_INT) &&
+      ELEM(link->tosock->type, SOCK_FLOAT, SOCK_VECTOR, SOCK_RGBA, SOCK_BOOLEAN, SOCK_INT)) {
+    return true;
   }
-  return true;
+  return (link->tosock->type == link->fromsock->type);
 }
 
 static bool geometry_node_tree_socket_type_valid(eNodeSocketDatatype socket_type,
@@ -106,7 +107,9 @@ static bool geometry_node_tree_socket_type_valid(eNodeSocketDatatype socket_type
               SOCK_STRING,
               SOCK_OBJECT,
               SOCK_GEOMETRY,
-              SOCK_COLLECTION);
+              SOCK_COLLECTION,
+              SOCK_TEXTURE,
+              SOCK_MATERIAL);
 }
 
 void register_node_tree_type_geo(void)



More information about the Bf-blender-cvs mailing list