[Bf-blender-cvs] [41ae2c6438f] blender-v3.4-release: Fix T102700: Viewer node missing check for empty geometry component
Hans Goudey
noreply at git.blender.org
Tue Nov 22 22:43:36 CET 2022
Commit: 41ae2c6438f7221b981d5b702b6838efe29e3f9d
Author: Hans Goudey
Date: Tue Nov 22 15:40:42 2022 -0600
Branches: blender-v3.4-release
https://developer.blender.org/rB41ae2c6438f7221b981d5b702b6838efe29e3f9d
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
===================================================================
M source/blender/blenkernel/intern/geometry_set.cc
M source/blender/modifiers/intern/MOD_nodes.cc
M source/blender/nodes/geometry/nodes/node_geo_sample_index.cc
M source/blender/nodes/geometry/nodes/node_geo_sample_nearest.cc
===================================================================
diff --git a/source/blender/blenkernel/intern/geometry_set.cc b/source/blender/blenkernel/intern/geometry_set.cc
index ee4c398c3d6..aef7204e90d 100644
--- a/source/blender/blenkernel/intern/geometry_set.cc
+++ b/source/blender/blenkernel/intern/geometry_set.cc
@@ -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)
diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc
index 15d7e494c04..697c32cb9f3 100644
--- a/source/blender/modifiers/intern/MOD_nodes.cc
+++ b/source/blender/modifiers/intern/MOD_nodes.cc
@@ -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;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_sample_index.cc b/source/blender/nodes/geometry/nodes/node_geo_sample_index.cc
index 4d2db059798..808f3277f07 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_sample_index.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_sample_index.cc
@@ -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;
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_sample_nearest.cc b/source/blender/nodes/geometry/nodes/node_geo_sample_nearest.cc
index 8c5dad3a1c5..c7acfb7a375 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_sample_nearest.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_sample_nearest.cc
@@ -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;
}
More information about the Bf-blender-cvs
mailing list