diff --git a/src/Gui/PreferencePackTemplates/Window_Colors.cfg b/src/Gui/PreferencePackTemplates/Window_Colors.cfg index 14d5c6b6b0..90ac23a715 100644 --- a/src/Gui/PreferencePackTemplates/Window_Colors.cfg +++ b/src/Gui/PreferencePackTemplates/Window_Colors.cfg @@ -13,6 +13,7 @@ + diff --git a/src/Gui/ViewParams.h b/src/Gui/ViewParams.h index ff55628400..b679f129fa 100644 --- a/src/Gui/ViewParams.h +++ b/src/Gui/ViewParams.h @@ -56,6 +56,7 @@ public: FC_VIEW_PARAM(DefaultShapeLineColor,unsigned long,Unsigned,421075455UL) \ FC_VIEW_PARAM(DefaultShapeVertexColor,unsigned long,Unsigned,421075455UL) \ FC_VIEW_PARAM(DefaultShapeColor,unsigned long,Unsigned,0xCCCCCC00) \ + FC_VIEW_PARAM(DefaultShapeTransparency,int,Int,0) \ FC_VIEW_PARAM(DefaultShapeLineWidth,int,Int,2) \ FC_VIEW_PARAM(DefaultShapePointSize,int,Int,2) \ FC_VIEW_PARAM(CoinCycleCheck,bool,Bool,true) \ diff --git a/src/Gui/ViewProviderGeometryObject.cpp b/src/Gui/ViewProviderGeometryObject.cpp index 4e277a43a9..f943ecc565 100644 --- a/src/Gui/ViewProviderGeometryObject.cpp +++ b/src/Gui/ViewProviderGeometryObject.cpp @@ -70,18 +70,20 @@ ViewProviderGeometryObject::ViewProviderGeometryObject() b = (float)rand()/fMax; } else { - unsigned long shcol = hGrp->GetUnsigned("DefaultShapeColor",3435973887UL); // light gray (204,204,204) + unsigned long shcol = hGrp->GetUnsigned("DefaultShapeColor", 3435973887UL); // light gray (204,204,204) r = ((shcol >> 24) & 0xff) / 255.0; g = ((shcol >> 16) & 0xff) / 255.0; b = ((shcol >> 8) & 0xff) / 255.0; } + int initialTransparency = hGrp->GetInt("DefaultShapeTransparency", 0); + static const char *dogroup = "Display Options"; static const char *sgroup = "Selection"; static const char *osgroup = "Object Style"; ADD_PROPERTY_TYPE(ShapeColor, (r, g, b), osgroup, App::Prop_None, "Set shape color"); - ADD_PROPERTY_TYPE(Transparency, (0), osgroup, App::Prop_None, "Set object transparency"); + ADD_PROPERTY_TYPE(Transparency, (initialTransparency), osgroup, App::Prop_None, "Set object transparency"); Transparency.setConstraints(&intPercent); App::Material mat(App::Material::DEFAULT); ADD_PROPERTY_TYPE(ShapeMaterial,(mat), osgroup, App::Prop_None, "Shape material"); @@ -95,6 +97,7 @@ ViewProviderGeometryObject::ViewProviderGeometryObject() pcShapeMaterial->ref(); //ShapeMaterial.touch(); materials are rarely used, so better to initialize with default shape color ShapeColor.touch(); + Transparency.touch(); pcBoundingBox = new Gui::SoFCBoundingBox; pcBoundingBox->ref(); diff --git a/src/Mod/Part/Gui/DlgSettingsObjectColor.cpp b/src/Mod/Part/Gui/DlgSettingsObjectColor.cpp index 28316770cd..16c5877537 100644 --- a/src/Mod/Part/Gui/DlgSettingsObjectColor.cpp +++ b/src/Mod/Part/Gui/DlgSettingsObjectColor.cpp @@ -59,6 +59,7 @@ void DlgSettingsObjectColor::saveSettings() // Part ui->DefaultShapeColor->onSave(); ui->checkRandomColor->onSave(); + ui->DefaultShapeTransparency->onSave(); ui->DefaultShapeLineColor->onSave(); ui->DefaultShapeLineWidth->onSave(); ui->DefaultShapeVertexColor->onSave(); @@ -75,6 +76,7 @@ void DlgSettingsObjectColor::loadSettings() // Part ui->DefaultShapeColor->onRestore(); ui->checkRandomColor->onRestore(); + ui->DefaultShapeTransparency->onRestore(); ui->DefaultShapeLineColor->onRestore(); ui->DefaultShapeLineWidth->onRestore(); ui->DefaultShapeVertexColor->onRestore(); diff --git a/src/Mod/Part/Gui/DlgSettingsObjectColor.ui b/src/Mod/Part/Gui/DlgSettingsObjectColor.ui index 0dae0d4f29..369bc8a79f 100644 --- a/src/Mod/Part/Gui/DlgSettingsObjectColor.ui +++ b/src/Mod/Part/Gui/DlgSettingsObjectColor.ui @@ -72,6 +72,41 @@ + + + + 182 + 0 + + + + Shape transparency + + + + + + + The default transparency for new shapes + + + % + + + 100 + + + 10 + + + DefaultShapeTransparency + + + View + + + + @@ -84,7 +119,7 @@ - + The default line color for new shapes @@ -104,7 +139,7 @@ - + @@ -117,7 +152,7 @@ - + The default line thickness for new shapes @@ -139,7 +174,7 @@ - + @@ -152,7 +187,7 @@ - + The default color for new vertices @@ -172,7 +207,7 @@ - + @@ -185,7 +220,7 @@ - + The default size for new vertices @@ -207,7 +242,7 @@ - + @@ -220,7 +255,7 @@ - + The color of bounding boxes in the 3D view @@ -240,7 +275,7 @@ - + @@ -253,7 +288,7 @@ - + The font size of bounding boxes in the 3D view @@ -264,12 +299,12 @@ 1 - - 64.000000000000000 - 2.000000000000000 + + 64.000000000000000 + 10.000000000000000 @@ -281,7 +316,7 @@ - + @@ -291,7 +326,7 @@ Bottom side of surface will be rendered the same way than top. -If not checked, it depends on the option "Backlight color" +If not checked, it depends on the option "Backlight color" (preferences section Display -> 3D View); either the backlight color will be used or black. @@ -405,11 +440,6 @@ will be used or black. QSpinBox
Gui/PrefWidgets.h
- - Gui::PrefDoubleSpinBox - QDoubleSpinBox -
Gui/PrefWidgets.h
-
Gui::PrefColorButton Gui::ColorButton @@ -420,6 +450,11 @@ will be used or black. QCheckBox
Gui/PrefWidgets.h
+ + Gui::PrefDoubleSpinBox + QDoubleSpinBox +
Gui/PrefWidgets.h
+
DefaultShapeColor diff --git a/src/Mod/Part/Gui/SectionCutting.ui b/src/Mod/Part/Gui/SectionCutting.ui index 36a0c38d36..11a0f4d94e 100644 --- a/src/Mod/Part/Gui/SectionCutting.ui +++ b/src/Mod/Part/Gui/SectionCutting.ui @@ -299,7 +299,7 @@ - If checked, the color and transparency + If checked, the color and transparency will be taken from the cut objects. Works only if all objects have the same values. @@ -334,7 +334,7 @@ Works only if all objects have the same values.
- + false @@ -347,6 +347,12 @@ Works only if all objects have the same values. Qt::Horizontal + + DefaultShapeTransparency + + + View + @@ -425,6 +431,11 @@ only created cuts will be visible Gui::ColorButton
Gui/PrefWidgets.h
+ + Gui::PrefSlider + QSlider +
Gui/PrefWidgets.h
+
Gui::PrefCheckBox QCheckBox diff --git a/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp b/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp index fefdab856e..36fdad51f6 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp @@ -248,7 +248,7 @@ void ViewProviderSubShapeBinder::onChanged(const App::Property* prop) { shapeColor.setPackedValue(Gui::ViewParams::instance()->getDefaultShapeColor()); lineColor.setPackedValue(Gui::ViewParams::instance()->getDefaultShapeLineColor()); pointColor = lineColor; - transparency = 0; + transparency = Gui::ViewParams::instance()->getDefaultShapeTransparency(); linewidth = Gui::ViewParams::instance()->getDefaultShapeLineWidth(); } ShapeColor.setValue(shapeColor);