diff options
author | Wannes Malfait <Wannes> | 2022-02-08 01:08:36 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-02-08 01:08:36 +0300 |
commit | 229d0ace026ffb3591fdad4c5a6e0530c1243025 (patch) | |
tree | 48c5eb38f47c0efb9d13e0a58be55f8581628614 | |
parent | 11d785edea7c96a34c4990b88ab833faa52b581c (diff) |
Fix T95532: Merge node deletes everything for empty selections
The problem was that nullptr was returned which is a valid value for
Mesh * and hence the returned optional was treated as having some value.
There was no check for point clouds so that was fixed as well.
Differential Revision: https://developer.blender.org/D14026
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_merge_by_distance.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_merge_by_distance.cc b/source/blender/nodes/geometry/nodes/node_geo_merge_by_distance.cc index 3c790079b5b..89227c773cc 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_merge_by_distance.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_merge_by_distance.cc @@ -60,7 +60,7 @@ static std::optional<Mesh *> mesh_merge_by_distance(const MeshComponent &mesh_co const IndexMask selection = evaluator.get_evaluated_as_mask(0); if (selection.is_empty()) { - return nullptr; + return std::nullopt; } const Mesh &mesh = *mesh_component.get_for_read(); @@ -78,7 +78,9 @@ static void node_geo_exec(GeoNodeExecParams params) if (geometry_set.has_pointcloud()) { PointCloud *result = pointcloud_merge_by_distance( *geometry_set.get_component_for_read<PointCloudComponent>(), merge_distance, selection); - geometry_set.replace_pointcloud(result); + if (result) { + geometry_set.replace_pointcloud(result); + } } if (geometry_set.has_mesh()) { std::optional<Mesh *> result = mesh_merge_by_distance( |