Fix undo steps not allowing re-using old BMain in non-global undo.

Non-memfile undo steps never properly initialized the flag allowing to
re-use old Main data during undo/redo. This lead to doing a complete
full re-reading of data when undoing/redoing mode switches e.g.

Note that current undo system is supposed to support any kind of mode
switch across those steps, however this needs to be properly deeply
tested, so only comitting this to master. It would be way too risky for
2.91 release.
This commit is contained in:
Bastien Montagne 2020-10-30 11:51:48 +01:00
parent 30b17e30f8
commit 4c7b1766a7
Notes: blender-bot 2023-02-14 08:35:51 +01:00
Referenced by commit bc090387ac, Fix T82388: Sculpt mode: Unexpected undo behavior.
Referenced by issue #87631, Segfault on undo-ing mode switching and bone duplication
Referenced by issue #82388, Regression: Sculpt mode undo: Broken when undoing to a Global/memfile undo step after  rB4c7b1766a7f1
1 changed files with 2 additions and 0 deletions

View File

@ -549,6 +549,8 @@ bool BKE_undosys_step_push_with_type(UndoStack *ustack,
BLI_strncpy(us->name, name, sizeof(us->name));
}
us->type = ut;
/* True by default, code needs to explicitely set it to false if necessary. */
us->use_old_bmain_data = true;
/* Initialized, not added yet. */
CLOG_INFO(&LOG, 1, "addr=%p, name='%s', type='%s'", us, us->name, us->type->name);