forked from FreeCAD/FreeCAD
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document: 2-pass recompute for dependency inversion
Here is a simple example of dependency inversion: A parent object has some child object, but the child object can only be updated after the parent object finished update, because it requires some information from the parent. A concrete example will be Sketcher::SkechExport, that export partial geometry element from a SkechObject. For better object hierarchy, SketchExport is grouped under SketchObject. However, it can only be updated after SketchObject finished recompute This patch offers a quick and dirty solution to this dependency inversion problem. When Document::recompute(objs) is called, the first pass proceed as normal. After its done, it will check if any object is still touched, and mark those touched object with ObjectStatus::Recompute2 flag. It will then launch a second pass of recompute. Those parent objects that need dependency inversion shall check its children for this flag, and do not touch them if found. If there are still objects touched after second pass, an error message will be printed.
- Loading branch information
1 parent
cd83555
commit 70c3d85
Showing
2 changed files
with
40 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters