================================================
This should fix this (I cannot reproduce it):
https://forum.freecad.org/viewtopic.php?p=667579#p667579
Lately I added the geometry pointer to the item. This has indeed
the potential for an already deleted pointer being accessed.
This PR removes the geometry pointer from the item and relies on the
ViewProvider to indirectly access an updated pointer.
====================================================================================
As reported:
https://forum.freecad.org/viewtopic.php?p=667426#p667426
Support for moving external geometry to another layer will come in the future.
==========================================================================
- Migration of all constraints to the new non-intrusive notification framework.
- Removal of internal geometry command
- Command to create manually internal geometries is removed (deprecated).
========================================================
- CriticalMessage old signal is reconverted to new notification system. This enables to remove the obsolete old system.
- An example of how common errors can be provided with translation support is added, so that App notifications appear
translated in the NotificationArea.
=====================================================
In a previous commit the Edit Section and its preferences where removed, however
Adrián Insaurralde realised that the setting for showing or not this section had been left behind:
https://github.com/FreeCAD/FreeCAD/pull/8716#issuecomment-1462364487
This commit just removes that settings.
=======================================
Refactor:
- Substitute the use of variadic templates with parameter packs.
- Use recently incorporated external library "fmt" to handle printf like formating.
- Extensive cleaning of pragmas and unnecessary forward declarations.
- Parameter packs and libfmt provide a much stronger type checking now, so
conversions that are by standard implicit as bool to int need an explicit static_cast
to avoid compilation warnings.
Extension:
- Include a notifier field, so that the originator of the message can be provided. E.g. Document#DocumentObject
- Include a new type of message called CriticalMessage, this message is intended to have
special behaviour in the future. Namely, it will be used to notify forward compatilibity issues.
It will be used to substitute the current signal/slot mechanism.
- Include two new types of messages for user notifications (Notification and TranslatedNotification). This messages
will be use to convey UI notifications intended for the user (such as non-intrusive message about the usage of a tool). There
are two versions to mark whether the string provided as a message is already translated or not. When using the console system for
notifications, these notifications may originate from the App or the Gui. In the former, it is generally the case that the strings
of messages are not (yet) translated (but they can be marked with QT_TRANSLATE_NOOP). In the latter, often the messages to be provided
are already translated.
Python support for CriticalMessage, Notification and TranslatedNofification, including shortcuts:
Crt = FreeCAD.Console.PrintCritical
Ntf = FreeCAD.Console.PrintNotification
Tnf = FreeCAD.Console.PrintTranslatedNotification
============================================================
This class needs quite some rework, as it is mixing model-view model and item model.
Eventually, the whole needs to be moved to a QTreeWidget for layers' implementation.
This commit:
1. Moves back implementation only class item to the cpp file.
2. Adds a contextual submenu to change the selection from one layer to another in the
naive fixed 3 layer implementation.
3. Adds checkboxes to hide geometry.
It is the minimal modification to enable a user work with the 3 layer implementation.
==================================================
Naive 3 layer implementation to enable the removal of current rendering order.
Layers is conceived to be much more powerful, when combining User Layers, which
work at structural level (conceptually grouping of geometry by the user) and visual
layers (which control the representation of parts of User layers).
However, that implementation will take quite some time and effort to get it right.
This commit enables 3 layers:
1. Normal layer (legacy one)
2. Discontinuous layer (experimental layer which discontinuous edges)
3. Hidden layer (a normal layer which is hidden)
One geometry can be added to one and only one visual layer at a given time.
So this enables to hide geometry (by assigning it to the hidden layer), which is
useful for selection when lines are overlapping, acting as a work-around for the
rendering order. It also allows to rework the rendering order (without the user
being affected), which is also necessary for the final visual layers implementation.
=====================================================================
- Refactor scenograph creation to enable local update
- Support to perform a local update
=================================
This is a property (intended for ViewProviderSketch), containing a list of visual layer configurations.
This property enables to define and serialise the configuration of visual layers, as well as reacting to
changes to it.
=====================
New class allowing to define a VisualLayer:
- whether it is visible or not.
- the line width to be used by coin for this layer.
- the line pattern to be used by coin for this layer.
==============================================================================
In the Layers implementation there are User Layers, which have no direct impact on visualisation,
and allow to group conceptually related geometry into logical entities, and Visual Layers, which
define how geometries are visualised (or even whether they are visualised or not).
For User Layers, SketchObject is responsible for the definition of the layers, and SketcherGeometryExtension
is responsible for indicating the User Layer to which a geometry belongs (via a LayerId field).
For Visual Layers, ViewProviderSketch is responsible for the definition of the visual layers, and
ViewProviderSketchGeometryExtension is responsible for indicating the visual layer to which a geometry belongs.
With this commit, ViewProviderSketchGeometryExtension:
- takes over the responsibility of carrying a visual layer Id.
- is extended to be persistent and serialise the Id.
- is extended to be accesible from Python.