diff options
author | Germano Cavalcante <mano-wii> | 2022-01-27 21:30:22 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2022-01-27 21:41:40 +0300 |
commit | 3775615aeaf9d7f821053c9c19ee317233e9bd0a (patch) | |
tree | 75f4612759d6dbe329339e47f4298e87d628cbd3 /source/blender/editors/space_outliner | |
parent | a21f1e81e07f4664d78a177bd41c2a769c42a473 (diff) |
Outliner: avoid creating unnecessary undo steps
The `OUTLINER_OT_item_activate` operator, although it detects when
something changes, always returns `OPERATOR_FINISHED` and thus induces
the creation of undo steps.
So return `OPERATOR_CANCELLED` when nothing changes.
Ref T94080
Reviewed By: Severin
Maniphest Tasks: T94080
Differential Revision: https://developer.blender.org/D13638
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_select.cc | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/source/blender/editors/space_outliner/outliner_select.cc b/source/blender/editors/space_outliner/outliner_select.cc index 3ff8b9e973f..ebb4e529b04 100644 --- a/source/blender/editors/space_outliner/outliner_select.cc +++ b/source/blender/editors/space_outliner/outliner_select.cc @@ -1611,8 +1611,7 @@ static int outliner_item_do_activate_from_cursor(bContext *C, if (!(te = outliner_find_item_at_y(space_outliner, &space_outliner->tree, view_mval[1]))) { if (deselect_all) { - outliner_flag_set(&space_outliner->tree, TSE_SELECTED, false); - changed = true; + changed |= outliner_flag_set(&space_outliner->tree, TSE_SELECTED, false); } } /* Don't allow toggle on scene collection */ @@ -1660,17 +1659,19 @@ static int outliner_item_do_activate_from_cursor(bContext *C, changed = true; } - if (changed) { - if (rebuild_tree) { - ED_region_tag_redraw(region); - } - else { - ED_region_tag_redraw_no_rebuild(region); - } + if (!changed) { + return OPERATOR_CANCELLED; + } - ED_outliner_select_sync_from_outliner(C, space_outliner); + if (rebuild_tree) { + ED_region_tag_redraw(region); + } + else { + ED_region_tag_redraw_no_rebuild(region); } + ED_outliner_select_sync_from_outliner(C, space_outliner); + return OPERATOR_FINISHED; } |