From d364441220119abc184df60cd4086dec0d06dd4f Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Thu, 14 Nov 2024 12:49:28 +0100 Subject: [PATCH] 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 --- source/blender/editors/sculpt_paint/sculpt_undo.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.cc b/source/blender/editors/sculpt_paint/sculpt_undo.cc index a7c216cd94a..2cdf377fee6 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.cc +++ b/source/blender/editors/sculpt_paint/sculpt_undo.cc @@ -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(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;