Fix #126074: Sculping on a non-basis shape key modifies mesh #126107
@ -7315,7 +7315,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);
|
||||
Sean-Kim marked this conversation as resolved
Outdated
|
||||
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);
|
||||
Sean-Kim marked this conversation as resolved
Hans Goudey
commented
This comment says exactly what the code says (due to your helpful variable name); I don't think it's helpful. Generally this sort of comment makes it feel like the code is brittle, and code should document itself, making this sort of "what is happening" comment generally unnecessary. This comment says exactly what the code says (due to your helpful variable name); I don't think it's helpful. Generally this sort of comment makes it feel like the code is brittle, and code should document itself, making this sort of "what is happening" comment generally unnecessary.
Sean Kim
commented
Yeah, that's fair. I was trying to think of more descriptive / "why" things to put here since this did cause a bug, but I agree that as is this is just duplicated info. Yeah, that's fair. I was trying to think of more descriptive / "why" things to put here since this did cause a bug, but I agree that as is this is just duplicated info.
|
||||
}
|
||||
|
||||
apply_translations_to_shape_keys(object, verts, translations, positions_orig);
|
||||
}
|
||||
Hans Goudey
commented
The The `apply_translations_to_shape_keys` abstraction breaks down a bit now. I don't have a strong opinion for whether to do this now or later, but I'd probably remove the function and put it in here.
Sean Kim
commented
I'll follow up on this afterwards; there's another place that I'll follow up on this afterwards; there's another place that `apply_translations_to_shape_keys` is used in the undo code, so I don't want to clutter this fix with that cleanup.
Hans Goudey
commented
Sounds good, thanks! Sounds good, thanks!
|
||||
|
||||
|
Can be const/
Same for key