[Part] [PD] add preferences setting for transparency
- allow to specify the default transparency for new shapes
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
<FCInt Name="BacklightIntensity" Value="100"/>
|
||||
<FCUInt Name="BoundingBoxColor" Value="4294967295"/>
|
||||
<FCUInt Name="DefaultShapeColor" Value="3435973887"/>
|
||||
<FCInt Name="DefaultShapeTransparency" Value="0"/>
|
||||
<FCBool Name="EnableBacklight" Value="0"/>
|
||||
<FCBool Name="Gradient" Value="1"/>
|
||||
<FCUInt Name="HighlightColor" Value="4294907903"/>
|
||||
|
||||
@@ -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) \
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -72,6 +72,41 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_transparency">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>182</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Shape transparency</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="Gui::PrefSpinBox" name="DefaultShapeTransparency">
|
||||
<property name="toolTip">
|
||||
<string>The default transparency for new shapes</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string>%</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>DefaultShapeTransparency</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>View</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -84,7 +119,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="Gui::PrefColorButton" name="DefaultShapeLineColor">
|
||||
<property name="toolTip">
|
||||
<string>The default line color for new shapes</string>
|
||||
@@ -104,7 +139,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -117,7 +152,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="3" column="1">
|
||||
<widget class="Gui::PrefSpinBox" name="DefaultShapeLineWidth">
|
||||
<property name="toolTip">
|
||||
<string>The default line thickness for new shapes</string>
|
||||
@@ -139,7 +174,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -152,7 +187,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="4" column="1">
|
||||
<widget class="Gui::PrefColorButton" name="DefaultShapeVertexColor">
|
||||
<property name="toolTip">
|
||||
<string>The default color for new vertices</string>
|
||||
@@ -172,7 +207,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -185,7 +220,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="5" column="1">
|
||||
<widget class="Gui::PrefSpinBox" name="DefaultShapeVertexSize">
|
||||
<property name="toolTip">
|
||||
<string>The default size for new vertices</string>
|
||||
@@ -207,7 +242,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -220,7 +255,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="6" column="1">
|
||||
<widget class="Gui::PrefColorButton" name="BoundingBoxColor">
|
||||
<property name="toolTip">
|
||||
<string>The color of bounding boxes in the 3D view</string>
|
||||
@@ -240,7 +275,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_fontsize">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -253,7 +288,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="7" column="1">
|
||||
<widget class="Gui::PrefDoubleSpinBox" name="BoundingBoxFontSize">
|
||||
<property name="toolTip">
|
||||
<string>The font size of bounding boxes in the 3D view</string>
|
||||
@@ -264,12 +299,12 @@
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>64.000000000000000</double>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>2.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>64.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>10.000000000000000</double>
|
||||
</property>
|
||||
@@ -281,7 +316,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<item row="8" column="0">
|
||||
<widget class="Gui::PrefCheckBox" name="twosideRendering">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -291,7 +326,7 @@
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>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.</string>
|
||||
</property>
|
||||
@@ -405,11 +440,6 @@ will be used or black.</string>
|
||||
<extends>QSpinBox</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Gui::PrefDoubleSpinBox</class>
|
||||
<extends>QDoubleSpinBox</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Gui::PrefColorButton</class>
|
||||
<extends>Gui::ColorButton</extends>
|
||||
@@ -420,6 +450,11 @@ will be used or black.</string>
|
||||
<extends>QCheckBox</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Gui::PrefDoubleSpinBox</class>
|
||||
<extends>QDoubleSpinBox</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>DefaultShapeColor</tabstop>
|
||||
|
||||
@@ -299,7 +299,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>If checked, the color and transparency
|
||||
<string>If checked, the color and transparency
|
||||
will be taken from the cut objects.
|
||||
Works only if all objects have the same values.</string>
|
||||
</property>
|
||||
@@ -334,7 +334,7 @@ Works only if all objects have the same values.</string>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QSlider" name="CutTransparency">
|
||||
<widget class="Gui::PrefSlider" name="CutTransparency">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
@@ -347,6 +347,12 @@ Works only if all objects have the same values.</string>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="prefEntry">
|
||||
<cstring>DefaultShapeTransparency</cstring>
|
||||
</property>
|
||||
<property name="prefPath">
|
||||
<cstring>View</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -425,6 +431,11 @@ only created cuts will be visible</string>
|
||||
<extends>Gui::ColorButton</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Gui::PrefSlider</class>
|
||||
<extends>QSlider</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Gui::PrefCheckBox</class>
|
||||
<extends>QCheckBox</extends>
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user