Undo: unified undo system w/ linear history
authorCampbell Barton <ideasman42@gmail.com>
Mon, 19 Mar 2018 13:17:59 +0000 (14:17 +0100)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 31 Mar 2018 18:40:37 +0000 (20:40 +0200)
commit651b8fb14eb6ee5cbfa98bffe80a966a0753b14e
tree2281978509d82a25fb5fbf586f34335e3606442d
parent91d0825b5556150c017dad767f7971bb6a731aec
Undo: unified undo system w/ linear history

- Use a single undo history for all operations.
- UndoType's are registered and poll the context to check if they
  should be used when performing an undo push.
- Mode switching is used to ensure the state is correct before
  undo data is restored.
- Some undo types accumulate changes (image & text editing)
  others store the state multiple times (with de-duplication).
  This is supported by checking UndoStack.mode `ACCUMULATE` / `STORE`.
- Each undo step stores ID datablocks they use with utilities to help
  manage restoring correct ID's.
  Needed since global undo is now mixed with other modes undo.
- Currently performs each undo step when going up/down history
  Previously this wasn't done, making history fail in some cases.
  This can be optimized to skip some combinations of undo steps.

grease-pencil is an exception which has not been updated
since it integrates undo into the draw-session.

See D3113
66 files changed:
build_files/cmake/macros.cmake
source/blender/blenkernel/BKE_blender_undo.h
source/blender/blenkernel/BKE_main.h
source/blender/blenkernel/BKE_pointcache.h
source/blender/blenkernel/BKE_undo_system.h [new file with mode: 0644]
source/blender/blenkernel/CMakeLists.txt
source/blender/blenkernel/intern/blender_undo.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/undo_system.c [new file with mode: 0644]
source/blender/blenloader/BLO_readfile.h
source/blender/blenloader/BLO_undofile.h
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/undofile.c
source/blender/editors/armature/editarmature_undo.c
source/blender/editors/curve/editcurve.c
source/blender/editors/curve/editcurve_undo.c
source/blender/editors/curve/editfont_undo.c
source/blender/editors/include/ED_armature.h
source/blender/editors/include/ED_curve.h
source/blender/editors/include/ED_lattice.h
source/blender/editors/include/ED_mball.h
source/blender/editors/include/ED_mesh.h
source/blender/editors/include/ED_object.h
source/blender/editors/include/ED_paint.h
source/blender/editors/include/ED_particle.h
source/blender/editors/include/ED_sculpt.h
source/blender/editors/include/ED_text.h
source/blender/editors/include/ED_util.h
source/blender/editors/lattice/editlattice_undo.c
source/blender/editors/mesh/editmesh_undo.c
source/blender/editors/metaball/editmball_undo.c
source/blender/editors/object/object_edit.c
source/blender/editors/object/object_modes.c
source/blender/editors/physics/particle_edit.c
source/blender/editors/physics/particle_edit_undo.c
source/blender/editors/physics/particle_object.c
source/blender/editors/physics/physics_intern.h
source/blender/editors/render/render_internal.c
source/blender/editors/sculpt_paint/CMakeLists.txt
source/blender/editors/sculpt_paint/paint_curve.c
source/blender/editors/sculpt_paint/paint_curve_undo.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/sculpt_paint/paint_image_2d.c
source/blender/editors/sculpt_paint/paint_image_proj.c
source/blender/editors/sculpt_paint/paint_image_undo.c
source/blender/editors/sculpt_paint/paint_intern.h
source/blender/editors/sculpt_paint/paint_undo.c [deleted file]
source/blender/editors/sculpt_paint/sculpt_intern.h
source/blender/editors/sculpt_paint/sculpt_undo.c
source/blender/editors/space_image/image_ops.c
source/blender/editors/space_text/CMakeLists.txt
source/blender/editors/space_text/text_ops.c
source/blender/editors/space_text/text_undo.c [new file with mode: 0644]
source/blender/editors/util/CMakeLists.txt
source/blender/editors/util/ed_util.c
source/blender/editors/util/editmode_undo.c [deleted file]
source/blender/editors/util/memfile_undo.c [new file with mode: 0644]
source/blender/editors/util/undo.c
source/blender/editors/util/undo_system_types.c [new file with mode: 0644]
source/blender/editors/util/util_intern.h
source/blender/makesdna/DNA_windowmanager_types.h
source/blender/windowmanager/WM_undo.h [new file with mode: 0644]
source/blender/windowmanager/intern/wm.c
source/blender/windowmanager/intern/wm_files.c
source/blender/windowmanager/intern/wm_init_exit.c
source/creator/creator_signals.c