Fix #113095: deduplicate attributes in search

Pull Request: https://projects.blender.org/blender/blender/pulls/113097
This commit is contained in:
Iliya Katueshenock 2023-10-06 14:41:33 +02:00 committed by Jacques Lucke
parent dd9c906840
commit 1a30e0597b
2 changed files with 10 additions and 8 deletions

View File

@ -76,6 +76,8 @@ static Vector<const GeometryAttributeInfo *> get_attribute_info_from_context(
const Map<const bke::bNodeTreeZone *, GeoTreeLog *> log_by_zone =
GeoModifierLog::get_tree_log_by_zone_for_node_editor(*snode);
Set<StringRef> names;
/* For the attribute input node, collect attribute information from all nodes in the group. */
if (node->type == GEO_NODE_INPUT_NAMED_ATTRIBUTE) {
Vector<const GeometryAttributeInfo *> attributes;
@ -83,9 +85,13 @@ static Vector<const GeometryAttributeInfo *> get_attribute_info_from_context(
tree_log->ensure_socket_values();
tree_log->ensure_existing_attributes();
for (const GeometryAttributeInfo *attribute : tree_log->existing_attributes) {
if (bke::allow_procedural_attribute_access(attribute->name)) {
attributes.append(attribute);
if (!names.add(attribute->name)) {
continue;
}
if (!bke::allow_procedural_attribute_access(attribute->name)) {
continue;
}
attributes.append(attribute);
}
}
return attributes;
@ -100,7 +106,7 @@ static Vector<const GeometryAttributeInfo *> get_attribute_info_from_context(
if (node_log == nullptr) {
return {};
}
Set<StringRef> names;
Vector<const GeometryAttributeInfo *> attributes;
for (const bNodeSocket *input_socket : node->input_sockets()) {
if (input_socket->type != SOCK_GEOMETRY) {

View File

@ -294,17 +294,13 @@ void GeoTreeLog::ensure_existing_attributes()
}
this->ensure_socket_values();
Set<StringRef> names;
auto handle_value_log = [&](const ValueLog &value_log) {
const GeometryInfoLog *geo_log = dynamic_cast<const GeometryInfoLog *>(&value_log);
if (geo_log == nullptr) {
return;
}
for (const GeometryAttributeInfo &attribute : geo_log->attributes) {
if (names.add(attribute.name)) {
this->existing_attributes.append(&attribute);
}
this->existing_attributes.append(&attribute);
}
};