always update colors after updating shape to get rid of previously set transparency

This commit is contained in:
wmayer
2017-08-11 10:26:54 +02:00
parent 172cbcd775
commit d896d11fa4
2 changed files with 6 additions and 22 deletions

View File

@@ -110,27 +110,23 @@ void ViewProviderBoolean::updateData(const App::Property* prop)
applyTransparency(static_cast<PartGui::ViewProviderPart*>(vpBase)->Transparency.getValue(),colBase);
applyTransparency(static_cast<PartGui::ViewProviderPart*>(vpTool)->Transparency.getValue(),colTool);
bool setColor=false;
if (static_cast<int>(colBase.size()) == baseMap.Extent()) {
applyColor(hist[0], colBase, colBool);
setColor = true;
}
else if (!colBase.empty() && colBase[0] != this->ShapeColor.getValue()) {
colBase.resize(baseMap.Extent(), colBase[0]);
applyColor(hist[0], colBase, colBool);
setColor = true;
}
if (static_cast<int>(colTool.size()) == toolMap.Extent()) {
applyColor(hist[1], colTool, colBool);
setColor = true;
}
else if (!colTool.empty() && colTool[0] != this->ShapeColor.getValue()) {
colTool.resize(toolMap.Extent(), colTool[0]);
applyColor(hist[1], colTool, colBool);
setColor = true;
}
if (setColor)
this->DiffuseColor.setValues(colBool);
this->DiffuseColor.setValues(colBool);
}
}
}
@@ -194,7 +190,6 @@ void ViewProviderMultiFuse::updateData(const App::Property* prop)
std::vector<App::Color> colBool;
colBool.resize(boolMap.Extent(), this->ShapeColor.getValue());
bool setColor=false;
int index=0;
for (std::vector<App::DocumentObject*>::iterator it = sources.begin(); it != sources.end(); ++it, ++index) {
Part::Feature* objBase = dynamic_cast<Part::Feature*>(*it);
@@ -211,18 +206,15 @@ void ViewProviderMultiFuse::updateData(const App::Property* prop)
applyTransparency(static_cast<PartGui::ViewProviderPart*>(vpBase)->Transparency.getValue(),colBase);
if (static_cast<int>(colBase.size()) == baseMap.Extent()) {
applyColor(hist[index], colBase, colBool);
setColor = true;
}
else if (!colBase.empty() && colBase[0] != this->ShapeColor.getValue()) {
colBase.resize(baseMap.Extent(), colBase[0]);
applyColor(hist[index], colBase, colBool);
setColor = true;
}
}
}
if (setColor)
this->DiffuseColor.setValues(colBool);
this->DiffuseColor.setValues(colBool);
}
else if (prop->getTypeId() == App::PropertyLinkList::getClassTypeId()) {
std::vector<App::DocumentObject*> pShapes = static_cast<const App::PropertyLinkList*>(prop)->getValues();
@@ -326,7 +318,6 @@ void ViewProviderMultiCommon::updateData(const App::Property* prop)
std::vector<App::Color> colBool;
colBool.resize(boolMap.Extent(), this->ShapeColor.getValue());
bool setColor=false;
int index=0;
for (std::vector<App::DocumentObject*>::iterator it = sources.begin(); it != sources.end(); ++it, ++index) {
Part::Feature* objBase = dynamic_cast<Part::Feature*>(*it);
@@ -343,18 +334,15 @@ void ViewProviderMultiCommon::updateData(const App::Property* prop)
applyTransparency(static_cast<PartGui::ViewProviderPart*>(vpBase)->Transparency.getValue(),colBase);
if (static_cast<int>(colBase.size()) == baseMap.Extent()) {
applyColor(hist[index], colBase, colBool);
setColor = true;
}
else if (!colBase.empty() && colBase[0] != this->ShapeColor.getValue()) {
colBase.resize(baseMap.Extent(), colBase[0]);
applyColor(hist[index], colBase, colBool);
setColor = true;
}
}
}
if (setColor)
this->DiffuseColor.setValues(colBool);
this->DiffuseColor.setValues(colBool);
}
else if (prop->getTypeId() == App::PropertyLinkList::getClassTypeId()) {
std::vector<App::DocumentObject*> pShapes = static_cast<const App::PropertyLinkList*>(prop)->getValues();

View File

@@ -81,7 +81,6 @@ void ViewProviderCompound::updateData(const App::Property* prop)
std::vector<App::Color> compCol;
compCol.resize(compMap.Extent(), this->ShapeColor.getValue());
bool setColor=false;
int index=0;
for (std::vector<App::DocumentObject*>::iterator it = sources.begin(); it != sources.end(); ++it, ++index) {
Part::Feature* objBase = dynamic_cast<Part::Feature*>(*it);
@@ -98,17 +97,14 @@ void ViewProviderCompound::updateData(const App::Property* prop)
applyTransparency(static_cast<PartGui::ViewProviderPart*>(vpBase)->Transparency.getValue(),baseCol);
if (static_cast<int>(baseCol.size()) == baseMap.Extent()) {
applyColor(hist[index], baseCol, compCol);
setColor = true;
}
else if (!baseCol.empty() && baseCol[0] != this->ShapeColor.getValue()) {
baseCol.resize(baseMap.Extent(), baseCol[0]);
applyColor(hist[index], baseCol, compCol);
setColor = true;
}
}
if (setColor)
this->DiffuseColor.setValues(compCol);
this->DiffuseColor.setValues(compCol);
}
else if (prop->getTypeId() == App::PropertyLinkList::getClassTypeId()) {
const std::vector<App::DocumentObject *>& pBases = static_cast<const App::PropertyLinkList*>(prop)->getValues();