Fix #36748 Sculpting/image painting does not respect undo steps limit.

A simple oversight here, it should work as intended now.

Nice to have it functional for people who might hate dyntopo undo with a
passion.
This commit is contained in:
Antony Riakiotakis
2013-09-17 12:11:00 +00:00
parent b35f1eaa84
commit 40b5b66527

View File

@@ -124,6 +124,30 @@ static void undo_stack_push_end(UndoStack *stack)
{
UndoElem *uel;
uintptr_t totmem, maxmem;
int totundo = 0;
/* first limit to undo steps */
uel = stack->elems.last;
while (uel) {
totundo++;
if (totundo > U.undosteps) break;
uel = uel->prev;
}
if (uel) {
UndoElem *first;
/* in case the undo steps are zero, the current pointer will be invalid */
if (uel == stack->current)
stack->current = NULL;
do {
first = stack->elems.first;
undo_elem_free(stack, first);
BLI_freelinkN(&stack->elems, first);
} while (first != uel);
}
if (U.undomemory != 0) {
/* limit to maximum memory (afterwards, we can't know in advance) */