PyAPI: rename undo memory usage method, improve doc-string

Ref !146095
This commit is contained in:
Namit Bhutani
2025-09-11 20:22:37 +05:30
committed by Campbell Barton
parent 1e2ed785f7
commit 2110391058
2 changed files with 8 additions and 8 deletions

View File

@@ -649,15 +649,15 @@ static PyObject *bpy_app_help_text(PyObject * /*self*/, PyObject *args, PyObject
#endif
PyDoc_STRVAR(
/* Wrap. */
bpy_app_undo_memory_info_doc,
".. staticmethod:: undo_memory_info()\n"
bpy_app_memory_usage_undo_doc,
".. staticmethod:: memory_usage_undo()\n"
"\n"
" Get undo memory usage information.\n"
"\n"
" :return: 'total_memory'.\n"
" :return: Memory usage of the undo stack in bytes.\n"
" :rtype: int\n");
static PyObject *bpy_app_undo_memory_info(PyObject * /*self*/, PyObject * /*args*/)
static PyObject *bpy_app_memory_usage_undo(PyObject * /*self*/, PyObject * /*args*/)
{
size_t total_memory = 0;
UndoStack *ustack = ED_undo_stack_get();
@@ -676,10 +676,10 @@ static PyMethodDef bpy_app_methods[] = {
(PyCFunction)bpy_app_help_text,
METH_VARARGS | METH_KEYWORDS | METH_STATIC,
bpy_app_help_text_doc},
{"undo_memory_info",
(PyCFunction)bpy_app_undo_memory_info,
{"memory_usage_undo",
(PyCFunction)bpy_app_memory_usage_undo,
METH_NOARGS | METH_STATIC,
bpy_app_undo_memory_info_doc},
bpy_app_memory_usage_undo_doc},
{nullptr, nullptr, 0, nullptr},
};

View File

@@ -182,7 +182,7 @@ def _run_brush_test(args: dict):
bpy.ops.sculpt.brush_stroke(stroke=generate_stroke(context_override), override_location=True)
bpy.ops.ed.undo_push()
measurements.append(time.time() - start)
memory_info = bpy.app.undo_memory_info()
memory_info = bpy.app.memory_usage_undo()
if len(measurements) >= min_measurements and (time.time() - total_time_start) > timeout:
break
if len(measurements) >= max_measurements: