[Bf-blender-cvs] [454057f9df8] master: Fix T104175: adding Blur Attribute node with link drag search fails

Iliya Katueshenock noreply at git.blender.org
Fri Jan 27 14:48:56 CET 2023


Commit: 454057f9df85fe36aaea57db41295e3bab074594
Author: Iliya Katueshenock
Date:   Fri Jan 27 14:47:02 2023 +0100
Branches: master
https://developer.blender.org/rB454057f9df85fe36aaea57db41295e3bab074594

Fix T104175: adding Blur Attribute node with link drag search fails

The node does not support blurring booleans, but that was not handled
property in link drag search.

Differential Revision: https://developer.blender.org/D17139

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

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

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

diff --git a/source/blender/nodes/geometry/nodes/node_geo_blur_attribute.cc b/source/blender/nodes/geometry/nodes/node_geo_blur_attribute.cc
index 48062516784..77bfa7a2b58 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_blur_attribute.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_blur_attribute.cc
@@ -82,19 +82,32 @@ static void node_init(bNodeTree * /*tree*/, bNode *node)
 
 static void node_gather_link_searches(GatherLinkSearchOpParams &params)
 {
-  const NodeDeclaration &declaration = *params.node_type().fixed_declaration;
+  const bNodeType &node_type = params.node_type();
+  const NodeDeclaration &declaration = *node_type.fixed_declaration;
+
+  /* Weight and Iterations inputs don't change based on the data type. */
   search_link_ops_for_declarations(params, declaration.inputs.as_span().take_back(2));
 
-  const bNodeType &node_type = params.node_type();
-  const std::optional<eCustomDataType> type = node_data_type_to_custom_data_type(
-      (eNodeSocketDatatype)params.other_socket().type);
-  if (type && *type != CD_PROP_STRING) {
-    params.add_item(IFACE_("Value"), [node_type, type](LinkSearchOpParams &params) {
-      bNode &node = params.add_node(node_type);
-      node.custom1 = *type;
-      params.update_and_connect_available_socket(node, "Value");
-    });
+  const eNodeSocketDatatype other_socket_type = static_cast<eNodeSocketDatatype>(
+      params.other_socket().type);
+  const std::optional<eCustomDataType> new_node_type = node_data_type_to_custom_data_type(
+      other_socket_type);
+  if (!new_node_type.has_value()) {
+    return;
   }
+  eCustomDataType fixed_data_type = *new_node_type;
+  if (fixed_data_type == CD_PROP_STRING) {
+    return;
+  }
+  if (fixed_data_type == CD_PROP_BOOL) {
+    /* This node does not support boolean sockets, use integer instead. */
+    fixed_data_type = CD_PROP_INT32;
+  }
+  params.add_item(IFACE_("Value"), [node_type, fixed_data_type](LinkSearchOpParams &params) {
+    bNode &node = params.add_node(node_type);
+    node.custom1 = fixed_data_type;
+    params.update_and_connect_available_socket(node, "Value");
+  });
 }
 
 static void node_update(bNodeTree *ntree, bNode *node)



More information about the Bf-blender-cvs mailing list