Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-02-04 07:01:55 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-02-04 07:01:55 +0300
commit55c29e36dccddc7ae8c6512b6dec074437214097 (patch)
tree0d439554dea0e226c01f8b2969f33f6b32b656c1
parentb5c841498c468771219b89c6b58bc751ee4e2472 (diff)
Undo System: add function to print undo steps
Useful for debugging.
-rw-r--r--source/blender/blenkernel/BKE_undo_system.h2
-rw-r--r--source/blender/blenkernel/intern/undo_system.c24
-rw-r--r--source/blender/makesrna/intern/rna_wm_api.c7
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)