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.
This commit is contained in:
David Carter
2024-03-17 18:37:56 -04:00
committed by Chris Hennes
parent 37c38acd19
commit ba20441935
121 changed files with 4682 additions and 1685 deletions

View File

@@ -33,17 +33,19 @@ class SoSensor;
class SbVec2s;
class SoBaseColor;
namespace Gui {
namespace Gui
{
class SoFCSelection;
class SoFCBoundingBox;
class View3DInventorViewer;
/**
* The base class for all view providers that display geometric data, like mesh, point clouds and shapes.
* The base class for all view providers that display geometric data, like mesh, point clouds and
* shapes.
* @author Werner Mayer
*/
class GuiExport ViewProviderGeometryObject : public ViewProviderDragger
class GuiExport ViewProviderGeometryObject: public ViewProviderDragger
{
PROPERTY_HEADER_WITH_OVERRIDE(Gui::ViewProviderGeometryObject);
@@ -55,30 +57,35 @@ public:
~ViewProviderGeometryObject() override;
// Display properties
App::PropertyColor ShapeColor;
App::PropertyPercent Transparency;
App::PropertyMaterial ShapeMaterial;
// App::PropertyMaterial ShapeMaterial; // Default appearance and physical properties
App::PropertyMaterialList ShapeAppearance; // May be different from material
App::PropertyBool BoundingBox;
App::PropertyBool Selectable;
/**
* Attaches the document object to this view provider.
*/
void attach(App::DocumentObject *pcObject) override;
void attach(App::DocumentObject* pcObject) override;
void updateData(const App::Property*) override;
bool isSelectable() const override {return Selectable.getValue();}
bool isSelectable() const override
{
return Selectable.getValue();
}
/**
* Returns a list of picked points from the geometry under \a getRoot().
* If \a pickAll is false (the default) only the intersection point closest to the camera will be picked, otherwise
* all intersection points will be picked.
* If \a pickAll is false (the default) only the intersection point closest to the camera will
* be picked, otherwise all intersection points will be picked.
*/
SoPickedPointList getPickedPoints(const SbVec2s& pos, const View3DInventorViewer& viewer,bool pickAll=false) const;
SoPickedPointList getPickedPoints(const SbVec2s& pos,
const View3DInventorViewer& viewer,
bool pickAll = false) const;
/**
* This method is provided for convenience and does basically the same as getPickedPoints() unless that only the closest
* point to the camera will be picked.
* \note It is in the response of the client programmer to delete the returned SoPickedPoint object.
* This method is provided for convenience and does basically the same as getPickedPoints()
* unless that only the closest point to the camera will be picked. \note It is in the response
* of the client programmer to delete the returned SoPickedPoint object.
*/
SoPickedPoint* getPickedPoint(const SbVec2s& pos, const View3DInventorViewer& viewer) const;
@@ -87,21 +94,29 @@ public:
virtual void showBoundingBox(bool);
//@}
/// Get the python wrapper for that ViewProvider
PyObject* getPyObject() override;
protected:
/// get called by the container whenever a property has been changed
void onChanged(const App::Property* prop) override;
void setSelectable(bool Selectable=true);
void setSelectable(bool Selectable = true);
virtual unsigned long getBoundColor() const;
void setSoMaterial(const App::Material& source);
void handleChangedPropertyName(Base::XMLReader& reader,
const char* TypeName,
const char* PropName) override;
protected:
SoMaterial * pcShapeMaterial{nullptr};
SoFCBoundingBox * pcBoundingBox{nullptr};
SoSwitch * pcBoundSwitch{nullptr};
SoBaseColor * pcBoundColor{nullptr};
SoMaterial* pcShapeMaterial {nullptr};
SoFCBoundingBox* pcBoundingBox {nullptr};
SoSwitch* pcBoundSwitch {nullptr};
SoBaseColor* pcBoundColor {nullptr};
};
} // namespace Gui
} // namespace Gui
#endif // GUI_VIEWPROVIDER_GEOMETRYOBJECT_H
#endif // GUI_VIEWPROVIDER_GEOMETRYOBJECT_H