Fem Postprocessing set color on nodes
This commit is contained in:
parent
3341bd964e
commit
c6fec1373d
|
@ -489,11 +489,34 @@ PyObject * ViewProviderFemMesh::getPyObject()
|
||||||
|
|
||||||
void ViewProviderFemMesh::setColorByNodeId(const std::map<long,App::Color> &NodeColorMap)
|
void ViewProviderFemMesh::setColorByNodeId(const std::map<long,App::Color> &NodeColorMap)
|
||||||
{
|
{
|
||||||
|
pcShapeMaterial->diffuseColor;
|
||||||
|
|
||||||
|
pcMatBinding->value = SoMaterialBinding::PER_VERTEX_INDEXED;
|
||||||
|
|
||||||
|
// resizing and writing the color vector:
|
||||||
|
pcShapeMaterial->diffuseColor.setNum(vNodeElementIdx.size());
|
||||||
|
SbColor* colors = pcShapeMaterial->diffuseColor.startEditing();
|
||||||
|
|
||||||
|
int i=0;
|
||||||
|
for(std::vector<unsigned long>::const_iterator it=vNodeElementIdx.begin()
|
||||||
|
;it!=vNodeElementIdx.end()
|
||||||
|
;++it,i++){
|
||||||
|
const std::map<long,App::Color>::const_iterator pos = NodeColorMap.find(*it);
|
||||||
|
if(pos == NodeColorMap.end())
|
||||||
|
colors[i] = SbColor(0,1,0);
|
||||||
|
else
|
||||||
|
colors[i] = SbColor(pos->second.r,pos->second.g,pos->second.b);
|
||||||
|
}
|
||||||
|
|
||||||
|
pcShapeMaterial->diffuseColor.finishEditing();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewProviderFemMesh::resetColorByNodeId(void)
|
void ViewProviderFemMesh::resetColorByNodeId(void)
|
||||||
{
|
{
|
||||||
|
pcMatBinding->value = SoMaterialBinding::OVERALL;
|
||||||
|
pcShapeMaterial->diffuseColor.setNum(0);
|
||||||
|
const App::Color& c = ShapeColor.getValue();
|
||||||
|
pcShapeMaterial->diffuseColor.setValue(c.r,c.g,c.b);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,6 @@ void ViewProviderFemMeshPy::setNodeColor(Py::Dict arg)
|
||||||
}
|
}
|
||||||
this->getViewProviderFemMeshPtr()->setColorByNodeId(NodeColorMap);
|
this->getViewProviderFemMeshPtr()->setColorByNodeId(NodeColorMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw Py::AttributeError("Not yet implemented");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Py::List ViewProviderFemMeshPy::getHighlightedNodes(void) const
|
Py::List ViewProviderFemMeshPy::getHighlightedNodes(void) const
|
||||||
|
|
Loading…
Reference in New Issue
Block a user