Fix T102700: Viewer node missing check for empty geometry component
`GeometrySet::has()` can return an empty component. It's more convenient if it doesn't, since other code rarely wants to access an empty component. The alternative would be adding an `is_empty()` check in the lazy function for the viewer node, that would work fine too, for this case. Differential Revision: https://developer.blender.org/D16584
This commit is contained in:
@@ -161,7 +161,8 @@ const GeometryComponent *GeometrySet::get_component_for_read(
|
||||
|
||||
bool GeometrySet::has(const GeometryComponentType component_type) const
|
||||
{
|
||||
return components_[component_type].has_value();
|
||||
const GeometryComponentPtr &component = components_[component_type];
|
||||
return component.has_value() && !component->is_empty();
|
||||
}
|
||||
|
||||
void GeometrySet::remove(const GeometryComponentType component_type)
|
||||
|
||||
@@ -1016,9 +1016,6 @@ static Vector<OutputAttributeToStore> compute_attributes_to_store(
|
||||
continue;
|
||||
}
|
||||
const GeometryComponent &component = *geometry.get_component_for_read(component_type);
|
||||
if (component.is_empty()) {
|
||||
continue;
|
||||
}
|
||||
const blender::bke::AttributeAccessor attributes = *component.attributes();
|
||||
for (const auto item : outputs_by_domain.items()) {
|
||||
const eAttrDomain domain = item.key;
|
||||
|
||||
@@ -111,9 +111,6 @@ static bool component_is_available(const GeometrySet &geometry,
|
||||
return false;
|
||||
}
|
||||
const GeometryComponent &component = *geometry.get_component_for_read(type);
|
||||
if (component.is_empty()) {
|
||||
return false;
|
||||
}
|
||||
return component.attribute_domain_size(domain) != 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -211,9 +211,6 @@ static bool component_is_available(const GeometrySet &geometry,
|
||||
return false;
|
||||
}
|
||||
const GeometryComponent &component = *geometry.get_component_for_read(type);
|
||||
if (component.is_empty()) {
|
||||
return false;
|
||||
}
|
||||
return component.attribute_domain_size(domain) != 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user