diff --git a/src/Mod/Mesh/App/Mesh.cpp b/src/Mod/Mesh/App/Mesh.cpp index c3e691a60..43f619bed 100644 --- a/src/Mod/Mesh/App/Mesh.cpp +++ b/src/Mod/Mesh/App/Mesh.cpp @@ -679,7 +679,7 @@ unsigned long MeshObject::getPointDegree(const std::vector& indic unsigned long countInvalids = std::count_if(pointDeg.begin(), pointDeg.end(), std::bind2nd(std::equal_to(), 0)); - point_degree = pointDeg; + point_degree.swap(pointDeg); return countInvalids; } diff --git a/src/Mod/Mesh/Gui/ViewProvider.cpp b/src/Mod/Mesh/Gui/ViewProvider.cpp index c92a3335c..3cf05a785 100644 --- a/src/Mod/Mesh/Gui/ViewProvider.cpp +++ b/src/Mod/Mesh/Gui/ViewProvider.cpp @@ -1607,7 +1607,7 @@ void ViewProviderMesh::fillHole(unsigned long uFacet) if (newFacets.empty()) return; // nothing to do - + //add the facets to the mesh and open a transaction object for the undo/redo stuff Gui::Application::Instance->activeDocument()->openCommand("Fill hole"); Mesh::MeshObject* kernel = fea->Mesh.startEditing(); @@ -1621,6 +1621,30 @@ void ViewProviderMesh::removeFacets(const std::vector& facets) // Get the attached mesh property Mesh::PropertyMeshKernel& meshProp = static_cast(pcObject)->Mesh; Mesh::MeshObject* kernel = meshProp.startEditing(); + + // get the colour property if there + App::PropertyColorList* prop = getColorProperty(); + if (prop && prop->getSize() == static_cast(kernel->countPoints())) { + std::vector pointDegree; + unsigned long invalid = kernel->getPointDegree(facets, pointDegree); + if (invalid > 0) { + // switch off coloring mode + Coloring.setValue(false); + + const std::vector& colors = prop->getValues(); + std::vector valid_colors; + valid_colors.reserve(kernel->countPoints() - invalid); + std::size_t numPoints = pointDegree.size(); + for (std::size_t index = 0; index < numPoints; index++) { + if (pointDegree[index] > 0) { + valid_colors.push_back(colors[index]); + } + } + + prop->setValues(valid_colors); + } + } + //Remove the facets from the mesh and open a transaction object for the undo/redo stuff kernel->deleteFacets(facets); meshProp.finishEditing();