Fix T101208: Missing original index handling in extrude node

The extrude node must set the original indices for new faces to "None"
in edge mode as well. Same for new edges in vertex mode.
This commit is contained in:
Hans Goudey 2022-09-20 14:36:20 -05:00
parent 01ed08690a
commit 90999a0694
Notes: blender-bot 2023-02-14 06:00:46 +01:00
Referenced by issue #101208, Tab into edit -> Segfault
1 changed files with 9 additions and 0 deletions

View File

@ -132,6 +132,9 @@ static CustomData &get_customdata(Mesh &mesh, const eAttrDomain domain)
}
}
/**
* \note The result may be an empty span.
*/
static MutableSpan<int> get_orig_index_layer(Mesh &mesh, const eAttrDomain domain)
{
const bke::AttributeAccessor attributes = mesh.attributes();
@ -296,6 +299,9 @@ static void extrude_mesh_vertices(Mesh &mesh,
MutableSpan<int> vert_orig_indices = get_orig_index_layer(mesh, ATTR_DOMAIN_POINT);
vert_orig_indices.slice(new_vert_range).fill(ORIGINDEX_NONE);
MutableSpan<int> new_edge_orig_indices = get_orig_index_layer(mesh, ATTR_DOMAIN_EDGE);
new_edge_orig_indices.slice(new_edge_range).fill(ORIGINDEX_NONE);
if (attribute_outputs.top_id) {
save_selection_as_attribute(
mesh, attribute_outputs.top_id.get(), ATTR_DOMAIN_POINT, new_vert_range);
@ -631,6 +637,9 @@ static void extrude_mesh_edges(Mesh &mesh,
edge_orig_indices.slice(connect_edge_range).fill(ORIGINDEX_NONE);
edge_orig_indices.slice(duplicate_edge_range).fill(ORIGINDEX_NONE);
MutableSpan<int> poly_orig_indices = get_orig_index_layer(mesh, ATTR_DOMAIN_FACE);
poly_orig_indices.slice(new_poly_range).fill(ORIGINDEX_NONE);
if (attribute_outputs.top_id) {
save_selection_as_attribute(
mesh, attribute_outputs.top_id.get(), ATTR_DOMAIN_EDGE, duplicate_edge_range);