FreeCAD: master a75c955d

Author Committer Branch Timestamp Parent
Zheng, Lei wmayer master 2019-06-21 05:47:33 master bce47d23
Changeset ViewProvider/ViewProviderExtension: various new APIs

Some of these new APIs are not strictly needed for Link to work, but
good to have.

Summary of the API changes:

* getModeSwitch/getTransformNode() exposes view provider mode switch
  and transformation coin3D node, required by ViewProviderLink to
  override placement and visibility.

* canAddToSceneGraph() inform 3D viewer whether to add the root node to
  scenegraph. Some object only exists as a child of some coordinate
  system. Not adding them can simplify scenegraph and visibility
  management.

* showInTree() inform tree view whether to show the corresponding tree
  item.

* getDefaultMode() to expose the current active mode regardless of the
  view provider's visibility

* (can)DropObjectEx() superseds (can)DropObject() with additional
  support of subname reference, which makes it easy to support linking
  to sub-objects. One of the use case is cross coordinate system
  linking.

* getDropPrefix() is used to tell tree view where the object is dropped
  into. A non empty return means the object is actually dropped into a
  sub-object. For example, Assembly3 container puts all dropped object
  into its child container PartGroup.

* canDragAndDropObject() is used to inform tree view whether the object
  dropped need to be dragged out of its original parent, which usually
  does not make sure for Link type object.

* beforeDelete() will be called by Gui::Document when either the
  object itself is being deleted or when the document is being
  destoried.

* is/setLinkVisibility() allows to show/hide a link to this object.
  This may be used during editing, to prevent showing editing geometry
  in multiple places.

* update() is made a virtual function, it will be overridden by
  ViewProviderDocumentObject in future patch.

* startEditing() now becomes virtual, and return a ViewProvider that
  actually handles the editing. This is for future Link type object to
  forward editing request

* covert(), convenience function to convert between Coin3D and FC matrix

ViewProviderExtension also gains many relavant extension point of the
new API. There is also the new extensionModeSwitchChange() for notifying
mode switch changes

ViewProviderPy exposes several method/attribute for the new API as well.
mod - src/Gui/ViewProvider.cpp Diff File
mod - src/Gui/ViewProvider.h Diff File
mod - src/Gui/ViewProviderExtension.h Diff File
mod - src/Gui/ViewProviderPy.xml Diff File
mod - src/Gui/ViewProviderPyImp.cpp Diff File