Fix T76642: Incorrect behavior limiting undo steps
This commit is contained in:
parent
3d3a75fc2a
commit
815855b91b
Notes:
blender-bot
2023-02-14 06:54:28 +01:00
Referenced by issue #76642, Confusing undo steps limit behavior
|
@ -427,10 +427,6 @@ void BKE_undosys_stack_limit_steps_and_memory(UndoStack *ustack, int steps, size
|
|||
}
|
||||
|
||||
if (us) {
|
||||
if (us->prev && us->prev->prev) {
|
||||
us = us->prev;
|
||||
}
|
||||
|
||||
#ifdef WITH_GLOBAL_UNDO_KEEP_ONE
|
||||
/* Hack, we need to keep at least one BKE_UNDOSYS_TYPE_MEMFILE. */
|
||||
if (us->type != BKE_UNDOSYS_TYPE_MEMFILE) {
|
||||
|
@ -438,6 +434,12 @@ void BKE_undosys_stack_limit_steps_and_memory(UndoStack *ustack, int steps, size
|
|||
while (us_exclude && us_exclude->type != BKE_UNDOSYS_TYPE_MEMFILE) {
|
||||
us_exclude = us_exclude->prev;
|
||||
}
|
||||
/* Once this is outside the given number of 'steps', undoing onto this state
|
||||
* may skip past many undo steps which is confusing, instead,
|
||||
* disallow stepping onto this state entirely. */
|
||||
if (us_exclude) {
|
||||
us_exclude->skip = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* Free from first to last, free functions may update de-duplication info
|
||||
|
@ -672,7 +674,15 @@ bool BKE_undosys_step_undo_with_data_ex(UndoStack *ustack,
|
|||
us = us_prev;
|
||||
}
|
||||
|
||||
if (us != NULL) {
|
||||
/* This will be active once complete. */
|
||||
UndoStep *us_active = us_prev;
|
||||
if (use_skip) {
|
||||
while (us_active && us_active->skip) {
|
||||
us_active = us_active->prev;
|
||||
}
|
||||
}
|
||||
|
||||
if ((us != NULL) && (us_active != NULL)) {
|
||||
CLOG_INFO(&LOG, 1, "addr=%p, name='%s', type='%s'", us, us->name, us->type->name);
|
||||
|
||||
/* Handle accumulate steps. */
|
||||
|
@ -689,13 +699,6 @@ bool BKE_undosys_step_undo_with_data_ex(UndoStack *ustack,
|
|||
}
|
||||
}
|
||||
|
||||
UndoStep *us_active = us_prev;
|
||||
if (use_skip) {
|
||||
while (us_active->skip && us_active->prev) {
|
||||
us_active = us_active->prev;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
UndoStep *us_iter = us_prev;
|
||||
do {
|
||||
|
@ -744,7 +747,15 @@ bool BKE_undosys_step_redo_with_data_ex(UndoStack *ustack,
|
|||
/* Unlike undo accumulate, we always use the next. */
|
||||
us = us_next;
|
||||
|
||||
if (us != NULL) {
|
||||
/* This will be active once complete. */
|
||||
UndoStep *us_active = us_next;
|
||||
if (use_skip) {
|
||||
while (us_active && us_active->skip) {
|
||||
us_active = us_active->next;
|
||||
}
|
||||
}
|
||||
|
||||
if ((us != NULL) && (us_active != NULL)) {
|
||||
CLOG_INFO(&LOG, 1, "addr=%p, name='%s', type='%s'", us, us->name, us->type->name);
|
||||
|
||||
/* Handle accumulate steps. */
|
||||
|
@ -756,13 +767,6 @@ bool BKE_undosys_step_redo_with_data_ex(UndoStack *ustack,
|
|||
}
|
||||
}
|
||||
|
||||
UndoStep *us_active = us_next;
|
||||
if (use_skip) {
|
||||
while (us_active->skip && us_active->prev) {
|
||||
us_active = us_active->next;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
UndoStep *us_iter = us_next;
|
||||
do {
|
||||
|
|
Loading…
Reference in New Issue