Fix T103734: reroutes don't propagate attribute references correctly

This commit is contained in:
Jacques Lucke 2023-01-08 15:17:09 +01:00
parent 5f9a48ed59
commit d8750aa1da
Notes: blender-bot 2023-02-14 09:09:43 +01:00
Referenced by issue #103734, Regression: Geometry Node: Deterministic anonymous attribute did not propagate for Reroute node
1 changed files with 24 additions and 5 deletions

View File

@ -14,6 +14,11 @@ namespace blender::bke::anonymous_attribute_inferencing {
namespace aal = nodes::aal;
using nodes::NodeDeclaration;
static bool socket_is_field(const bNodeSocket &socket)
{
return socket.display_shape == SOCK_DISPLAY_SHAPE_DIAMOND;
}
static const aal::RelationsInNode &get_relations_in_node(const bNode &node, ResourceScope &scope)
{
if (node.is_group()) {
@ -22,6 +27,25 @@ static const aal::RelationsInNode &get_relations_in_node(const bNode &node, Reso
return *group->runtime->anonymous_attribute_relations;
}
}
if (node.is_reroute()) {
const bNodeSocket &socket = node.input_socket(0);
if (socket_is_field(socket)) {
static const aal::RelationsInNode field_relations = []() {
aal::RelationsInNode relations;
relations.reference_relations.append({0, 0});
return relations;
}();
return field_relations;
}
if (socket.type == SOCK_GEOMETRY) {
static const aal::RelationsInNode geometry_relations = []() {
aal::RelationsInNode relations;
relations.propagate_relations.append({0, 0});
return relations;
}();
return geometry_relations;
}
}
if (const NodeDeclaration *node_decl = node.declaration()) {
if (const aal::RelationsInNode *relations = node_decl->anonymous_attribute_relations()) {
return *relations;
@ -41,11 +65,6 @@ Array<const aal::RelationsInNode *> get_relations_by_node(const bNodeTree &tree,
return relations_by_node;
}
static bool socket_is_field(const bNodeSocket &socket)
{
return socket.display_shape == SOCK_DISPLAY_SHAPE_DIAMOND;
}
/**
* Start at a group output socket and find all linked group inputs.
*/