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>2021-03-12 17:25:34 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-03-12 17:36:26 +0300
commitf0c3ec3dc8bc0e361b47952bad105499a2d23fae (patch)
tree08d13ad933559d8b64dfab4893a3dacddfeb9676
parentc7354cc64bdf9931ad61bb49f5513864d10b1ff0 (diff)
Fix T82532: Sculpt fails to redo the first sculpt session stroke
Sculpt undo relied on having a mode-changing undo step to properly apply changes. However this isn't the case with startup files or when mixing global undo steps with sculpt (see T82851, also fixed). Undo stepping logic follows image_undosys_step_decode_undo.
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index ec103bd2b98..b1e71a27dfc 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -1492,7 +1492,8 @@ static void sculpt_undosys_step_decode_redo_impl(struct bContext *C,
static void sculpt_undosys_step_decode_undo(struct bContext *C,
Depsgraph *depsgraph,
- SculptUndoStep *us)
+ SculptUndoStep *us,
+ const bool is_final)
{
SculptUndoStep *us_iter = us;
while (us_iter->step.next && (us_iter->step.next->type == us_iter->step.type)) {
@@ -1501,8 +1502,12 @@ static void sculpt_undosys_step_decode_undo(struct bContext *C,
}
us_iter = (SculptUndoStep *)us_iter->step.next;
}
- while (us_iter != us) {
+
+ while ((us_iter != us) || (!is_final && us_iter == us)) {
sculpt_undosys_step_decode_undo_impl(C, depsgraph, us_iter);
+ if (us_iter == us) {
+ break;
+ }
us_iter = (SculptUndoStep *)us_iter->step.prev;
}
}
@@ -1527,11 +1532,8 @@ 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 UNUSED(is_final))
+static void sculpt_undosys_step_decode(
+ struct bContext *C, struct Main *bmain, UndoStep *us_p, const eUndoStepDir dir, bool is_final)
{
BLI_assert(dir != STEP_INVALID);
@@ -1574,7 +1576,7 @@ static void sculpt_undosys_step_decode(struct bContext *C,
SculptUndoStep *us = (SculptUndoStep *)us_p;
if (dir == STEP_UNDO) {
- sculpt_undosys_step_decode_undo(C, depsgraph, us);
+ sculpt_undosys_step_decode_undo(C, depsgraph, us, is_final);
}
else if (dir == STEP_REDO) {
sculpt_undosys_step_decode_redo(C, depsgraph, us);