Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGermano Cavalcante <mano-wii>2022-01-27 21:30:22 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2022-01-27 21:41:40 +0300
commit3775615aeaf9d7f821053c9c19ee317233e9bd0a (patch)
tree75f4612759d6dbe329339e47f4298e87d628cbd3
parenta21f1e81e07f4664d78a177bd41c2a769c42a473 (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
-rw-r--r--source/blender/editors/space_outliner/outliner_select.cc21
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;
}