[Bf-blender-cvs] [3775615aeaf] master: Outliner: avoid creating unnecessary undo steps
Germano Cavalcante
noreply at git.blender.org
Thu Jan 27 19:42:39 CET 2022
Commit: 3775615aeaf9d7f821053c9c19ee317233e9bd0a
Author: Germano Cavalcante
Date: Thu Jan 27 15:30:22 2022 -0300
Branches: master
https://developer.blender.org/rB3775615aeaf9d7f821053c9c19ee317233e9bd0a
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
===================================================================
M source/blender/editors/space_outliner/outliner_select.cc
===================================================================
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;
}
More information about the Bf-blender-cvs
mailing list