rename material binding class member for faces to make clear its purpose

This commit is contained in:
wmayer
2017-04-24 14:53:05 +02:00
parent 6a4171c243
commit 7e977a8ecc
2 changed files with 14 additions and 14 deletions

View File

@@ -273,8 +273,8 @@ ViewProviderPartExt::ViewProviderPartExt()
nodeset = new SoBrepPointSet();
nodeset->ref();
pcShapeBind = new SoMaterialBinding();
pcShapeBind->ref();
pcFaceBind = new SoMaterialBinding();
pcFaceBind->ref();
pcLineBind = new SoMaterialBinding();
pcLineBind->ref();
@@ -308,7 +308,7 @@ ViewProviderPartExt::ViewProviderPartExt()
ViewProviderPartExt::~ViewProviderPartExt()
{
pcShapeBind->unref();
pcFaceBind->unref();
pcLineBind->unref();
pcLineMaterial->unref();
pcPointMaterial->unref();
@@ -391,7 +391,7 @@ void ViewProviderPartExt::onChanged(const App::Property* prop)
setHighlightedFaces(DiffuseColor.getValues());
}
else if (prop == &ShapeMaterial || prop == &ShapeColor) {
pcShapeBind->value = SoMaterialBinding::OVERALL;
pcFaceBind->value = SoMaterialBinding::OVERALL;
ViewProviderGeometryObject::onChanged(prop);
DiffuseColor.setValue(ShapeColor.getValue());
}
@@ -400,7 +400,7 @@ void ViewProviderPartExt::onChanged(const App::Property* prop)
long value = (long)(100*Mat.transparency);
if (value != Transparency.getValue()) {
float trans = Transparency.getValue()/100.0f;
if (pcShapeBind->value.getValue() == SoMaterialBinding::PER_PART) {
if (pcFaceBind->value.getValue() == SoMaterialBinding::PER_PART) {
int cnt = pcShapeMaterial->diffuseColor.getNum();
pcShapeMaterial->transparency.setNum(cnt);
float *t = pcShapeMaterial->transparency.startEditing();
@@ -480,7 +480,7 @@ void ViewProviderPartExt::attach(App::DocumentObject *pcFeat)
// just faces with no edges or points
pcFlatRoot->addChild(pShapeHints);
pcFlatRoot->addChild(pcShapeBind);
pcFlatRoot->addChild(pcFaceBind);
pcFlatRoot->addChild(pcShapeMaterial);
SoDrawStyle* pcFaceStyle = new SoDrawStyle();
pcFaceStyle->style = SoDrawStyle::FILLED;
@@ -643,7 +643,7 @@ void ViewProviderPartExt::setHighlightedFaces(const std::vector<App::Color>& col
{
int size = static_cast<int>(colors.size());
if (size > 1 && size == this->faceset->partIndex.getNum()) {
pcShapeBind->value = SoMaterialBinding::PER_PART;
pcFaceBind->value = SoMaterialBinding::PER_PART;
pcShapeMaterial->diffuseColor.setNum(size);
pcShapeMaterial->transparency.setNum(size);
SbColor* ca = pcShapeMaterial->diffuseColor.startEditing();
@@ -656,7 +656,7 @@ void ViewProviderPartExt::setHighlightedFaces(const std::vector<App::Color>& col
pcShapeMaterial->transparency.finishEditing();
}
else if (colors.size() == 1) {
pcShapeBind->value = SoMaterialBinding::OVERALL;
pcFaceBind->value = SoMaterialBinding::OVERALL;
pcShapeMaterial->diffuseColor.setValue(colors[0].r, colors[0].g, colors[0].b);
//pcShapeMaterial->transparency = colors[0].a; do not get transparency from DiffuseColor in this case
}
@@ -666,7 +666,7 @@ void ViewProviderPartExt::setHighlightedFaces(const std::vector<App::Material>&
{
int size = static_cast<int>(colors.size());
if (size > 1 && size == this->faceset->partIndex.getNum()) {
pcShapeBind->value = SoMaterialBinding::PER_PART;
pcFaceBind->value = SoMaterialBinding::PER_PART;
pcShapeMaterial->diffuseColor.setNum(size);
pcShapeMaterial->ambientColor.setNum(size);
@@ -691,7 +691,7 @@ void ViewProviderPartExt::setHighlightedFaces(const std::vector<App::Material>&
pcShapeMaterial->emissiveColor.finishEditing();
}
else if (colors.size() == 1) {
pcShapeBind->value = SoMaterialBinding::OVERALL;
pcFaceBind->value = SoMaterialBinding::OVERALL;
pcShapeMaterial->diffuseColor.setValue(colors[0].diffuseColor.r, colors[0].diffuseColor.g, colors[0].diffuseColor.b);
pcShapeMaterial->ambientColor.setValue(colors[0].ambientColor.r, colors[0].ambientColor.g, colors[0].ambientColor.b);
pcShapeMaterial->specularColor.setValue(colors[0].specularColor.r, colors[0].specularColor.g, colors[0].specularColor.b);
@@ -745,7 +745,7 @@ void ViewProviderPartExt::setHighlightedPoints(const std::vector<App::Color>& co
int size = static_cast<int>(colors.size());
if (size > 1) {
// FIXME: Check for size mismatch between number of points and number of colors
pcShapeBind->value = SoMaterialBinding::PER_VERTEX;
pcFaceBind->value = SoMaterialBinding::PER_VERTEX;
pcPointMaterial->diffuseColor.setNum(size);
SbColor* ca = pcPointMaterial->diffuseColor.startEditing();
for (int i = 0; i < size; ++i)
@@ -753,7 +753,7 @@ void ViewProviderPartExt::setHighlightedPoints(const std::vector<App::Color>& co
pcPointMaterial->diffuseColor.finishEditing();
}
else if (size == 1) {
pcShapeBind->value = SoMaterialBinding::OVERALL;
pcFaceBind->value = SoMaterialBinding::OVERALL;
pcPointMaterial->diffuseColor.setValue(colors[0].r, colors[0].g, colors[0].b);
}
}
@@ -818,7 +818,7 @@ void ViewProviderPartExt::updateData(const App::Property* prop)
if (!VisualTouched) {
if (this->faceset->partIndex.getNum() >
this->pcShapeMaterial->diffuseColor.getNum()) {
this->pcShapeBind->value = SoMaterialBinding::OVERALL;
this->pcFaceBind->value = SoMaterialBinding::OVERALL;
}
}
}

View File

@@ -145,7 +145,7 @@ protected:
TColgp_Array1OfDir& theNormals);
// nodes for the data representation
SoMaterialBinding * pcShapeBind;
SoMaterialBinding * pcFaceBind;
SoMaterialBinding * pcLineBind;
SoMaterial * pcLineMaterial;
SoMaterial * pcPointMaterial;