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>2020-05-11 15:01:53 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-05-11 15:20:51 +0300
commit815855b91b9525e98894bcc61f6bafb6e205c86f (patch)
tree8fb68c1596273b084884853f93a3d65fdd2c99a9 /source/blender/blenkernel/intern/undo_system.c
parent3d3a75fc2a6b105cd4ccc758e7da026dcf6daf43 (diff)
Fix T76642: Incorrect behavior limiting undo steps
Diffstat (limited to 'source/blender/blenkernel/intern/undo_system.c')
-rw-r--r--source/blender/blenkernel/intern/undo_system.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/source/blender/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c
index e776e9bedb0..33a457386e8 100644
--- a/source/blender/blenkernel/intern/undo_system.c
+++ b/source/blender/blenkernel/intern/undo_system.c
@@ -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 {