Commit Graph

52 Commits

Author SHA1 Message Date
wmayer
12ef38e66f Fix handling of transparency / Restore colour per face
The Materials module does a conversion from float to double when saving the transparency and again a conversion from double to float to double
when restoring it. This causes a considerable loss of accuracy so that the representation in percent leads to different numbers.

Using consistently some helper functions to do a proper conversion from float to long and back fixes the problem.

The new property ShapeAppearance is a PropertyMaterialList and always read after the DiffuseColor property when restoring a document.
Thus, the  method onChanged() doesn't override DiffuseColor when restoring a document. Additionally, the method finishRestoring() is re-implemented
to set the colours per face in case DiffuseColor has defined multiple colors.
2024-04-10 13:32:58 +02:00
wmayer
92ac3cc0d3 Core: avoid conversion from float to double or vice-versa
When synchronizing the Transparency property with the transparency value of the ShapeAppearance property then do not convert between float and
double as otherwise some strange rounding issues can occur.

Example: Set the Transparency property of an object to 35 in the Property Editor. After leaving the editor the value may switch to 34.
2024-04-09 22:15:51 +02:00
wmayer
92b1e77744 Gui: fix ViewProviderGeometryObject
* fix several linter warnings
* remove code that cannot be executed: inside the constructor it cannot ever happen that getObject()
  returns a valid object
* in ViewProviderGeometryObject::handleChangedPropertyName call the method of the direct base class
  as otherwise this may break the mechanism in the future
* Shape is a property of an extension module -> move its handling to ViewProviderPartExt
2024-04-09 22:15:51 +02:00
David Carter
ba20441935 Material: Material appearance
Uses new material system for appearance

Each feature object now has a property called ShapeMaterial that
describes its physical properties. If it has a shape, it has a
material.

The ShapeColor attribute is replaced by a ShapeAppearance attribute.
This is a material list that describes all appearance properties, not
just diffuse color. As a list in can be used for all elements of a
shape, such as edges and faces.

