diff options
author | Julian Eisel <julian@blender.org> | 2021-10-08 13:27:46 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-10-08 13:35:19 +0300 |
commit | 04ad42d83bf74f679a4de2e29ee98eb6e97ce996 (patch) | |
tree | 2d077587cdd89b58e01978a19a4c6705be9a58f9 /source/blender/editors/interface | |
parent | 5da58f48ae0a429eb2aa5745362f8c7ee9c165a7 (diff) |
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.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/tree_view.cc | 2 |
1 files changed, 2 insertions, 0 deletions
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); |