0000630: User-defined defaults for shape colors
The default colors for new geometry (light grey + 2px black line) are now a user preference (In Display->Colors properties)
This commit is contained in:
@@ -63,14 +63,17 @@
|
||||
|
||||
using namespace Gui;
|
||||
|
||||
|
||||
PROPERTY_SOURCE(Gui::ViewProviderGeometryObject, Gui::ViewProviderDocumentObject)
|
||||
|
||||
const App::PropertyIntegerConstraint::Constraints intPercent = {0,100,1};
|
||||
|
||||
ViewProviderGeometryObject::ViewProviderGeometryObject() : pcBoundSwitch(0)
|
||||
{
|
||||
ADD_PROPERTY(ShapeColor,(0.8f,0.8f,0.8f));
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
|
||||
unsigned long shcol = hGrp->GetUnsigned("DefaultShapeColor",3435973887UL); // light gray (204,204,204)
|
||||
float r,g,b;
|
||||
r = ((shcol >> 24) & 0xff) / 255.0; g = ((shcol >> 16) & 0xff) / 255.0; b = ((shcol >> 8) & 0xff) / 255.0;
|
||||
ADD_PROPERTY(ShapeColor,(r, g, b));
|
||||
ADD_PROPERTY(Transparency,(0));
|
||||
Transparency.setConstraints(&intPercent);
|
||||
App::Material mat(App::Material::DEFAULT);
|
||||
@@ -86,7 +89,8 @@ ViewProviderGeometryObject::ViewProviderGeometryObject() : pcBoundSwitch(0)
|
||||
|
||||
pcShapeMaterial = new SoMaterial;
|
||||
pcShapeMaterial->ref();
|
||||
ShapeMaterial.touch();
|
||||
//ShapeMaterial.touch(); materials are rarely used, so better to initialize with default shape color
|
||||
ShapeColor.touch();
|
||||
|
||||
pcBoundingBox = new Gui::SoFCBoundingBox;
|
||||
pcBoundingBox->ref();
|
||||
|
||||
Reference in New Issue
Block a user