Updates the material preferences including selecting a default material
Preferences adds some options for what gets displayed in the Materials editor.
The option to use the legacy editor is removed in favour of the new
editor.
A new preference page has been added that allows the user to select a
default material. This will then be assigned to any newly created object. In
support of this, a new widget PrefsMaterialTreeWidget has been added as an
extension of the MaterialTreeWidget to automatically save and restore the
selected material.
* Create a compatibility module QtSvgWidgets.py to handle PySide2 & PySide6
* In the Arch and Material modules use the QtSvgWidgets module
* Since Qt6 the method QFont.setWeight() doesn't accept an int any more but requires an enum. Since the call of QFont.setBold(True) sets
a weight of 75 the extra calls of QFont.setWeight(75) can be safely removed
Co-authored-by: Adrián Insaurralde Avalos <36372335+adrianinsaval@users.noreply.github.com>
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.
Improves compatibility when using the legacy editor.
Corrects a number of issues that prevented saved files from being displayed when using the legacy editor.
Reduces the verbosity of console messages.
Rework of the material handling system.
This first part concntrates on a rework of the material cards.
Rather than use a fixed list of possible properties, properties can
be defined separately in their own files and mixed to provide a
complete list of possible properties. Properties can be inherited.
The cards then provide values for the properties. These can also
be inherited allowing for small changes in cards as required.
The new property definitions are more extensive than previously.
2 and 3 dimensional arrays of properties can be defined. Values
are obtained by calling an API instead of reading from a dictionary.
For compatibility, a Python dictionary of values can be obtained
similar to how it was done previously, but this is considered a
deprecated API and won't support the newer advanced features.
The editor is completely reworked. It will be able to edit older format
material cards, but can only save them in the new format.
For testing during the development phase, a system preference can
specifiy wether the old or new material editors are to be used. This
option will be removed before release.
This PR fixes the long-standing major bug that for languages using ',' as decimal separator the material editor was useless. (bug no. 10 in https://forum.freecad.org/viewtopic.php?t=56912)
the issue was that the value was handled as text. This PR:
- using a spinbox instead if a text edit to modify numbers (has also the advantage to be able to change values by spinning)
- sets min/max properly for all number data types
- also avoid rounding artifacts when changing Float values
- handle case that material cards are chosen from folders outside of the standard material folders
- also reduce singleStep size for spin edits for more convenience
- the material editor failed for Fluid materials because this info was not passed to it. Instead always solid materials were loaded.
- also fix warning about too long variable name and remove unnecessary debug code
- at the moment you get several warnings about missing icons when starting the Material editor
The reason is that they are not registered in CMake
- also remove icon from Material icon editor. As it is a child of FreeCAD it should have the same FreeCAD icon as all other FreeCAD widgets.
- also fix warning about too short variable name
- uses the constraint for 2D magnetodynamics to perform e.g. Elmer's tutorial non. 15
- modify the Material manager to get rid of magnetization but keep the vectorial functionality because in future there will be support for e.g. birefringence materials etc.
- for electromagnetics we have vector fields and thus need to specify components
- as first step use the new material "Magnetization"
- also get rid of annoying debug messages output on normal use in the material dialog
- isolate card tools for further use in other modules
- possible use of card tools in cmd mode
- add some methods for better card handling
- add some output methods for better card debuging
- editor, better names for methods
- add preference to sort cards and add duplicate cards too
- use icon in mat editor card combo box