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
This commit is contained in:
Sean Kim
2024-08-09 22:34:25 +02:00
committed by Sean Kim
parent ae13fb5a53
commit 810fee35f3

View File

@@ -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<Mesh *>(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);
}