diff --git a/source/blender/editors/include/ED_undo.hh b/source/blender/editors/include/ED_undo.hh index 00e6364dafe..6feda6107e8 100644 --- a/source/blender/editors/include/ED_undo.hh +++ b/source/blender/editors/include/ED_undo.hh @@ -157,4 +157,4 @@ void ED_undosys_stack_memfile_id_changed_tag(UndoStack *ustack, ID *id); * * \return Total memory usage in bytes, or 0 if no undo stack is available. */ -size_t ED_get_total_undo_memory(); +size_t ED_undosys_total_memory_calc(UndoStack *ustack); diff --git a/source/blender/editors/undo/ed_undo.cc b/source/blender/editors/undo/ed_undo.cc index c6f4595f939..1b82889b216 100644 --- a/source/blender/editors/undo/ed_undo.cc +++ b/source/blender/editors/undo/ed_undo.cc @@ -913,13 +913,8 @@ Vector ED_undo_editmode_bases_from_view_layer(const Scene *scene, ViewLa return bases; } -size_t ED_get_total_undo_memory() +size_t ED_undosys_total_memory_calc(UndoStack *ustack) { - UndoStack *ustack = ED_undo_stack_get(); - if (!ustack) { - return 0; - } - size_t total_memory = 0; for (UndoStep *us = static_cast(ustack->steps.first); us != nullptr; us = us->next) { diff --git a/source/blender/python/intern/bpy_app.cc b/source/blender/python/intern/bpy_app.cc index 54be5ad97d9..0c19d90a634 100644 --- a/source/blender/python/intern/bpy_app.cc +++ b/source/blender/python/intern/bpy_app.cc @@ -659,9 +659,11 @@ PyDoc_STRVAR( static PyObject *bpy_app_undo_memory_info(PyObject * /*self*/, PyObject * /*args*/) { - - size_t total_memory = ED_get_total_undo_memory(); - + size_t total_memory = 0; + UndoStack *ustack = ED_undo_stack_get(); + if (ustack) { + total_memory = ED_undosys_total_memory_calc(ustack); + } return PyLong_FromSize_t(total_memory); }