diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-08-18 20:26:34 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-08-18 20:26:34 +0400 |
commit | 00426038d0dbf2821e091954cc6d694d786e6898 (patch) | |
tree | 4ae81490f1815e5410ef39e78cae9379a6ec2459 /source/blender/editors/interface | |
parent | feb83181437cd36b283ae6551f10045d1fdbedd5 (diff) |
disable undo for screen & wm RNA buttons, changing shading mode via the UI for eg was doing an undo push.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface.c | 11 |
1 files changed, 11 insertions, 0 deletions
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); |