diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-03-15 15:29:33 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-03-15 15:31:35 +0300 |
commit | ab6e67767e730309e51fca7a7f086cbcbadb41a9 (patch) | |
tree | 6aadad400b20c35f8e899908c636edc472eb42d2 /source/blender/editors/sculpt_paint/sculpt_undo.c | |
parent | 14863b3d4d86c7ad11de5268279ece31b12ee876 (diff) |
Comments: notes on sculpt/image undo looping logic
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt_undo.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_undo.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index 4d063099216..b6205db6f45 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -1490,6 +1490,8 @@ static void sculpt_undosys_step_decode_undo(struct bContext *C, SculptUndoStep *us, const bool is_final) { + /* Walk forward over any applied steps of same type, + * then walk back in the next loop, un-applying them. */ SculptUndoStep *us_iter = us; while (us_iter->step.next && (us_iter->step.next->type == us_iter->step.type)) { if (us_iter->step.next->is_applied == false) { @@ -1499,6 +1501,7 @@ static void sculpt_undosys_step_decode_undo(struct bContext *C, } while ((us_iter != us) || (!is_final && us_iter == us)) { + BLI_assert(us_iter->step.type == us->step.type); /* Previous loop ensures this. */ sculpt_undosys_step_decode_undo_impl(C, depsgraph, us_iter); if (us_iter == us) { break; @@ -1530,6 +1533,7 @@ static void sculpt_undosys_step_decode_redo(struct bContext *C, static void sculpt_undosys_step_decode( struct bContext *C, struct Main *bmain, UndoStep *us_p, const eUndoStepDir dir, bool is_final) { + /* NOTE: behavior for undo/redo closely matches image undo. */ BLI_assert(dir != STEP_INVALID); Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); |