Fix: Sculpt: Dynamic topology restore from undo doesn't work

We don't push individual nodes for undo, checking for an undo node
wasn't correct.
This commit is contained in:
Hans Goudey 2024-07-01 10:02:06 -04:00
parent 87159b2871
commit 057fdf4224

@ -1460,14 +1460,16 @@ static void restore_position(Object &object, const Span<PBVHNode *> nodes)
break; break;
} }
case PBVH_BMESH: { case PBVH_BMESH: {
for (PBVHNode *node : nodes) { threading::parallel_for(nodes.index_range(), 1, [&](const IndexRange range) {
if (undo::get_node(node, undo::Type::Position)) { for (PBVHNode *node : nodes.slice(range)) {
for (BMVert *vert : BKE_pbvh_bmesh_node_unique_verts(node)) { for (BMVert *vert : BKE_pbvh_bmesh_node_unique_verts(node)) {
copy_v3_v3(vert->co, BM_log_original_vert_co(ss.bm_log, vert)); if (const float *orig_co = BM_log_find_original_vert_co(ss.bm_log, vert)) {
copy_v3_v3(vert->co, orig_co);
}
} }
BKE_pbvh_node_mark_positions_update(node); BKE_pbvh_node_mark_positions_update(node);
} }
} });
break; break;
} }
case PBVH_GRIDS: { case PBVH_GRIDS: {