diff options
-rw-r--r-- | source/blender/blenkernel/BKE_undo_system.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/undo_system.c | 24 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_wm_api.c | 7 |
3 files changed, 33 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_undo_system.h b/source/blender/blenkernel/BKE_undo_system.h index 5eac1b4f7a3..2b1c67f372b 100644 --- a/source/blender/blenkernel/BKE_undo_system.h +++ b/source/blender/blenkernel/BKE_undo_system.h @@ -200,4 +200,6 @@ void BKE_undosys_ID_map_foreach_ID_ref( struct UndoIDPtrMap *map, UndoTypeForEachIDRefFn foreach_ID_ref_fn, void *user_data); +void BKE_undosys_print(UndoStack *ustack); + #endif /* __BKE_UNDO_SYSTEM_H__ */ diff --git a/source/blender/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c index 0969a3299b9..f56dd953283 100644 --- a/source/blender/blenkernel/intern/undo_system.c +++ b/source/blender/blenkernel/intern/undo_system.c @@ -1002,3 +1002,27 @@ ID *BKE_undosys_ID_map_lookup_with_prev(const UndoIDPtrMap *map, ID *id_src, ID } /** \} */ + + +/* -------------------------------------------------------------------- */ +/** \name Debug Helpers + * \{ */ + +void BKE_undosys_print(UndoStack *ustack) +{ + printf("Undo %d Steps (A: active, M=memfile-active, S=skip)\n", + BLI_listbase_count(&ustack->steps)); + int index = 0; + for (UndoStep *us = ustack->steps.first; us; us = us->next) { + printf("[%c%c%c] %3d type='%s', name='%s'\n", + (us == ustack->step_active) ? 'A' : '_', + (us == ustack->step_active_memfile) ? 'M' : '_', + us->skip ? 'S' : '_', + index, + us->type->name, + us->name); + index++; + } +} + +/** \} */ diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index 4e87d06db80..0fffadfa158 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -66,6 +66,7 @@ const EnumPropertyItem rna_enum_window_cursor_items[] = { #ifdef RNA_RUNTIME #include "BKE_context.h" +#include "BKE_undo_system.h" #include "WM_types.h" @@ -457,6 +458,11 @@ static void rna_PieMenuEnd(bContext *C, PointerRNA *handle) UI_pie_menu_end(C, handle->data); } +static void rna_WindowManager_print_undo_steps(wmWindowManager *wm) +{ + BKE_undosys_print(wm->undo_stack); +} + static PointerRNA rna_WindoManager_operator_properties_last(const char *idname) { wmOperatorType *ot = WM_operatortype_find(idname, true); @@ -783,6 +789,7 @@ void RNA_api_wm(StructRNA *srna) RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR); RNA_def_function_return(func, parm); + RNA_def_function(srna, "print_undo_steps", "rna_WindowManager_print_undo_steps"); } void RNA_api_operator(StructRNA *srna) |