diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-04-03 09:35:42 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-04-03 09:35:42 +0300 |
commit | a0eb54142f244641041b0cb317cd09171105ad72 (patch) | |
tree | bf730ea540d2b44ffdb9c29cb4d379eb295737ee /source/blender/editors/undo | |
parent | 31f2a6755db5bf9439e51701eddcadfca773459a (diff) |
Undo: replace global access w/ ED_undo_stack_get
While I'd like to avoid using this too much since the operator
system should handle.
It's less trouble than accessing it inline each time.
Diffstat (limited to 'source/blender/editors/undo')
-rw-r--r-- | source/blender/editors/undo/ed_undo.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c index 691ba066bf9..4f62e38dc0b 100644 --- a/source/blender/editors/undo/ed_undo.c +++ b/source/blender/editors/undo/ed_undo.c @@ -42,6 +42,7 @@ #include "BKE_blender_undo.h" #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BKE_screen.h" #include "BKE_undo_system.h" @@ -190,6 +191,19 @@ bool ED_undo_is_valid(const bContext *C, const char *undoname) return BKE_undosys_stack_has_undo(wm->undo_stack, undoname); } +/** + * Ideally we wont access the stack directly, + * this is needed for modes which handle undo themselves (bypassing #ED_undo_push). + * + * Using global isn't great, this just avoids doing inline, + * causing 'BKE_global.h' & 'BKE_main.h' includes. + */ +UndoStack *ED_undo_stack_get(void) +{ + wmWindowManager *wm = G.main->wm.first; + return wm->undo_stack; +} + /** \} */ /* -------------------------------------------------------------------- */ |