Fix #128798: Face corner normals cache not tagged dirty in sculpt undo

Similar to the handling of this cache in `flush_update_step` (after a
brush stroke calculation), the face normals cache needs to be cleared.
Sculpt mode doesn't have granular updates implemented for face corner
normals currently.

Pull Request: https://projects.blender.org/blender/blender/pulls/130248
This commit is contained in:
Hans Goudey
2024-11-14 12:49:28 +01:00
committed by Hans Goudey
parent c70e93bd5c
commit d364441220

View File

@@ -941,6 +941,13 @@ static void restore_list(bContext *C, Depsgraph *depsgraph, StepData &step_data)
mesh.tag_positions_changed();
BKE_sculptsession_free_deformMats(&ss);
}
else {
Mesh &mesh = *static_cast<Mesh *>(object.data);
/* The BVH normals recalculation that will happen later (caused by
* `pbvh.tag_positions_changed`) won't recalculate the face corner normals.
* We need to manually clear that cache. */
mesh.runtime->corner_normals_cache.tag_dirty();
}
bke::pbvh::update_bounds(*depsgraph, object, pbvh);
bke::pbvh::store_bounds_orig(pbvh);
break;