Fix T85979: Attribute missing warning with empty geometry

An error doesn't make sense in these situations because we don't expect
to find attributes on empty geometry, and an empty geometry set is a
valid situation.

Note that we can't use `component.is_empty` here, because often the
component is visually "empty" but still has a point cloud with no
points or a mesh with no vertices.
This commit is contained in:
Hans Goudey 2021-02-25 08:20:02 -06:00
parent bcd369c3c1
commit 626a8e0f10
Notes: blender-bot 2023-02-14 08:49:53 +01:00
Referenced by issue #85979, Geometry nodes warning of missing attributes even when the geometry contains no data
1 changed files with 3 additions and 2 deletions

View File

@ -75,8 +75,9 @@ ReadAttributePtr GeoNodeExecParams::get_input_attribute(const StringRef name,
}
/* If the attribute doesn't exist, use the default value and output an error message
* (except when the field is empty, to avoid spamming error messages). */
if (!name.empty()) {
* (except when the field is empty, to avoid spamming error messages, and not when
* the domain is empty and we don't expect an attribute anyway). */
if (!name.empty() && component.attribute_domain_size(domain) != 0) {
this->error_message_add(NodeWarningType::Error,
std::string("No attribute with name '") + name + "'.");
}