Blender Git Loki

Git Commits -> Revision c9d6737

Revision c9d6737 by Bastien Montagne (master)
February 3, 2021, 10:11 (GMT)
BKE UndoSys refactor: deduplicate and simplify code, sanitize naming.

Now we only use 'undo' or 'redo' in function names when the direction is
clear (and we assert about it). Otherwise, use 'load' instead.

When passing an undo step to BKE functions, consider calling code has
done its work and is actually passing the target step (i.e. the final
step intended to be loaded), instead of assuming we have to load the
step before/after it.

Also deduplicate and simplify a lot of core undo code in BKE, now
`BKE_undosys_step_load_data_ex` is the only place where all the complex
logic of undo/redo loop (to handle several steps in a row) is placed. We also
only use a single loop there, instead of the two existing ones in
previous code.

Note that here we consider that when we are loading the current active
step, we are undoing. This makes sense in that doing so //may// undo
some changes (ideally it should never do so), but should never, ever
redo anything.

`BKE_undosys_step_load_from_index` also gets heavily simplified, it's
not basically a shallow wrapper around
`BKE_undosys_step_load_from_index`.

And some general update of variable names, commenting, etc.

Part of T83806.

Differential Revision: https://developer.blender.org/D10227

Commit Details:

Full Hash: c9d6737e3e9a00bc297511af4a4d1cf2ed6f8cce
Parent Commit: 4884153
Lines Changed: +212, -201

3 Modified Paths:

/source/blender/blenkernel/BKE_undo_system.h (+14, -5) (Diff)
/source/blender/blenkernel/intern/undo_system.c (+183, -178) (Diff)
/source/blender/editors/undo/ed_undo.c (+15, -18) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021