[Bf-blender-cvs] [04ad42d83bf] master: UI/Assets: Disable undo for tree item buttons
Julian Eisel
noreply at git.blender.org
Fri Oct 8 12:35:33 CEST 2021
Commit: 04ad42d83bf74f679a4de2e29ee98eb6e97ce996
Author: Julian Eisel
Date: Fri Oct 8 12:27:46 2021 +0200
Branches: master
https://developer.blender.org/rB04ad42d83bf74f679a4de2e29ee98eb6e97ce996
UI/Assets: Disable undo for tree item buttons
Disables undo for:
* The tree row collapsing - which doesn't make sense to undo, isn't
supported by the undo system, and just triggers the confirmation
prompt when closing the file.
* Renaming items - While this may make sense in some cases, users of the
tree-view API can explicitly do an undo push. For asset catalogs it's
not supported.
===================================================================
M source/blender/editors/interface/tree_view.cc
===================================================================
diff --git a/source/blender/editors/interface/tree_view.cc b/source/blender/editors/interface/tree_view.cc
index 8ac69f862c8..3f66810b7f6 100644
--- a/source/blender/editors/interface/tree_view.cc
+++ b/source/blender/editors/interface/tree_view.cc
@@ -246,6 +246,7 @@ void AbstractTreeViewItem::add_collapse_chevron(uiBlock &block) const
&block, UI_BTYPE_BUT_TOGGLE, 0, icon, 0, 0, UI_UNIT_X, UI_UNIT_Y, nullptr, 0, 0, 0, 0, "");
/* Note that we're passing the tree-row button here, not the chevron one. */
UI_but_func_set(but, collapse_chevron_click_fn, nullptr, nullptr);
+ UI_but_flag_disable(but, UI_BUT_UNDO);
/* Check if the query for the button matches the created button. */
BLI_assert(is_collapse_chevron_but(but));
@@ -313,6 +314,7 @@ void AbstractTreeViewItem::add_rename_button(uiLayout &row)
/* Gotta be careful with what's passed to the `arg1` here. Any tree data will be freed once the
* callback is executed. */
UI_but_func_rename_set(rename_but, AbstractTreeViewItem::rename_button_fn, rename_but);
+ UI_but_flag_disable(rename_but, UI_BUT_UNDO);
const bContext *evil_C = static_cast<bContext *>(block->evil_C);
ARegion *region = CTX_wm_region(evil_C);
More information about the Bf-blender-cvs
mailing list