From 810fee35f33f754731598db0ed29bfdbf2ef1bf3 Mon Sep 17 00:00:00 2001 From: Sean Kim Date: Fri, 9 Aug 2024 22:34:25 +0200 Subject: [PATCH] Fix #126074: Sculping on a non-basis shape key modifies mesh This commit prevents writing to the mesh when sculpting on a non-basis shape key. Prior to this, we incorrectly were applying changes to the base mesh, even though those changes were not visible with the shape keys still active, causing new shape keys to have a copy of the deformed mesh data. Pull Request: https://projects.blender.org/blender/blender/pulls/126107 --- source/blender/editors/sculpt_paint/sculpt.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/sculpt_paint/sculpt.cc b/source/blender/editors/sculpt_paint/sculpt.cc index bdc9e9f8627..f5e0569e2d6 100644 --- a/source/blender/editors/sculpt_paint/sculpt.cc +++ b/source/blender/editors/sculpt_paint/sculpt.cc @@ -7346,7 +7346,13 @@ void write_translations(const Sculpt &sd, apply_crazyspace_to_translations(ss.deform_imats, verts, translations); } - apply_translations(translations, verts, positions_orig); + const Mesh &mesh = *static_cast(object.data); + const KeyBlock *active_key = BKE_keyblock_from_object(&object); + const bool relative_shapekey_active = active_key != nullptr && active_key != mesh.key->refkey; + if (!relative_shapekey_active) { + apply_translations(translations, verts, positions_orig); + } + apply_translations_to_shape_keys(object, verts, translations, positions_orig); }