Page MenuHome

Outliner: avoid creating unnecessary undo steps
ClosedPublic

Authored by Germano Cavalcante (mano-wii) on Dec 20 2021, 9:11 PM.

Details

Summary

The OUTLINER_OT_item_activate operator, although it detects when
something changes, always returns OPERATOR_FINISHED and thus induces
the creation of undo steps.

This patch proposes to return OPERATOR_CANCELLED when nothing changes.

NOTE: Operator behavior was improved in rB9a9a663f40d55e1f94d23029ed3962b21f8aaca2 but the issue of undo steps was not considered.

Ref T94080

Diff Detail

Repository
rB Blender
Branch
master
Build Status
Buildable 19547
Build 19547: arc lint + arc unit

Event Timeline

Germano Cavalcante (mano-wii) requested review of this revision.Dec 20 2021, 9:11 PM
Germano Cavalcante (mano-wii) created this revision.
Julian Eisel (Severin) added inline comments.
source/blender/editors/space_outliner/outliner_select.c
1602

Better do changed |= ... here, in case somebody adds code above that modifies changed, so this wouldn't override that.

1650–1663

I'd just invert the order:

if (!changed) {
  return OPERATOR_CANCELLED;
}

...

return OPERATOR_FINISHED;
This revision is now accepted and ready to land.Jan 27 2022, 7:26 PM