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.
This commit is contained in:
parent
5da58f48ae
commit
04ad42d83b
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue