From ddcf247489fbffb6ec838d484b8a6f58a5f37be1 Mon Sep 17 00:00:00 2001 From: bdieterm Date: Mon, 1 Jan 2024 11:40:07 +0100 Subject: [PATCH] Gui: fix ignored default shape color --- src/Gui/ViewProviderGeometryObject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Gui/ViewProviderGeometryObject.cpp b/src/Gui/ViewProviderGeometryObject.cpp index c61b9ab0b1..38d8ab4409 100644 --- a/src/Gui/ViewProviderGeometryObject.cpp +++ b/src/Gui/ViewProviderGeometryObject.cpp @@ -84,6 +84,7 @@ ViewProviderGeometryObject::ViewProviderGeometryObject() ADD_PROPERTY_TYPE(Transparency, (initialTransparency), osgroup, App::Prop_None, "Set object transparency"); Transparency.setConstraints(&intPercent); App::Material mat(App::Material::DEFAULT); + mat.transparency = (float)initialTransparency / 100.0f; ADD_PROPERTY_TYPE(ShapeMaterial,(mat), osgroup, App::Prop_None, "Shape material"); ADD_PROPERTY_TYPE(BoundingBox, (false), dogroup, App::Prop_None, "Display object bounding box"); ADD_PROPERTY_TYPE(Selectable, (true), sgroup, App::Prop_None, "Set if the object is selectable in the 3d view"); @@ -94,7 +95,6 @@ ViewProviderGeometryObject::ViewProviderGeometryObject() pcShapeMaterial = new SoMaterial; pcShapeMaterial->diffuseColor.setValue(r, g, b); pcShapeMaterial->transparency = float(initialTransparency); - ShapeMaterial.setTransparency((float)initialTransparency / 100.0f); pcShapeMaterial->ref(); pcBoundingBox = new Gui::SoFCBoundingBox;