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
This commit is contained in:
Iliya Katueshenock 2023-01-27 14:47:02 +01:00 committed by Jacques Lucke
parent 79f70e48eb
commit 454057f9df
Notes: blender-bot 2023-02-14 07:30:31 +01:00
Referenced by issue #104175, Geometry Nodes: Adding Blur Attribute node with link drag search fails when connecting to boolean socket
1 changed files with 23 additions and 10 deletions

View File

@ -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)