diff options
author | Campbell Barton <campbell@blender.org> | 2022-01-19 05:20:35 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-01-19 05:25:10 +0300 |
commit | 7e3b1e2c8f9f5d95692d37707506d790c5b503f7 (patch) | |
tree | f4ded1608c491e14d0a4c87e22ec9d008a08e423 /source/blender/editors/space_topbar | |
parent | 2e5aecf557fb6bc9fe9c652e692905feb1bde484 (diff) |
Fix flipped order of items in the "Undo History" menu
Error in 0e1bb232e68ce71f4c3dd331ed6331665238a065.
Diffstat (limited to 'source/blender/editors/space_topbar')
-rw-r--r-- | source/blender/editors/space_topbar/space_topbar.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/editors/space_topbar/space_topbar.c b/source/blender/editors/space_topbar/space_topbar.c index 7f0f30624cb..82a0de9b845 100644 --- a/source/blender/editors/space_topbar/space_topbar.c +++ b/source/blender/editors/space_topbar/space_topbar.c @@ -243,8 +243,11 @@ static void undo_history_draw_menu(const bContext *C, Menu *menu) if (wm->undo_stack == NULL) { return; } + int undo_step_count = 0; - for (UndoStep *us = wm->undo_stack->steps.first; us; us = us->next) { + int undo_step_count_all = 0; + for (UndoStep *us = wm->undo_stack->steps.last; us; us = us->prev) { + undo_step_count_all += 1; if (us->skip) { continue; } @@ -255,10 +258,12 @@ static void undo_history_draw_menu(const bContext *C, Menu *menu) uiLayout *column = NULL; const int col_size = 20 + (undo_step_count / 12); - int i = 0; undo_step_count = 0; - for (UndoStep *us = wm->undo_stack->steps.first; us; us = us->next, i++) { + + /* Reverse the order so the most recent state is first in the menu. */ + int i = undo_step_count_all - 1; + for (UndoStep *us = wm->undo_stack->steps.last; us; us = us->prev, i--) { if (us->skip) { continue; } |