Blender Git Loki

Git Commits -> Revision 95fe4ca

July 5, 2013, 13:10 (GMT)
Keeps the operator stack synchronised with the undo stack so that the redo panel displays the right operator after an undo.

N.B. This is an updated version of patch #35059 in the tracker, which had a nasty bug in it still.

This patch aims to introduce functionality that keeps the two undo stacks (object mode, and edit mode) synchronised with the operator stack in the window manager. This allows for the operator redo panel to be initialised to the last operator that was performed to arrive at the current state after undos and redos are performed. This is achieved by keeping pointers to the operators in the UndoElem structs and rebuilding the wmWindowManager's operator stack after each undo or redo.

The changes throughout the code aim to achieve that a) wmOperator structs are passed to the undo systems to be stored in the UndoElem structures (changes in undo_push_X functions), b) wmOperator structs that are referenced from UndoElem structs are only freed by the undo system, and that c) the operators that are repeated instead of redone (repeat last, repeat from history) are copied rather than moved to the back of the operator stack.

Operators that have a flag OPTYPE_UNDO are registered in the undo system and the undo system is responsible only for these operators. Other operators are freed after application. Even though all OPTYPE_UNDO operators are registered in the undo system, only OPTYPE_REGISTER operators are included when generating the window managers operator stack.

N.B. The following changes aren't very nice and I would like to point them out explicitly.
- The undo system, which is part of blender's core, is now more strongly connected to window managing subsystem than before
- The UndoElem structs (one for object mode undo, and one for edit mode undo) are not exposed, but mapped to a third UndoElem in wm.c. This was done to avoid bringing too much WM logic into blender.c. Better but more involved solutions exist.

Further changes should include doing away with the operator stack entirely and use the undo system as the backend data model for it.

Commit Details:

Full Hash: 95fe4ca034a738d09c3de9be729e1652cb0c3f4e
SVN Revision: 58020
Parent Commit: 1151578
Lines Changed: +251, -87

24 Modified Paths:

/source/blender/blenkernel/BKE_blender.h (+4, -1) (Diff)
/source/blender/blenkernel/intern/blender.c (+55, -7) (Diff)
/source/blender/editors/armature/armature_utils.c (+3, -2) (Diff)
/source/blender/editors/curve/editcurve.c (+2, -2) (Diff)
/source/blender/editors/curve/editfont.c (+2, -2) (Diff)
/source/blender/editors/include/ED_armature.h (+1, -1) (Diff)
/source/blender/editors/include/ED_curve.h (+2, -2) (Diff)
/source/blender/editors/include/ED_mball.h (+2, -1) (Diff)
/source/blender/editors/include/ED_mesh.h (+1, -1) (Diff)
/source/blender/editors/include/ED_object.h (+1, -1) (Diff)
/source/blender/editors/include/ED_util.h (+2, -2) (Diff)
/source/blender/editors/mesh/editmesh_utils.c (+3, -2) (Diff)
/source/blender/editors/metaball/mball_edit.c (+2, -2) (Diff)
/source/blender/editors/object/object_lattice.c (+3, -2) (Diff)
/source/blender/editors/screen/screen_ops.c (+16, -9) (Diff)
/source/blender/editors/util/editmode_undo.c (+36, -12) (Diff)
/source/blender/editors/util/undo.c (+33, -25) (Diff)
/source/blender/editors/util/util_intern.h (+1, -1) (Diff)
/source/blender/windowmanager/intern/wm.c (+42, -2) (Diff)
/source/blender/windowmanager/intern/wm_event_system.c (+31, -5) (Diff)
/source/blender/windowmanager/intern/wm_files.c (+2, -2) (Diff)
/source/blender/windowmanager/intern/wm_init_exit.c (+1, -1) (Diff)
/source/blender/windowmanager/intern/wm_operators.c (+4, -2) (Diff)
/source/blender/windowmanager/WM_api.h (+2, -0) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021