FreeCAD: Undo

Like any complex editing software, FreeCAD needs a good Undo system. It needs to be reliable: for example, undo followed by redo should always return to exactly the same state. And it needs to be friendly: for example, if I make a succession of tweaks to the view direction without any intervening actions, it should bunch those together as a single change.

A good Undo system

  • must be robust and reliable
    • implemented at the model database transaction level, and not rely on correctly implementing each modification function
    • the implementation of a modification function should only define how many undo steps are stored for this modification (often just one), the scope of each step, and a description of each step
    • getting this wrong should only affect how many undo steps are stored for that modification, and must not affect overall correctness and ability to undo the change
    • undo then redo, or redo then undo, should always leave the model and view exactly as it was
    • undo then redo, or redo then undo, should leave most of the state of the GUI as it was, with few exceptions
  • should show clearly and definitely that undo really has returned to the prior state
    • after undoing everything since the last save, file “modified” indicator should return to “unmodified” and exit should not prompt to save changes
  • should distinguish changes to the model itself from other state changes (e.g. to the view) so it is possible to make two separate UI functions:
    • undo the last change to the overall state (whether that was a change of model or of view or of both)
    • undo the last change to the model itself (either also undoing all view changes made since then, or keeping the view as it is)
  • should use appropriate granularity
    • a series of changes to the view should be grouped together
    • a series of changes to one parameter (e.g. width of a particular rectangle) should be grouped as a single change: the main reason is it is common to make a series of increments and decrements before deciding on the correct result, especially if using the scroll wheel; a related concern is entering a number such as 123 into some UI widgets causes a change first to 1, then to 12, then to 123
    • bigger granularity is often appropriate: for example, creating a new cuboid at a default size followed by adjusting all its dimensions could be grouped as a single change
  • should provide an Undo History list

I am pleased to read that wmayer has recently done some work on improving undo/redo in FreeCAD.

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments