Commit Graph

72 Commits

Author SHA1 Message Date
pre-commit-ci[bot]
28b603ad6c chore: Fix formatting for missing file 2025-11-18 03:15:09 -06:00
David Carter
31929cb4e5 Materials: Assigning material without appearance
Assigning a material without an appearance reset the appearance to the
default appearance.

There were two main problems. One was the comparison function for
App::Material objects. It would return false when the UUID or MatType
values were different although there are many circumstances where this
could be true and the appearance be the same. It also incorrectly
compared the imagePath.

The second problem was the logic for detecting if an object has already
been assigned an appearance by assigning a material or manually setting
the appearance. If assigned a material, the appearance should update but
not if it has been set manually. This logic has been corrected.
2025-11-17 17:43:14 +01:00
pre-commit-ci[bot]
9fe130cd73 All: Reformat according to new standard 2025-11-11 13:49:01 +01:00
Markus Reitböck
a72a0d6405 Gui: use CMake to generate precompiled headers on all platforms
"Professional CMake" book suggest the following:

"Targets should build successfully with or without compiler support for precompiled headers. It
should be considered an optimization, not a requirement. In particular, do not explicitly include a
precompile header (e.g. stdafx.h) in the source code, let CMake force-include an automatically
generated precompile header on the compiler command line instead. This is more portable across
the major compilers and is likely to be easier to maintain. It will also avoid warnings being
generated from certain code checking tools like iwyu (include what you use)."

Therefore, removed the "#include <PreCompiled.h>" from sources, also
there is no need for the "#ifdef _PreComp_" anymore
2025-09-14 09:47:03 +02:00
Roy-043
1057db98db Typo in ViewProviderGeometryObject.cpp (#21517)
appearrance -> appearance
2025-05-22 11:04:10 +02:00
Kacper Donat
36195d1981 Base: Add fromPercent and toPercent helpers 2025-02-23 22:51:13 +01:00
tritao
4843377790 Gui: Change SoFCSelection from highlight to preselection terminology. 2025-02-05 13:14:00 +00:00
Benjamin Nauck
6f535f19fb Prefer to use BaseClass's isDerivedFrom<T> over non template or Base::Type's
Regex based changes, manually verified
2025-01-27 16:08:18 +01:00
João Matos
23a05bb250 Gui: Scene inspector improvements (#18781)
* Improve naming for root scene graph switch/separator nodes.

* Improve scene graph inspector.

This commit improves the scene graph inspector by improving the UI
layout and displaying information in a more human-readable way.

Instead of having a main generic string column for all node-specific
data, introduce specific columns for node name, memory address and data.

Better visualization was also added for `SoDrawStyle`, `SoPickStyle`
and `SoCoordinate3` node types.
2025-01-13 21:38:41 -06:00
wmayer
1cf2bacf1f Gui: Add SoPickStyle node to make an object un-selectable if needed 2024-12-09 18:10:15 +01:00
Kacper Donat
44f3b37200 Gui: Add getObject<T>() helpers to various classes
Obtaining specific kind of document object is very common task. This
commit introduces handy helper which makes that a lot easier.
2024-12-06 18:19:53 +01:00
Chris Hennes
889c5ea516 Merge pull request #15528 from ppphp/move_some_inventor
refactor: move some nodes to Inventor folder
2024-11-22 12:20:50 -05:00
David Carter
d6660f88ed Materials: Selectively apply appearances
Change the appearance only if the appearance hasn't been set explicitly.
A cached material appearance is used to see if the current appearance
matches the last material. It is also compared against an empty
material to see if the saved material value has been initialized.

This solves the problem of material changes overwriting appearance
changes
2024-10-28 21:49:45 -05:00
liukaiwen
776ed8f2c1 refactor: move some nodes to Inventor folder 2024-07-20 01:07:04 +08:00
Chris Hennes
101118fdde Merge branch 'main' into vp_texture_ext 2024-06-17 10:48:45 -05:00
David Carter
4e315183b3 Materials: Render Transparency
Under certain conditions an objects transparency would no be updated.

fixes #14568
2024-06-16 22:20:06 -05:00
wmayer
330e64fc89 Gui: Move texture handling to view provider extension
It should be avoided to add all stuff to the base class when it's only needed in one sub-class
2024-06-11 11:55:44 +02:00
David Carter
5feb963f9d Material: Appearance Updates 2
Improves the use of the ShapeAppearance property for the Part workbench.

    removes DiffuseColor property
        adds Python compatibility using custom attributes
        transitions DiffuseColor to ShapeAppearance on open
    Improved UI elements for setting object appearance, and appearance per face
    Lays the foundation for future texture support
2024-06-01 19:57:16 -05:00
wmayer
e9bf1e4b88 Gui: expose ViewProviderGeometryObject::getUserDefinedMaterial() to Python 2024-04-25 17:56:58 +02:00
wmayer
2b0a88ca7d Gui: Read material colors from settings 2024-04-19 11:13:59 +02:00
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