Creating a shape with Part.CompSolid(), Part.Compound() or Part.Shell() is a null shape. In order to allow to append sub-shapes with the add()
method a valid shape must be created beforehand.
This fixes#13208
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.
* Correctly load a file if colors are set per face
* Result of boolean operation is correctly colored if source objects have different colors
* Result of compound is correctly colored if source objects have different colors
* 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
This PR demonstrates the known regressions of the recently merged material branch:
* Changing the transparency after setting color per face will reset them
* The result of boolean operations or compound doesn't inherit the colour of its input objects
* If colour is set per face to a boolean operaton object then saving and restoring the file causes weird rendering behaviour
because material binding is set to PER_PART but only a single colour is defined
* If a shape inside a part container has set colour per face then saving and restoring as STEP file causes weird rendering
behaviour for the same reason
* Shape binder or datum objects don't show the correct default shape colour
The explicit activation of the MaterialWorkbench breaks the toolbars layout for every start. When fixing it manually it will be broken
again after the next start.
Because the core doesn't depend on the Material module it's a no-go to add an explicit runtime dependency to the corresponding workbench.
Since the Part module depends on the Materials module and the PartGui on MatGui the correct way is to let Part an PartGui load their
dependencies.
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.
* Added precompiler directive to use std::hash instead of HashCode(INT_MAX) if OCC_VERSION_HEX >= 0x070800
Signed-off-by: CalligaroV <vincenzo.calligaro@gmail.com>