diff options
Diffstat (limited to 'source/blender/editors/util/ed_util.c')
-rw-r--r-- | source/blender/editors/util/ed_util.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index 7a5b8bfbda1..4bec0d9f114 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -62,6 +62,7 @@ #include "BKE_screen.h" #include "BKE_workspace.h" #include "BKE_layer.h" +#include "BKE_undo_system.h" #include "ED_armature.h" #include "ED_buttons.h" @@ -93,13 +94,16 @@ void ED_editors_init(bContext *C) { wmWindowManager *wm = CTX_wm_manager(C); + if (wm->undo_stack == NULL) { + wm->undo_stack = BKE_undosys_stack_create(); + } + /* This is called during initialization, so we don't want to store any reports */ ReportList *reports = CTX_wm_reports(C); int reports_flag_prev = reports->flag & ~RPT_STORE; SWAP(int, reports->flag, reports_flag_prev); - /* toggle on modes for objects that were saved with these enabled. for * e.g. linked objects we have to ensure that they are actually the * active object in this scene. */ @@ -150,10 +154,16 @@ void ED_editors_exit(bContext *C) if (!bmain) return; - + /* frees all editmode undos */ - undo_editmode_clear(); - ED_undo_paint_free(); + if (G.main->wm.first) { + wmWindowManager *wm = G.main->wm.first; + /* normally we don't check for NULL undo stack, do here since it may run in different context. */ + if (wm->undo_stack) { + BKE_undosys_stack_destroy(wm->undo_stack); + wm->undo_stack = NULL; + } + } for (Object *ob = bmain->object.first; ob; ob = ob->id.next) { if (ob->type == OB_MESH) { |