Commit Graph

72 Commits

Author SHA1 Message Date
pre-commit-ci[bot]
151e3a987e chore: Fix formatting for missing file 2025-11-18 03:15:09 -06:00
David Carter
f4e78e3163 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]
25c3ba7338 All: Reformat according to new standard 2025-11-11 13:49:01 +01:00
Markus Reitböck
6ef07bb358 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
819b1b9218 Typo in ViewProviderGeometryObject.cpp (#21517)
appearrance -> appearance
2025-05-22 11:04:10 +02:00
Kacper Donat
2f35f1c561 Base: Add fromPercent and toPercent helpers 2025-02-23 22:51:13 +01:00
tritao
18299a6d83 Gui: Change SoFCSelection from highlight to preselection terminology. 2025-02-05 13:14:00 +00:00
Benjamin Nauck
dd6aa9f3c7 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
6222b935f0 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
57ad518aeb Gui: Add SoPickStyle node to make an object un-selectable if needed 2024-12-09 18:10:15 +01:00
Kacper Donat
deb15a57e4 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
64f63ae97e 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
37d0cc7cc5 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
4c6b7dadeb refactor: move some nodes to Inventor folder 2024-07-20 01:07:04 +08:00
Chris Hennes
c901a2232f Merge branch 'main' into vp_texture_ext 2024-06-17 10:48:45 -05:00
David Carter
417ca72977 Materials: Render Transparency
Under certain conditions an objects transparency would no be updated.

fixes #14568
2024-06-16 22:20:06 -05:00
wmayer
a58eebd903 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
8b5a3b1124 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
e591b95228 Gui: expose ViewProviderGeometryObject::getUserDefinedMaterial() to Python 2024-04-25 17:56:58 +02:00
wmayer
2d24fca530 Gui: Read material colors from settings 2024-04-19 11:13:59 +02:00
wmayer
74f614a93d 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
af317be718 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
a19afb0f7d 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
495a96a0f5 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
2a264241dc change default shape color 2024-02-18 14:12:22 -06:00
bdieterm
5fd298f064 Gui: fix ignored default shape color 2024-01-05 09:27:28 -06:00
bdieterm
ce41c0c391 Gui: fix partially initialized default transparency 2023-12-01 12:36:31 +01:00
wmayer
5a153e50ff Gui: modernize C++: use default member init 2023-08-23 19:51:44 +02:00
Uwe
6a68da4871 [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
75acacd1b7 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
c76913454a [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
19530b337f [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
779128b5f4 Gui: get rid of some const_cast 2022-06-28 15:26:02 +02:00
wmayer
96adb98f46 Gui: modernize C++11
* use nullptr
2022-03-23 18:41:21 +01:00
Uwe
9df800289b [Gui] ViewProviderFeature etc.: remove unused includes 2022-03-06 00:34:35 +01:00
Zheng, Lei
75e639c94c App/Gui: add new ObjectStatus TouchOnColorChange
For triggering recompute on color changes
2021-12-21 21:41:02 -07:00
wmayer
89b094683f Gui: support to customize the font size of bounding boxes 2021-03-02 16:29:57 +01:00
luz paz
298c677873 Gui: Fix header uniformity, whitespace, and doxygen fixes 2020-11-26 10:14:56 +01:00
carlopav
a262b11cd7 Gui: divide ViewProviderGeometryObject properties into groups
.


.


.


.
2020-08-21 12:36:46 +02:00
Zheng, Lei
45fd865fc0 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
db28dfbfb1 update bounding box if the placement of a geometry changes 2019-07-02 13:30:52 +02:00
wmayer
4b468ebed1 call updateData of base class for ViewProviderDragger and ViewProviderGeometryObject 2019-07-02 12:08:23 +02:00
wmayer
28b195d6e2 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
41ca90d223 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
519d02dd00 ViewProviderGeometryObject: set default random shape color to false 2018-04-21 13:51:51 +02:00
dulouie
d8b5b6938d fix small layout issues 2018-04-21 13:33:40 +02:00
Arne Schmidt
492f5057e2 random shapecolor with toggle in settings dialog 2018-04-21 13:33:40 +02:00
wmayer
0973dd5e7b add class ViewProviderDragger
derive ViewProviderGeometryObject from ViewProviderDragger
derive ViewProviderPart from ViewProviderDragger
2017-11-26 15:42:57 +01:00
wmayer
3b957a12b5 various minor changes:
+ whitespace improvement
+ code cleanup
2017-11-21 17:51:22 +01:00
Zheng, Lei
151d8a7b08 Gui: allow bounding box style to be customized 2017-04-01 11:09:03 -03:00