diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-15 20:53:34 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-15 20:53:34 +0300 |
commit | 599bf05c5683e0314e4dfdf03b21246fe99f7056 (patch) | |
tree | 0c95c7aa81fb4568ed4a4cf73aac3fdcb7eb3937 | |
parent | bf0d16e30ebd692d2e9ce8b5251ffa467e3fed7d (diff) | |
parent | 4461be1b722a4f6e5af4854eb12023b3670a4c3d (diff) |
Merge branch 'master' into blender2.8
-rw-r--r-- | source/blender/blenkernel/BKE_undo_system.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/undo_system.c | 9 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 21 |
3 files changed, 21 insertions, 10 deletions
diff --git a/source/blender/blenkernel/BKE_undo_system.h b/source/blender/blenkernel/BKE_undo_system.h index 53ea8ddefe8..05093deec70 100644 --- a/source/blender/blenkernel/BKE_undo_system.h +++ b/source/blender/blenkernel/BKE_undo_system.h @@ -137,6 +137,7 @@ void BKE_undosys_stack_destroy(UndoStack *ustack); void BKE_undosys_stack_clear(UndoStack *ustack); bool BKE_undosys_stack_has_undo(UndoStack *ustack, const char *name); void BKE_undosys_stack_init_from_main(UndoStack *ustack, struct Main *bmain); +void BKE_undosys_stack_init_from_context(UndoStack *ustack, struct bContext *C); UndoStep *BKE_undosys_stack_active_with_type(UndoStack *ustack, const UndoType *ut); UndoStep *BKE_undosys_stack_init_or_active_with_type(UndoStack *ustack, const UndoType *ut); void BKE_undosys_stack_limit_steps_and_memory(UndoStack *ustack, int steps, size_t memory_limit); diff --git a/source/blender/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c index 62710240109..f5e4c354a02 100644 --- a/source/blender/blenkernel/intern/undo_system.c +++ b/source/blender/blenkernel/intern/undo_system.c @@ -252,6 +252,15 @@ void BKE_undosys_stack_init_from_main(UndoStack *ustack, struct Main *bmain) undosys_stack_push_main(ustack, "original", bmain); } +/* called after 'BKE_undosys_stack_init_from_main' */ +void BKE_undosys_stack_init_from_context(UndoStack *ustack, bContext *C) +{ + const UndoType *ut = BKE_undosys_type_from_context(C); + if ((ut != NULL) && (ut != BKE_UNDOSYS_TYPE_MEMFILE) && (ut->mode == BKE_UNDOTYPE_MODE_STORE)) { + BKE_undosys_step_push_with_type(ustack, C, "original mode", ut); + } +} + /* name optional */ bool BKE_undosys_stack_has_undo(UndoStack *ustack, const char *name) { diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index efb3d0e7461..721ea158d51 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -526,16 +526,6 @@ static void wm_file_read_post(bContext *C, const bool is_startup_file, const boo } if (!G.background) { - /* in background mode this makes it hard to load - * a blend file and do anything since the screen - * won't be set to a valid value again */ - CTX_wm_window_set(C, NULL); /* exits queues */ - - /* Ensure tools are registered. */ - WM_toolsystem_init(C); - } - - if (!G.background) { if (wm->undo_stack == NULL) { wm->undo_stack = BKE_undosys_stack_create(); } @@ -543,6 +533,17 @@ static void wm_file_read_post(bContext *C, const bool is_startup_file, const boo BKE_undosys_stack_clear(wm->undo_stack); } BKE_undosys_stack_init_from_main(wm->undo_stack, CTX_data_main(C)); + BKE_undosys_stack_init_from_context(wm->undo_stack, C); + } + + if (!G.background) { + /* in background mode this makes it hard to load + * a blend file and do anything since the screen + * won't be set to a valid value again */ + CTX_wm_window_set(C, NULL); /* exits queues */ + + /* Ensure tools are registered. */ + WM_toolsystem_init(C); } } |