Merge pull request #4954 from ageeye/FixDefaultShapeVertexColor
Part: Fix default shape vertex color
This commit is contained in:
@@ -54,6 +54,7 @@ public:
|
||||
FC_VIEW_PARAM(MarkerSize,int,Int,9) \
|
||||
FC_VIEW_PARAM(DefaultLinkColor,unsigned long,Unsigned,0x66FFFF00) \
|
||||
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(DefaultShapeLineWidth,int,Int,2) \
|
||||
FC_VIEW_PARAM(DefaultShapePointSize,int,Int,2) \
|
||||
|
||||
@@ -236,11 +236,18 @@ ViewProviderPartExt::ViewProviderPartExt()
|
||||
forceUpdateCount = 0;
|
||||
NormalsFromUV = true;
|
||||
|
||||
// get default line color
|
||||
unsigned long lcol = Gui::ViewParams::instance()->getDefaultShapeLineColor(); // dark grey (25,25,25)
|
||||
float r,g,b;
|
||||
r = ((lcol >> 24) & 0xff) / 255.0; g = ((lcol >> 16) & 0xff) / 255.0; b = ((lcol >> 8) & 0xff) / 255.0;
|
||||
float lr,lg,lb;
|
||||
lr = ((lcol >> 24) & 0xff) / 255.0; lg = ((lcol >> 16) & 0xff) / 255.0; lb = ((lcol >> 8) & 0xff) / 255.0;
|
||||
// get default vertex color
|
||||
unsigned long vcol = Gui::ViewParams::instance()->getDefaultShapeVertexColor();
|
||||
float vr,vg,vb;
|
||||
vr = ((vcol >> 24) & 0xff) / 255.0; vg = ((vcol >> 16) & 0xff) / 255.0; vb = ((vcol >> 8) & 0xff) / 255.0;
|
||||
int lwidth = Gui::ViewParams::instance()->getDefaultShapeLineWidth();
|
||||
int psize = Gui::ViewParams::instance()->getDefaultShapePointSize();
|
||||
|
||||
|
||||
|
||||
ParameterGrp::handle hPart = App::GetApplication().GetParameterGroupByPath
|
||||
("User parameter:BaseApp/Preferences/Mod/Part");
|
||||
@@ -256,17 +263,26 @@ ViewProviderPartExt::ViewProviderPartExt()
|
||||
|
||||
static const char *osgroup = "Object Style";
|
||||
|
||||
App::Material mat;
|
||||
mat.ambientColor.set(0.2f,0.2f,0.2f);
|
||||
mat.diffuseColor.set(r,g,b);
|
||||
mat.specularColor.set(0.0f,0.0f,0.0f);
|
||||
mat.emissiveColor.set(0.0f,0.0f,0.0f);
|
||||
mat.shininess = 1.0f;
|
||||
mat.transparency = 0.0f;
|
||||
ADD_PROPERTY_TYPE(LineMaterial,(mat), osgroup, App::Prop_None, "Object line material.");
|
||||
ADD_PROPERTY_TYPE(PointMaterial,(mat), osgroup, App::Prop_None, "Object point material.");
|
||||
ADD_PROPERTY_TYPE(LineColor, (mat.diffuseColor), osgroup, App::Prop_None, "Set object line color.");
|
||||
ADD_PROPERTY_TYPE(PointColor, (mat.diffuseColor), osgroup, App::Prop_None, "Set object point color");
|
||||
App::Material lmat;
|
||||
lmat.ambientColor.set(0.2f,0.2f,0.2f);
|
||||
lmat.diffuseColor.set(lr,lg,lb);
|
||||
lmat.specularColor.set(0.0f,0.0f,0.0f);
|
||||
lmat.emissiveColor.set(0.0f,0.0f,0.0f);
|
||||
lmat.shininess = 1.0f;
|
||||
lmat.transparency = 0.0f;
|
||||
|
||||
App::Material vmat;
|
||||
vmat.ambientColor.set(0.2f,0.2f,0.2f);
|
||||
vmat.diffuseColor.set(vr,vg,vb);
|
||||
vmat.specularColor.set(0.0f,0.0f,0.0f);
|
||||
vmat.emissiveColor.set(0.0f,0.0f,0.0f);
|
||||
vmat.shininess = 1.0f;
|
||||
vmat.transparency = 0.0f;
|
||||
|
||||
ADD_PROPERTY_TYPE(LineMaterial,(lmat), osgroup, App::Prop_None, "Object line material.");
|
||||
ADD_PROPERTY_TYPE(PointMaterial,(vmat), osgroup, App::Prop_None, "Object point material.");
|
||||
ADD_PROPERTY_TYPE(LineColor, (lmat.diffuseColor), osgroup, App::Prop_None, "Set object line color.");
|
||||
ADD_PROPERTY_TYPE(PointColor, (vmat.diffuseColor), osgroup, App::Prop_None, "Set object point color");
|
||||
ADD_PROPERTY_TYPE(PointColorArray, (PointColor.getValue()), osgroup, App::Prop_None, "Object point color array.");
|
||||
ADD_PROPERTY_TYPE(DiffuseColor,(ShapeColor.getValue()), osgroup, App::Prop_None, "Object diffuse color.");
|
||||
ADD_PROPERTY_TYPE(LineColorArray,(LineColor.getValue()), osgroup, App::Prop_None, "Object line color array.");
|
||||
|
||||
Reference in New Issue
Block a user