From 3775615aeaf9d7f821053c9c19ee317233e9bd0a Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Thu, 27 Jan 2022 15:30:22 -0300 Subject: 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 --- .../editors/space_outliner/outliner_select.cc | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'source/blender/editors/space_outliner') 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; } -- cgit v1.2.3