Page MenuHome

Fix T89996: Resetting multi-button doesn't work
AbandonedPublic

Authored by Falk David (filedescriptor) on Jul 22 2021, 5:28 PM.

Details

Summary

Multi-button value editing would cancel when the entered number in the
active field was the same, even when the other values were not. E.g. a
multi-button with values [0.0, 1.0, 2.0] would not change it's value when
the user tried to drag (from the first field) downwards to multi-edit
and then type 0 (or any other value equivalent to 0).

This was because the optimization in rBeb06ccc32462 did not consider
multi-editing. The patch fixes this by comparing origvalue in the
uiButMultiState for all buttons in the block to the entered value.
If the values are the same, the operation is canceled (since we can be
sure that no update is required since no value changed).

An alternative to this patch would be to skip the optimization if
data->multi_data.has_mbuts is true. Although this would always
trigger an update, even if it might be unnecessary.

Diff Detail

Repository
rB Blender
Branch
T89996 (branched from master)
Build Status
Buildable 15963
Build 15963: arc lint + arc unit

Event Timeline

Falk David (filedescriptor) requested review of this revision.Jul 22 2021, 5:28 PM
Falk David (filedescriptor) created this revision.

Testing this optimization and think it causes more trouble than it's worth since it also conflicts with multi object value editing.

Holding Alt when editing number values.

When pressing enter on an unchanged value the objects update as expected, however the undo push is not sent, causing undo immediately after to undo two steps.

Campbell Barton (campbellbarton) requested changes to this revision.Aug 23 2021, 1:09 PM
This revision now requires changes to proceed.Aug 23 2021, 1:09 PM

I'll abandon this revision now that the original commit was reverted in rB3bf10e5.

I left a code comment there suggesting to implement this at the RNA set/update level, it's too fragile to reliably which updates may or may not be required at this level of the code.