Fix: Assert when undoing sculpt deformation

Pull Request: https://projects.blender.org/blender/blender/pulls/130477
This commit is contained in:
Sean Kim 2024-11-18 22:29:17 +01:00 committed by Sean Kim
parent eeeac09241
commit 54c0699413

View File

@ -358,7 +358,8 @@ static void restore_position_mesh(Object &object,
/* When original positions aren't written separately in the the undo step, there are no
* deform modifiers. Therefore the original and evaluated deform positions will be the
* same, and modifying the positions from the original mesh is enough. */
swap_indexed_data(unode.position.as_mutable_span(), verts, positions);
swap_indexed_data(
unode.position.as_mutable_span().take_front(unode.unique_verts_num), verts, positions);
}
else {
/* When original positions are stored in the undo step, undo/redo will cause a reevaluation
@ -381,11 +382,11 @@ static void restore_position_mesh(Object &object,
/* The basis key positions and the mesh positions are always kept in sync. */
scatter_data_mesh(undo_positions.as_span(), verts, positions);
}
swap_indexed_data(undo_positions, verts, active_data);
swap_indexed_data(undo_positions.take_front(unode.unique_verts_num), verts, active_data);
}
else {
/* There is a deform modifier, but no shape keys. */
swap_indexed_data(undo_positions, verts, positions);
swap_indexed_data(undo_positions.take_front(unode.unique_verts_num), verts, positions);
}
}
modified_verts.fill_indices(verts, true);