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
This commit is contained in:
Sean Kim
2024-08-28 20:51:10 +02:00
committed by Sean Kim
parent 08c0f1adcb
commit bb97131bb9

View File

@@ -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);