A new widget is provided to allow the user to select materials in a
consistent fashion. It can also launch the material editor with its
more advanced capabilities.
2024-04-04 07:39:58 -05:00
Max Wilfinger
fd518c6187 change default shape color 2024-02-18 14:12:22 -06:00
bdieterm
ddcf247489 Gui: fix ignored default shape color 2024-01-05 09:27:28 -06:00
bdieterm
2c5e1a9382 Gui: fix partially initialized default transparency 2023-12-01 12:36:31 +01:00
wmayer
6beace8da6 Gui: modernize C++: use default member init 2023-08-23 19:51:44 +02:00
Uwe
cef5c5c11c [Gui][Mod]: uniform spin button step size to 5%
- as discussed here: https://github.com/FreeCAD/FreeCAD/pull/7103 we have different transparency spin button step sizes. This PR uniforms them all to 5%.
2022-11-06 14:27:55 +01:00
berniev
ae53c9b0a4 Gui: Use auto and range-based for (#7481)
* On lines where the variable type is obvious from inspection, avoid repeating the type using auto. 
* When possible use a ranged for loop instead of begin() and end() iterators
2022-09-14 13:25:13 -05:00
Uwe
0cc0de67b2 [Gui] ViewProviderGeometryObject: fix color and transparency
- fixes the issue reported in
https://forum.freecadweb.org/viewtopic.php?p=609353#p609353
the color and transparency are childs of the material and have to be set as such.

- also some code style fixes done automatically by MSVC
2022-07-13 05:42:21 +02:00
Uwe
030aba9b92 [Part] [PD] add preferences setting for transparency
- allow to specify the default transparency for new shapes
2022-07-09 23:24:17 +02:00
wmayer
299c20e918 Gui: get rid of some const_cast 2022-06-28 15:26:02 +02:00
wmayer
1178df06b4 Gui: modernize C++11
* use nullptr
2022-03-23 18:41:21 +01:00
Uwe
e0e7bc7072 [Gui] ViewProviderFeature etc.: remove unused includes 2022-03-06 00:34:35 +01:00
Zheng, Lei
c37c8658c4 App/Gui: add new ObjectStatus TouchOnColorChange
For triggering recompute on color changes
2021-12-21 21:41:02 -07:00
wmayer
dfba396b4f Gui: support to customize the font size of bounding boxes 2021-03-02 16:29:57 +01:00
luz paz
38815b9550 Gui: Fix header uniformity, whitespace, and doxygen fixes 2020-11-26 10:14:56 +01:00
carlopav
7a84e52fa1 Gui: divide ViewProviderGeometryObject properties into groups
.


.


.


.
2020-08-21 12:36:46 +02: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
wmayer
2feb777689 update bounding box if the placement of a geometry changes 2019-07-02 13:30:52 +02:00
wmayer
2f8179719e call updateData of base class for ViewProviderDragger and ViewProviderGeometryObject 2019-07-02 12:08:23 +02:00
wmayer
6b37fdc1a8 PVS issues:
consistently define copy constructor and assignment operator
remove superfluous casts
initialize member variables in constructor
avoid double assignment
2019-03-04 11:53:49 +01:00
wmayer
cfb04647b2 Do not use a view provider's bounding box node when handling BoundBox selection style because it leads to some inconsistent behaviour.
Instead let SoBoxSelectionRenderAction render the bounding box.
2018-10-26 00:39:15 +02:00
Arne
aff8280895 ViewProviderGeometryObject: set default random shape color to false 2018-04-21 13:51:51 +02:00
dulouie
2414219c94 fix small layout issues 2018-04-21 13:33:40 +02:00
Arne Schmidt
767d23b987 random shapecolor with toggle in settings dialog 2018-04-21 13:33:40 +02:00
wmayer
6a24bc9602 add class ViewProviderDragger
derive ViewProviderGeometryObject from ViewProviderDragger
derive ViewProviderPart from ViewProviderDragger
2017-11-26 15:42:57 +01:00
wmayer
4d63e9a4c4 various minor changes:
+ whitespace improvement
+ code cleanup
2017-11-21 17:51:22 +01:00
Zheng, Lei
2707c43e52 Gui: allow bounding box style to be customized 2017-04-01 11:09:03 -03:00
Zheng, Lei
63a6f9c8c5 Gui: added bbox selection style to GeometryObject 2017-03-21 09:29:15 +01:00
wmayer
359a25d0c8 issue #0002802: Set a name to coin rootnodes of objects 2016-12-15 22:16:19 +01: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
wmayer
bcfe696229 close transform dialog when finishing edit mode 2016-08-05 22:02:03 +02:00
wmayer
fb7a22036e + fix build failures & warnings 2016-05-07 23:18:59 +02:00
blobfish
ae5224d342 Core: Gui: SoFCSysDragger: using SoFCSysDragger in ViewProviderGeometryObject 2016-05-07 23:07:08 +02:00
Mateusz Skowroński
6942c23895 Qt4's qglobal.h defined TRUE and FALSE. Qt5 does not do it anymore. Replace it with true and false.
158f39ec78

This change is Qt4/Qt5 neutral.
2016-01-05 16:43:33 +01:00
wmayer
1cdb53ce79 + fixes #0002150: [Ctrl]+[Z] is buffered in a non-intuitive way, does not function in 'edit mode' 2015-09-15 14:30:15 +02:00
wmayer
6e0287ff17 + remove SoFCSelection from ViewProviderGeometryObject 2015-05-20 21:44:27 +02:00
Stefan Tröger
512a2b94d2 Adaption of FreeCAD to QuarterWidget
-removes all soqtviewer references
-create a quarter adaptor class which implements missing functionality
-adopts freecad code to make use of SoRenderManager and changed View3DInventorViewer  interface
2014-09-23 10:11:11 +02:00
wmayer
883d4ce9e3 + do not apply corrupted transformation (NaN) from SoCenterballManip 2014-08-11 14:56:30 +02:00
wmayer
8de7bd6d47 + fix displacement of bounding box 2014-03-17 10:56:38 +01:00
wmayer
95daf2953e 0001441: entering Transform mode degrades the Placemens rotation to single precision 2014-02-28 11:22:09 +01:00
wmayer
9234c7463d + fixes #0001441: entering Transform mode degrades the Placemens rotation to single precision 2014-02-27 14:43:07 +01:00
Yorik van Havre
ca448d8794 0001032: Preference setting for bounding box colour 2013-06-27 20:42:30 -03:00
wmayer
46084e435e 0000942: Crash when 2xdouble-click on part 2013-01-05 11:26:16 +01:00
wmayer
b06703fdde 0000939: Pressing Escape while pivoting a box crashes 2013-01-03 16:38:52 +01:00
Yorik van Havre
5c20d6bbdc 0000630: User-defined defaults for shape colors
The default colors for new geometry (light grey + 2px black line)
are now a user preference (In Display->Colors properties)
2012-08-13 09:42:05 -03:00
wmayer
086148bb01 Apply transformation only from Placement property 2012-04-09 16:02:46 +02:00