Fix #117971: wrong indices in sculpt undo/restore colors #117986

Merged
Philipp Oeser merged 1 commits from lichtwerk/blender:117971 into blender-v4.1-release 2024-02-08 14:49:35 +01:00
1 changed files with 4 additions and 2 deletions
Showing only changes of commit a11b60a893 - Show all commits

View File

@ -595,7 +595,8 @@ static bool restore_color(Object *ob, Node &unode, MutableSpan<bool> modified_ve
/* NOTE: even with loop colors we still store derived
* vertex colors for original data lookup. */
if (!unode.col.is_empty() && unode.loop_col.is_empty()) {
BKE_pbvh_swap_colors(ss->pbvh, unode.vert_indices, unode.col);
BKE_pbvh_swap_colors(
ss->pbvh, unode.vert_indices.as_span().take_front(unode.unique_verts_num), unode.col);
modified = true;
}
@ -1404,7 +1405,8 @@ static void store_color(Object *ob, Node *unode)
/* NOTE: even with loop colors we still store (derived)
* vertex colors for original data lookup. */
BKE_pbvh_store_colors_vertex(ss->pbvh, unode->vert_indices, unode->col);
BKE_pbvh_store_colors_vertex(
ss->pbvh, unode->vert_indices.as_span().take_front(unode->unique_verts_num), unode->col);
if (!unode->loop_col.is_empty() && !unode->corner_indices.is_empty()) {
BKE_pbvh_store_colors(ss->pbvh, unode->corner_indices, unode->loop_col);