From 00426038d0dbf2821e091954cc6d694d786e6898 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 18 Aug 2011 16:26:34 +0000 Subject: disable undo for screen & wm RNA buttons, changing shading mode via the UI for eg was doing an undo push. --- source/blender/editors/interface/interface.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source/blender/editors/interface') diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index e31e3a26b40..3bd50074d84 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -2636,6 +2636,17 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s UI_DEF_BUT_RNA_DISABLE(but); } + /* avoid undo push for buttons who's ID are screen or wm level + * we could disable undo for buttons with no ID too but but may have + * unforseen conciquences, so best check for ID's we _know_ are not + * handled by undo - campbell */ + if (but->flag & UI_BUT_UNDO) { + ID *id= ptr->id.data; + if(id && ELEM(GS(id->name), ID_SCR, ID_WM)) { + but->flag &= ~UI_BUT_UNDO; + } + } + /* If this button uses units, calculate the step from this */ if(ui_is_but_unit(but)) but->a1= ui_get_but_step_unit(but, but->a1); -- cgit v1.2.3