From bb97131bb9f33fa0e61faabd466e76bc32cbf3f5 Mon Sep 17 00:00:00 2001 From: Sean Kim Date: Wed, 28 Aug 2024 20:51:10 +0200 Subject: [PATCH] Fix #126713: Sculpting with shape keys produces artifacts Brushes that were verified to be impacted by this: * Clay * Smooth * Cloth Brushes that were verified to not be impacted: * Draw * Blob There is some dependency within the brush code that expects that the `ss.deform_cos` variable is not updated during the middle of the stroke. This commit only deals with fixing the immediate user-facing issue, for a longer-term or more comprehensive fix, it is likely that these values should not be touched at all inside the `sculpt_update_object` function but should instead be initialized somewhere else so that the lifecycle is more obvious and maintainable. Pull Request: https://projects.blender.org/blender/blender/pulls/126803 --- source/blender/blenkernel/intern/paint.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/paint.cc b/source/blender/blenkernel/intern/paint.cc index 648d8d82eb0..b6a9f01f14f 100644 --- a/source/blender/blenkernel/intern/paint.cc +++ b/source/blender/blenkernel/intern/paint.cc @@ -2028,7 +2028,10 @@ static void sculpt_update_object(Depsgraph *depsgraph, } } - if (!used_me_eval) { + /* We depend on the deform coordinates not being updated in the middle of a stroke. This array + * eventually gets cleared inside BKE_sculpt_update_object_before_eval. + * See #126713 for more information. */ + if (ss.deform_cos.is_empty() && !used_me_eval) { BKE_sculptsession_free_deformMats(&ss); BKE_crazyspace_build_sculpt(depsgraph, scene, ob, ss.deform_imats, ss.deform_cos);