Commit Graph

68 Commits

Author SHA1 Message Date
Abdullah Tahiri
6397201dc0 Gui: Pass wheel event to viewprovider
=====================================

https://forum.freecadweb.org/viewtopic.php?p=578857#p578857
2022-03-13 11:33:52 +01:00
Uwe
4f5c29edd6 [Gui] Quarter: remove unused includes 2022-03-09 01:12:15 +01:00
Uwe
a830d92947 [Gui] ViewProviderDocument* etc.: remove unused includes 2022-03-06 00:01:37 +01:00
Yorik van Havre
b84c2c7f09 Merge pull request #4178 from uLeonis/master
[v0.20][Gui] Consolidate Std view modes
2021-09-09 12:22:27 +02:00
wmayer
a4aea3f480 Gui: [skip ci] add convenience function updateActions() to Application
Use updateActions() in ViewProvider::onChanged() to also trigger an update on pure view property changes
2021-02-09 15:21:17 +01:00
Abdullah Tahiri
4facab0936 Gui: Colorful/Greyable overlay status in icons
===============================================

Before this implementation, specific status via former mergeOverlayIcon() was greyed out
with the visibility.

With this commit, the developer has two options:

a) override mergeGreyableOverlayIcons, in which case the overlay will
be greyed out when the item is greyed out as per former mergeOverlayIcon()

b) override mergeColorfulOverlayIcons, in which case the overlay will
be superimposed after the icon is greyed out as it is the case for stardard
error and recompute flags.
2021-01-06 13:54:00 +01:00
Marcel Althaus
b7f819f22c Code cleanup. 2020-12-21 19:40:38 +01:00
uLeonis
cbe1050441 MeasureDistance
- Abort mode via ESCAPE added

BoxZoom, BoxSelection and BoxElementSelection
- Change the cursor to give the user feedback about active mode.
- Abort mode via ESCAPE
2020-12-21 17:32:33 +01:00
luz paz
38815b9550 Gui: Fix header uniformity, whitespace, and doxygen fixes 2020-11-26 10:14:56 +01:00
wmayer
86f3f55aa5 Gui: [skip ci] add method to ignore to merge icon of an extension that is e.g. used for Part primitives 2020-11-21 16:49:08 +01:00
wmayer
df02e0ad67 Gui: [skip ci] add method extensionSetupContextMenu to extension view provider 2020-11-08 13:36:31 +01:00
wmayer
d6169d6478 boost: fix for boost < 1.60 2020-06-15 19:38:39 +02:00
wmayer
730154a684 boost 1.73.0: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated 2020-06-12 17:51:33 +02:00
wmayer
6bf1a623c5 Gui: add function to observe before changing a property 2020-01-13 02:17:39 +01:00
asapelkin
ced8100ab9 use emplace_back instead of push_back where justified 2019-11-21 14:48:09 +01:00
Zheng, Lei
bb3baefdb5 Gui: refactor bounding box selection style
Previously, box style selection is rendered using customized
SoBoxSelectionRenderAction, which does not support selection context,
i.e. it does not work with Link.

This patch implements context aware bound box rendering inside
SoFCSelectionRoot, SoFCSelection and SoFCPathAnnotation (for always on
top rendering). The box rendering in SoBoxSelectionRenderAction is
disabled on construction. Box style selection can be enabled for
individual object through property SelectionStyle (moved from
ViewProviderGeometryObject to ViewProviderDocumentObject), or globally
through Parameter BaseApp/Preferences/View/ShowSelectionBoundingBox.

In addition, the parameter BaseApp/Preferences/View/UseNewSelection is
used to override selection model reported from
ViewProvider::useNewSelectionModel(). The reason being that, the same
parameter is already used to toggle selection model inside
SoFCSelection. This avoids inconsistency of selection model choice
between view provider and the SoFCSelection node inside. Note that if
the parameter 'UseNewSelection' is set to false, those view providers
that choose old selection model will not work with Link.
2019-10-08 09:56:09 +02:00
Zheng, Lei
7782b51e76 Gui: improve code readability 2019-09-10 14:17:06 +02:00
Zheng, Lei
d4ac072306 Gui: support in-place editing
The link support means that an object can now appear in more than one
places, and even inside a document different from its own. This patch
adds support for in-place editing, meaning that the object can be edited
at correct place regardless where it is.

