diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-10-17 17:50:09 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-10-17 17:50:36 +0300 |
commit | d31ea3b89aa8d583a6d089f96dff46c0759f8c8a (patch) | |
tree | 9d24890a0d783b907b8064ec3643a001d0a91048 /source/blender/editors | |
parent | 938aa52313bba9bd001ea3e9a697658d12e3308e (diff) | |
parent | 5f8222501c2267ae82829ccf6f6df295a8b8ec55 (diff) |
Merge branch 'master' into blender2.8
Conflicts:
source/blender/blenkernel/BKE_global.h
source/blender/editors/undo/ed_undo.c
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/undo/CMakeLists.txt | 1 | ||||
-rw-r--r-- | source/blender/editors/undo/ed_undo.c | 35 |
2 files changed, 28 insertions, 8 deletions
diff --git a/source/blender/editors/undo/CMakeLists.txt b/source/blender/editors/undo/CMakeLists.txt index 89832604ed8..2e3e73f34f4 100644 --- a/source/blender/editors/undo/CMakeLists.txt +++ b/source/blender/editors/undo/CMakeLists.txt @@ -22,6 +22,7 @@ set(INC ../include ../../blenkernel ../../blenlib + ../../blenloader ../../blentranslation ../../makesdna ../../makesrna diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c index 515e96db25d..1d5c57a39b4 100644 --- a/source/blender/editors/undo/ed_undo.c +++ b/source/blender/editors/undo/ed_undo.c @@ -48,6 +48,7 @@ #include "BKE_context.h" #include "BKE_global.h" #include "BKE_main.h" +#include "BKE_report.h" #include "BKE_scene.h" #include "BKE_screen.h" #include "BKE_layer.h" @@ -55,6 +56,8 @@ #include "BKE_workspace.h" #include "BKE_paint.h" +#include "BLO_writefile.h" + #include "ED_gpencil.h" #include "ED_render.h" #include "ED_object.h" @@ -108,7 +111,7 @@ void ED_undo_push(bContext *C, const char *str) } /* note: also check undo_history_exec() in bottom if you change notifiers */ -static int ed_undo_step(bContext *C, int step, const char *undoname) +static int ed_undo_step(bContext *C, int step, const char *undoname, ReportList *reports) { CLOG_INFO(&LOG, 1, "name='%s', step=%d", undoname, step); wmWindowManager *wm = CTX_wm_manager(C); @@ -119,6 +122,14 @@ static int ed_undo_step(bContext *C, int step, const char *undoname) * or they can just lead to freezing job in some other cases */ WM_jobs_kill_all(wm); + if (G.debug & G_DEBUG_IO) { + Main *bmain = CTX_data_main(C); + if (bmain->lock != NULL) { + BKE_report(reports, RPT_INFO, "Checking sanity of current .blend file *BEFORE* undo step."); + BLO_main_validate_libraries(bmain, reports); + } + } + /* TODO(campbell): undo_system: use undo system */ /* grease pencil can be can be used in plenty of spaces, so check it first */ if (ED_gpencil_session_active()) { @@ -192,6 +203,14 @@ static int ed_undo_step(bContext *C, int step, const char *undoname) wm->op_undo_depth--; } + if (G.debug & G_DEBUG_IO) { + Main *bmain = CTX_data_main(C); + if (bmain->lock != NULL) { + BKE_report(reports, RPT_INFO, "Checking sanity of current .blend file *AFTER* undo step."); + BLO_main_validate_libraries(bmain, reports); + } + } + WM_event_add_notifier(C, NC_WINDOW, NULL); WM_event_add_notifier(C, NC_WM | ND_UNDO, NULL); @@ -216,11 +235,11 @@ void ED_undo_grouped_push(bContext *C, const char *str) void ED_undo_pop(bContext *C) { - ed_undo_step(C, 1, NULL); + ed_undo_step(C, 1, NULL, NULL); } void ED_undo_redo(bContext *C) { - ed_undo_step(C, -1, NULL); + ed_undo_step(C, -1, NULL, NULL); } void ED_undo_push_op(bContext *C, wmOperator *op) @@ -242,7 +261,7 @@ void ED_undo_grouped_push_op(bContext *C, wmOperator *op) void ED_undo_pop_op(bContext *C, wmOperator *op) { /* search back a couple of undo's, in case something else added pushes */ - ed_undo_step(C, 0, op->type->name); + ed_undo_step(C, 0, op->type->name, op->reports); } /* name optionally, function used to check for operator redo panel */ @@ -271,11 +290,11 @@ UndoStack *ED_undo_stack_get(void) /** \name Undo, Undo Push & Redo Operators * \{ */ -static int ed_undo_exec(bContext *C, wmOperator *UNUSED(op)) +static int ed_undo_exec(bContext *C, wmOperator *op) { /* "last operator" should disappear, later we can tie this with undo stack nicer */ WM_operator_stack_clear(CTX_wm_manager(C)); - int ret = ed_undo_step(C, 1, NULL); + int ret = ed_undo_step(C, 1, NULL, op->reports); if (ret & OPERATOR_FINISHED) { /* Keep button under the cursor active. */ WM_event_add_mousemove(C); @@ -291,9 +310,9 @@ static int ed_undo_push_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int ed_redo_exec(bContext *C, wmOperator *UNUSED(op)) +static int ed_redo_exec(bContext *C, wmOperator *op) { - int ret = ed_undo_step(C, -1, NULL); + int ret = ed_undo_step(C, -1, NULL, op->reports); if (ret & OPERATOR_FINISHED) { /* Keep button under the cursor active. */ WM_event_add_mousemove(C); |