Fem/Mesh: force update of shape nodes when changing the transparencies of a color plot

This commit is contained in:
wmayer
2022-04-01 16:40:34 +02:00
parent 5dff636cf8
commit d36c59b3dc
3 changed files with 21 additions and 1 deletions

View File

@@ -543,7 +543,10 @@ void ViewProviderFemPostObject::WriteColorData(bool ResetColorBarRange) {
m_material->diffuseColor.finishEditing();
m_material->transparency.finishEditing();
m_materialBinding->value = SoMaterialBinding::PER_VERTEX_INDEXED;
m_materialBinding->touch();
// In order to apply the transparency changes the shape nodes must be touched
m_faces->touch();
m_triangleStrips->touch();
}
void ViewProviderFemPostObject::WriteTransparency() {

View File

@@ -25,6 +25,7 @@
#ifndef _PreComp_
# include <Inventor/SoPickedPoint.h>
# include <Inventor/actions/SoSearchAction.h>
# include <Inventor/details/SoFaceDetail.h>
# include <Inventor/details/SoPointDetail.h>
# include <Inventor/events/SoMouseButtonEvent.h>
@@ -357,6 +358,21 @@ void ViewProviderMeshCurvature::setVertexCurvatureMode(int mode)
pcColorMat->diffuseColor.finishEditing();
pcColorMat->transparency.finishEditing();
// In order to apply the transparency changes the IndexFaceSet node must be touched
touchShapeNode();
}
void ViewProviderMeshCurvature::touchShapeNode()
{
SoSearchAction searchAction;
searchAction.setType(SoIndexedFaceSet::getClassTypeId());
searchAction.setInterest(SoSearchAction::FIRST);
searchAction.apply(pcLinkRoot);
SoPath* selectionPath = searchAction.getPath();
if (selectionPath) {
selectionPath->getTail()->touch();
}
}
QIcon ViewProviderMeshCurvature::getIcon() const

View File

@@ -97,6 +97,7 @@ protected:
void onChanged(const App::Property* prop);
void setVertexCurvatureMode(int mode);
std::string curvatureInfo(bool detail, int index1, int index2, int index3) const;
void touchShapeNode();
private:
void init(const Mesh::PropertyCurvatureList *prop);