See [here](https://git.io/fjPIk) for more info about the relavent APIs.

This patch includes two example of modifications to support in-place
editing. One is the ViewProviderDragger, which simply adds the dragger
node to editing root node by calling
View3DInventorViewer::setupEditingRoot(dragger). The other much more
complex one is ViewProviderSketch which calls setupEditingRoot(0) to
transfer all its children node into editing root. ViewProviderSketch
also includes various modifications to command invocation, because we
can no longer assume the active document is the owner of the editing
object.

This patch also includes necessary modification of the 'Show' module to
support in-place editing.
2019-08-17 15:08:32 +02:00
Zheng, Lei
5214f5b7ce Gui: add coinRemoveAllChildren to work around Coin3D bug
See bug description:
https://bitbucket.org/Coin3D/coin/pull-requests/119/fix-sochildlist-auditing/diff

Because of path based rendering (SoFCPathAnnotation) in mouse over
highlight, this bug causes crash more frequently here comparing to
upstream.

All C++ calling of SoGroup::removeAllChildren() is replaced by
Gui::coinRemoveAllChildren(), and python code is fixed by monkey
patching SoGroup.removeAllChildren() in FreeCADGuiInit.py.
2019-08-17 14:52:11 +02:00
Zheng, Lei
c9ba972d26 Gui: add support of selection context
The patch implements context-aware selection and rendering in 3D view.

Please check [here](https://git.io/fjiY5) for more details, including
the following 'Render Caching' section.

The patch also includes modification of View3DInventorViewer to support
always-on-top selection rendering using the secondary selection context
and the new coin node SoFCPathAnnotation.

Another small change in SoQtQuarterAdaptor for more responsive frame
rate display. The original implementation reports skewed frame rate
in the presence of long idle period.
2019-08-17 14:52:10 +02:00
Zheng, Lei
cd7725227f ViewProvider(DocumentObject): new APIs for context aware selection
Context aware selection makes it possible to select the same Coin3D node
in different hierarchies (i.e. context) without ambiguity.

New/modified APIs in ViewProvider (the first two are the most crucial
APIs for context aware selection to work):

* getElementPicked(), supercedes getElement(). Given a Coin3D pick
  point, this function returns a dot separated subname reference as a
  path leads to the selected object.

* getDetailPath(), supercedes getDetail(). Given a subname reference,
  this function returns an SoFullPath leads to the Coin3D node of the
  selected object or sub-element (with SoDetail).

* (has)HiddenMarker(), check/return a special text marker for context
  aware override of object visibility.

* partialRender(), render only part of the object based on given
  subname references. It can render, e.g. some faces of a solid, or
  some children of a container. It uses the 'secondary' extension of
  SoSelectionElementAction to select which elements to render or hide.
  The actually rendering functionality will be added in the following
  patch.

* update()/onChanged(), modified to sync Visibility property from
  DocumentObject.

* useNewSelectionModel(), modified to return the default true view
  parameter. This is for test in the early stage of Link development,
  probably not needed anymore.

* getBoundingBox(), a convenience function to obtain the bounding box
  of a sub-object/element regardless of object's visibility. It uses
  getDetailPath() and SoGetBoundingBoxAction to obtain bounding box
  through Coin3D. It will be used in later sub-element box selection
  functionality.

New/modified APIs in ViewProviderDocumentObject:

* getElementPicked()/getDetailPath() provides actual implementation to
  support container like (sub)object selection without ambiguity. It
  relies on DocumentObject::getSubObject() to walk the path.

* reattach(), called when undo deleteion

* forceUpdate()/isUpdateForced(), force update even if object is
  invisible. These are used by Link to force update the visual of a
  linked object regardless of its visibility.

* getLinkedViewProvider(), return the linked view provider with
  hierarchy.

ViewProviderDocumentObjectPy:

* Object attribute is made writtable. Assigning it is equaivalant of
  calling ViewProviderDocumentObject::attach() in Python.
2019-08-17 14:52:10 +02:00
Zheng, Lei
899fb722ea 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.
2019-08-17 14:52:10 +02:00
Abdullah Tahiri
489f48a223 Gui::Add mergeoverlay function to ViewProviderExtension 2019-06-23 01:03:36 +02:00
Abdullah Tahiri
79b54c3494 Gui: Extend ViewProvider to enable merging of overlays on icon 2019-06-23 01:03:35 +02:00
plgarcia
77232b2141 Drags and drop with groups 2018-11-29 21:25:28 +01:00
wmayer
f513305916 fix crash with Py3 when releasing memory buffer 2018-10-29 11:59:34 +01:00
wmayer
869fb99595 improve whitespaces 2018-10-18 23:31:55 +02:00
Zheng, Lei
31f2ebdf55 ViewProvider: fix potential crash when exit editing 2018-09-20 12:47:19 +02:00
wmayer
53bd021b97 improve exception handling in ViewProvider::eventCallback 2018-07-30 12:25:54 +02:00
luzpaz
a225b13bef Misc. typos
- Tooltip uniformity 
- source comment typo fixes
- remove double whitespaces
2017-11-24 09:45:08 -02:00
wmayer
4d63e9a4c4 various minor changes:
+ whitespace improvement
+ code cleanup
2017-11-21 17:51:22 +01:00
wmayer
48155db774 issue #0002080: Attempt to remove FEM analysis result (displacement & stress) results in false warning 2017-10-18 19:46:20 +02:00
wmayer
62329d1cf9 issue #0003070: VRML 2 crashes with corner cases 2017-06-11 16:41:52 +02:00
wmayer
fb7094bf31 use specialized exception classes 2017-04-28 18:49:11 +02:00
wmayer
45198fb712 use names directly from document to set them in scene inspector 2017-01-30 22:29:26 +01:00
wmayer
411823860b avoid changing scenegraph while traversing it 2017-01-13 22:01:47 +01:00
wmayer
5de0f2b185 replace invalid characters in VRML string with underscore 2016-12-21 17:02:06 +01:00
wmayer
2468ab6e71 fix typos & whitespaces 2016-12-21 11:19:54 +01:00
wmayer
3dc611f3df fix CIDs 154872, 152491, 129453 2016-12-18 13:10:07 +01:00
wmayer
359a25d0c8 issue #0002802: Set a name to coin rootnodes of objects 2016-12-15 22:16:19 +01:00
wmayer
6782fe8086 fix dangling pointer, remove superfluous semicolons, avoid excessive report messages of extension object 2016-12-09 23:03:18 +01:00
Stefan Tröger
88728bc73d Extensions: Group fix for python 2016-12-04 19:50:42 +01:00
Stefan Tröger
3debf0d29e Fix rebase errors 2016-10-08 12:48:34 +02:00
Stefan Tröger
86f66c31da Extensions: Fix visibility restore issue 2016-10-08 12:48:34 +02:00
Stefan Tröger
5b9aea71d5 Extensions: Port ViewProvider of GeoFeatureGroup 2016-10-08 12:48:34 +02:00
Stefan Tröger
f61bb9062e Extensions: Port ViewProvider of groups 2016-10-08 12:48:34 +02:00
Stefan Tröger
b5f4023050 Extensions: Introduce ViewProviderExtension 2016-10-08 12:48:34 +02:00
wmayer
fb9cd567d3 fix msvc problems 2016-09-21 22:14:09 +02:00
wmayer
1e6dcabefc fix -Wextra in FreeCADGui 2016-09-21 20:54:52 +02:00
DeepSOIC
8415bc32b6 Gui: Selection: pick radius support 2016-08-10 18:46:45 +02:00