FreeCAD: master 7ae2fc7b

Author Committer Branch Timestamp Parent
abdullah wwmayer master 2020-06-11 18:14:19 master 8ef32eab
Changeset Sketcher: ViewProviderSketch delay updateData on undo/redo transactions

=======================================================================

On App:Document::undo, applchn is called on every transactional object (e.g. properties) affected, which
calls Paste on the property.

Each of the properties of SketchObject cause a call to SketchObject::OnChanged, and App::DocumentObject::OnChanged, the latter
calling onChangeProperty, which signals the viewprovider from Gui::Document::slotChangedObject via ViewProviderSketch::updateData.

This causes that the ViewProvider is updated when Constraints and Geometry indexes are not matching.

The solution proposed has three parts:
1. First, at ViewProvider::updateData update is prevented while undo/redo transaction is performed by checking isPerformingTransaction()
2. Second, the onUndoRedoFinished() mechanism of SketchObject causes the call of updateData when it solves the sketch (and sets the solved geometry)
3. Third, Gui::Document::signalUndoDocument and Gui::Document::signalRedoDocument (via the slots in ViewProviderSketch) are
used to perform the recompute of the ViewProvider when the undo/redo transaction is finished if needed.
mod - src/Mod/Sketcher/Gui/ViewProviderSketch.cpp Diff File
mod - src/Mod/Sketcher/Gui/ViewProviderSketch.h Diff File