Fix #108537: Incorrect early return in delete geometry node #108540

Merged
Hans Goudey merged 2 commits from mod_moder/blender:tmp_fix_new_delete_geometry into main 2023-06-02 14:24:03 +02:00
1 changed files with 15 additions and 1 deletions

View File

@ -276,7 +276,10 @@ std::optional<Mesh *> mesh_copy_selection(
if (vert_mask.is_empty()) {
return nullptr;
mod_moder marked this conversation as resolved Outdated

I don't think this part is necessary. IMO nullptr is clear enough from std::nullopt that the intent is clear as well.

I don't think this part is necessary. IMO `nullptr` is clear enough from `std::nullopt` that the intent is clear as well.
}
if (vert_mask.size() == src_mesh.totvert) {
const bool same_verts = vert_mask.size() == src_mesh.totvert;
mod_moder marked this conversation as resolved Outdated

vertices -> verts

`vertices` -> `verts`

polygons -> polys too?

`polygons` -> `polys` too?

Ah right, yes.

Ah right, yes.
const bool same_edges = edge_mask.size() == src_mesh.totedge;
const bool same_polys = poly_mask.size() == src_mesh.totpoly;
if (same_verts && same_edges && same_polys) {
return std::nullopt;
}
@ -408,6 +411,12 @@ std::optional<Mesh *> mesh_copy_selection_keep_verts(
break;
}
const bool same_edges = edge_mask.size() == src_mesh.totedge;
const bool same_polys = poly_mask.size() == src_mesh.totpoly;
if (same_edges && same_polys) {
return std::nullopt;
}
Mesh *dst_mesh = create_mesh_no_attributes(
src_mesh, src_mesh.totvert, edge_mask.size(), poly_mask.size(), 0);
bke::MutableAttributeAccessor dst_attributes = dst_mesh->attributes_for_write();
@ -488,6 +497,11 @@ std::optional<Mesh *> mesh_copy_selection_keep_edges(
break;
}
const bool same_polys = poly_mask.size() == src_mesh.totpoly;
if (same_polys) {
return std::nullopt;
}
Mesh *dst_mesh = create_mesh_no_attributes(
src_mesh, src_mesh.totvert, src_mesh.totedge, poly_mask.size(), 0);
bke::MutableAttributeAccessor dst_attributes = dst_mesh->attributes_for_write();