diff options
-rw-r--r-- | source/blender/blenkernel/BKE_global.h | 24 | ||||
-rw-r--r-- | source/blender/editors/undo/CMakeLists.txt | 1 | ||||
-rw-r--r-- | source/blender/editors/undo/ed_undo.c | 35 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_app.c | 1 |
4 files changed, 41 insertions, 20 deletions
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 7497a9f04e3..410c8bb3a65 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -120,14 +120,14 @@ typedef struct Global { /* G.debug */ enum { - G_DEBUG = (1 << 0), /* general debug flag, print more info in unexpected cases */ + G_DEBUG = (1 << 0), /* general debug flag, print more info in unexpected cases */ G_DEBUG_FFMPEG = (1 << 1), - G_DEBUG_PYTHON = (1 << 2), /* extra python info */ - G_DEBUG_EVENTS = (1 << 3), /* input/window/screen events */ - G_DEBUG_HANDLERS = (1 << 4), /* events handling */ - G_DEBUG_WM = (1 << 5), /* operator, undo */ - G_DEBUG_JOBS = (1 << 6), /* jobs time profiling */ - G_DEBUG_FREESTYLE = (1 << 7), /* freestyle messages */ + G_DEBUG_PYTHON = (1 << 2), /* extra python info */ + G_DEBUG_EVENTS = (1 << 3), /* input/window/screen events */ + G_DEBUG_HANDLERS = (1 << 4), /* events handling */ + G_DEBUG_WM = (1 << 5), /* operator, undo */ + G_DEBUG_JOBS = (1 << 6), /* jobs time profiling */ + G_DEBUG_FREESTYLE = (1 << 7), /* freestyle messages */ G_DEBUG_DEPSGRAPH_BUILD = (1 << 8), /* depsgraph construction messages */ G_DEBUG_DEPSGRAPH_EVAL = (1 << 9), /* depsgraph evaluation messages */ G_DEBUG_DEPSGRAPH_TAG = (1 << 10), /* depsgraph tagging messages */ @@ -138,11 +138,11 @@ enum { G_DEBUG_DEPSGRAPH_EVAL | G_DEBUG_DEPSGRAPH_TAG | G_DEBUG_DEPSGRAPH_TIME), - G_DEBUG_SIMDATA = (1 << 14), /* sim debug data display */ - G_DEBUG_GPU_MEM = (1 << 15), /* gpu memory in status bar */ - G_DEBUG_GPU = (1 << 16), /* gpu debug */ - G_DEBUG_IO = (1 << 17), /* IO Debugging (for Collada, ...)*/ - G_DEBUG_GPU_SHADERS = (1 << 18), /* GLSL shaders */ + G_DEBUG_SIMDATA = (1 << 14), /* sim debug data display */ + G_DEBUG_GPU_MEM = (1 << 15), /* gpu memory in status bar */ + G_DEBUG_GPU = (1 << 16), /* gpu debug */ + G_DEBUG_IO = (1 << 17), /* IO Debugging (for Collada, ...)*/ + G_DEBUG_GPU_SHADERS = (1 << 18), /* GLSL shaders */ }; #define G_DEBUG_ALL (G_DEBUG | G_DEBUG_FFMPEG | G_DEBUG_PYTHON | G_DEBUG_EVENTS | G_DEBUG_WM | G_DEBUG_JOBS | \ 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); diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index dde647793b0..3aad4dcde34 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -374,6 +374,7 @@ static PyGetSetDef bpy_app_getsets[] = { {(char *)"debug_depsgraph_pretty", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_DEPSGRAPH_PRETTY}, {(char *)"debug_simdata", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_SIMDATA}, {(char *)"debug_gpumem", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_GPU_MEM}, + {(char *)"debug_io", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_IO}, {(char *)"binary_path_python", bpy_app_binary_path_python_get, NULL, (char *)bpy_app_binary_path_python_doc, NULL}, |