Weight Paint: Allow property changes in the editor to create undo steps

Currently, no change to an RNA property invoked from the UI while inside
Weight Paint mode creates an undo step. This includes both tool
properties (e.g. brush size, tool settings) as well as mesh properties
(symmetry, active vertex group, selection mode).

This behavior was initially introduced to avoid creating extra undo
steps when painting or sculpting and changing tool settings, however,
it applied to all property changes performed while in any paint mode,
including changes to mesh datablock properties.

To fix this behavior, this commit simply removes Weight Paint from the
list of modes that have their own (legacy) undo system. This means it's
now covered by the regular memfile / global undo system.

This builds on !134548 and !134836.

Ref: #134220, #69760, and many others

Pull Request: https://projects.blender.org/blender/blender/pulls/135758
This commit is contained in:
Sean Kim
2025-03-18 22:05:54 +01:00
committed by Sean Kim
parent d6f88c757e
commit 96869d03d4

View File

@@ -415,9 +415,9 @@ bool ED_undo_is_legacy_compatible_for_property(bContext *C, ID *id, PointerRNA &
BKE_view_layer_synced_ensure(scene, view_layer);
Object *obact = BKE_view_layer_active_object_get(view_layer);
if (obact != nullptr) {
if (obact->mode & OB_MODE_ALL_PAINT) {
/* Don't store property changes when painting
* (only do undo pushes on brush strokes which each paint operator handles on its own). */
if (obact->mode & (OB_MODE_ALL_PAINT & ~OB_MODE_WEIGHT_PAINT)) {
/* For all non-weightpaint paint modes: Don't store property changes when painting.
* Weight Paint uses global undo, and thus doesn't need to be special-cased here. */
CLOG_INFO(&LOG, 1, "skipping undo for paint-mode");
return false;
}