Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-04-03 09:35:42 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-04-03 09:35:42 +0300
commita0eb54142f244641041b0cb317cd09171105ad72 (patch)
treebf730ea540d2b44ffdb9c29cb4d379eb295737ee /source/blender/editors/undo/ed_undo.c
parent31f2a6755db5bf9439e51701eddcadfca773459a (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/ed_undo.c')
-rw-r--r--source/blender/editors/undo/ed_undo.c14
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;
+}
+
/** \} */
/* -------------------------------------------------------------------- */