diff --git a/src/Gui/Application.h b/src/Gui/Application.h index b63cf1fa1135..8a6018a6e728 100644 --- a/src/Gui/Application.h +++ b/src/Gui/Application.h @@ -243,6 +243,8 @@ class GuiExport Application static PyObject* sInsert (PyObject *self,PyObject *args); // open Python scripts static PyObject* sExport (PyObject *self,PyObject *args); + static PyObject* sCoinRemoveAllChildren (PyObject *self,PyObject *args); + static PyObject* sActiveDocument (PyObject *self,PyObject *args); static PyObject* sSetActiveDocument (PyObject *self,PyObject *args); static PyObject* sActiveView (PyObject *self,PyObject *args); diff --git a/src/Gui/ApplicationPy.cpp b/src/Gui/ApplicationPy.cpp index 60ebe708a255..a2119f0e0abc 100644 --- a/src/Gui/ApplicationPy.cpp +++ b/src/Gui/ApplicationPy.cpp @@ -197,6 +197,9 @@ PyMethodDef Application::Methods[] = { "removeDocumentObserver() -> None\n\n" "Remove an added document observer."}, + {"coinRemoveAllChildren", (PyCFunction) Application::sCoinRemoveAllChildren, METH_VARARGS, + "Remove all children from a group node"}, + {NULL, NULL, 0, NULL} /* Sentinel */ }; @@ -1327,3 +1330,18 @@ PyObject* Application::sRemoveDocObserver(PyObject * /*self*/, PyObject *args) Py_Return; } PY_CATCH; } + +PyObject* Application::sCoinRemoveAllChildren(PyObject * /*self*/, PyObject *args) +{ + PyObject *pynode; + if (!PyArg_ParseTuple(args, "O", &pynode)) + return NULL; + + PY_TRY { + void* ptr = 0; + Base::Interpreter().convertSWIGPointerObj("pivy.coin","_p_SoGroup", pynode, &ptr, 0); + coinRemoveAllChildren(reinterpret_cast(ptr)); + Py_Return; + }PY_CATCH; +} + diff --git a/src/Gui/Document.cpp b/src/Gui/Document.cpp index 781e1b172d86..c0683149dbf1 100644 --- a/src/Gui/Document.cpp +++ b/src/Gui/Document.cpp @@ -1559,7 +1559,7 @@ void Document::handleChildren3D(ViewProvider* viewProvider) if (childGroup->getNumChildren() != static_cast(children.size())) { rebuild = true; - childGroup->removeAllChildren(); + Gui::coinRemoveAllChildren(childGroup); for (std::vector::iterator it=children.begin();it!=children.end();++it) { ViewProvider* ChildViewProvider = getViewProvider(*it); diff --git a/src/Gui/FreeCADGuiInit.py b/src/Gui/FreeCADGuiInit.py index 36ea3d80ac59..a15c50e19f26 100644 --- a/src/Gui/FreeCADGuiInit.py +++ b/src/Gui/FreeCADGuiInit.py @@ -171,6 +171,21 @@ def InitApplications(): Gui.addWorkbench(NoneWorkbench()) +# Monkey patching pivy.coin.SoGroup.removeAllChildren to work around a bug +# https://bitbucket.org/Coin3D/coin/pull-requests/119/fix-sochildlist-auditing/diff + +def _SoGroup_init(self,*args): + import types + _SoGroup_init_orig(self,*args) + self.removeAllChildren = \ + types.MethodType(FreeCADGui.coinRemoveAllChildren,self) +try: + from pivy import coin + _SoGroup_init_orig = coin.SoGroup.__init__ + coin.SoGroup.__init__ = _SoGroup_init +except Exception: + pass + # init modules InitApplications() diff --git a/src/Gui/ManualAlignment.cpp b/src/Gui/ManualAlignment.cpp index 8ae2323f09a2..71f5546b3c32 100644 --- a/src/Gui/ManualAlignment.cpp +++ b/src/Gui/ManualAlignment.cpp @@ -848,8 +848,8 @@ void ManualAlignment::startAlignment(Base::Type mousemodel) void ManualAlignment::continueAlignment() { myFixedGroup.clearPoints(); - d->picksepLeft->removeAllChildren(); - d->picksepRight->removeAllChildren(); + coinRemoveAllChildren(d->picksepLeft); + coinRemoveAllChildren(d->picksepRight); if (!myAlignModel.isEmpty()) { AlignmentGroup& grp = myAlignModel.activeGroup(); @@ -891,8 +891,8 @@ void ManualAlignment::reset() myFixedGroup.setAlignable(false); myFixedGroup.clear(); - d->picksepLeft->removeAllChildren(); - d->picksepRight->removeAllChildren(); + coinRemoveAllChildren(d->picksepLeft); + coinRemoveAllChildren(d->picksepRight); if (myDocument) { this->connectDocumentDeletedObject.disconnect(); @@ -1186,8 +1186,8 @@ void ManualAlignment::onClear() myAlignModel.activeGroup().clear(); myFixedGroup.clear(); - d->picksepLeft->removeAllChildren(); - d->picksepRight->removeAllChildren(); + coinRemoveAllChildren(d->picksepLeft); + coinRemoveAllChildren(d->picksepRight); } void ManualAlignment::onCancel() diff --git a/src/Gui/SoFCColorGradient.cpp b/src/Gui/SoFCColorGradient.cpp index fee16b16d25f..fc993ce0b4ce 100644 --- a/src/Gui/SoFCColorGradient.cpp +++ b/src/Gui/SoFCColorGradient.cpp @@ -39,6 +39,7 @@ #include "DlgSettingsColorGradientImp.h" #include "MainWindow.h" #include "MDIView.h" +#include "ViewProvider.h" using namespace Gui; @@ -83,7 +84,7 @@ void SoFCColorGradient::finish() void SoFCColorGradient::setMarkerLabel( const SoMFString& label ) { - labels->removeAllChildren(); + coinRemoveAllChildren(labels); float fH=8.0f; int num = label.getNum(); @@ -294,7 +295,7 @@ void SoFCColorGradient::rebuildGradient() // first clear the children if ( getNumChildren() > 0 ) - removeAllChildren(); + coinRemoveAllChildren(this); addChild(ttype); addChild(labels); addChild(coords); diff --git a/src/Gui/SoFCColorLegend.cpp b/src/Gui/SoFCColorLegend.cpp index 78814e62134c..16a9118219d8 100644 --- a/src/Gui/SoFCColorLegend.cpp +++ b/src/Gui/SoFCColorLegend.cpp @@ -34,6 +34,7 @@ # include #endif +#include "ViewProvider.h" #include "SoFCColorLegend.h" @@ -81,7 +82,7 @@ void SoFCColorLegend::finish() void SoFCColorLegend::setMarkerLabel( const SoMFString& label ) { - labels->removeAllChildren(); + coinRemoveAllChildren(labels); int num = label.getNum(); if ( num > 1 ) @@ -234,7 +235,7 @@ void SoFCColorLegend::setColorModel( App::ColorGradient::TColorModel tModel ) // first clear the children if ( getNumChildren() > 0 ) - removeAllChildren(); + coinRemoveAllChildren(this); addChild(labels); addChild(coords); addChild(mat); diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index 8a5df66d454d..b934de871325 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -611,7 +611,7 @@ View3DInventorViewer::~View3DInventorViewer() // the root node but isn't destroyed when closing this viewer so // that it prevents all children from being deleted. To reduce this // likelihood we explicitly remove all child nodes now. - this->pcViewProviderRoot->removeAllChildren(); + coinRemoveAllChildren(this->pcViewProviderRoot); this->pcViewProviderRoot->unref(); this->pcViewProviderRoot = 0; this->backlight->unref(); @@ -3307,8 +3307,8 @@ void View3DInventorViewer::turnAllDimensionsOff() void View3DInventorViewer::eraseAllDimensions() { - static_cast(dimensionRoot->getChild(0))->removeAllChildren(); - static_cast(dimensionRoot->getChild(1))->removeAllChildren(); + coinRemoveAllChildren(static_cast(dimensionRoot->getChild(0))); + coinRemoveAllChildren(static_cast(dimensionRoot->getChild(1))); } void View3DInventorViewer::turn3dDimensionsOn() diff --git a/src/Gui/ViewProvider.cpp b/src/Gui/ViewProvider.cpp index 80c8f07a0ed5..27ad38ffd1f7 100644 --- a/src/Gui/ViewProvider.cpp +++ b/src/Gui/ViewProvider.cpp @@ -68,6 +68,24 @@ using namespace std; using namespace Gui; +namespace Gui { + +void coinRemoveAllChildren(SoGroup *group) { + if(!group) + return; + int count = group->getNumChildren(); + if(!count) + return; + FC_TRACE("coin remove all children " << count); + SbBool autonotify = group->enableNotify(FALSE); + for(;count>0;--count) + group->removeChild(count-1); + group->enableNotify(autonotify); + group->touch(); +} + +} // namespace Gui + //************************************************************************** //************************************************************************** // ViewProvider diff --git a/src/Gui/ViewProvider.h b/src/Gui/ViewProvider.h index 93ba62a3a96b..9308464365e0 100644 --- a/src/Gui/ViewProvider.h +++ b/src/Gui/ViewProvider.h @@ -102,6 +102,11 @@ class CoinPtr: public boost::intrusive_ptr { } }; +/** Helper function to deal with bug in SoNode::removeAllChildren() + * + * @sa https://bitbucket.org/Coin3D/coin/pull-requests/119/fix-sochildlist-auditing/diff + */ +void GuiExport coinRemoveAllChildren(SoGroup *node); /** General interface for all visual stuff in FreeCAD * This class is used to generate and handle all around diff --git a/src/Gui/ViewProviderInventorObject.cpp b/src/Gui/ViewProviderInventorObject.cpp index f802d4a702cf..0dee18dbe257 100644 --- a/src/Gui/ViewProviderInventorObject.cpp +++ b/src/Gui/ViewProviderInventorObject.cpp @@ -95,7 +95,7 @@ void ViewProviderInventorObject::updateData(const App::Property* prop) // read from buffer SoInput in; std::string buffer = ivObj->Buffer.getValue(); - pcBuffer->removeAllChildren(); + coinRemoveAllChildren(pcBuffer); if (buffer.empty()) return; in.setBuffer((void *)buffer.c_str(), buffer.size()); SoSeparator * node = SoDB::readAll(&in); @@ -112,7 +112,7 @@ void ViewProviderInventorObject::updateData(const App::Property* prop) QString fn = QString::fromUtf8(filename); QFile file(fn); SoInput in; - pcFile->removeAllChildren(); + coinRemoveAllChildren(pcFile); if (!fn.isEmpty() && file.open(QFile::ReadOnly)) { QByteArray buffer = file.readAll(); in.setBuffer((void *)buffer.constData(), buffer.length()); diff --git a/src/Gui/ViewProviderVRMLObject.cpp b/src/Gui/ViewProviderVRMLObject.cpp index f54f8cc4bf09..3fd616dd6900 100644 --- a/src/Gui/ViewProviderVRMLObject.cpp +++ b/src/Gui/ViewProviderVRMLObject.cpp @@ -216,7 +216,7 @@ void ViewProviderVRMLObject::updateData(const App::Property* prop) QString fn = QString::fromUtf8(filename); QFile file(fn); SoInput in; - pcVRML->removeAllChildren(); + coinRemoveAllChildren(pcVRML); if (!fn.isEmpty() && file.open(QFile::ReadOnly)) { QFileInfo fi(fn); QByteArray filepath = fi.absolutePath().toUtf8(); diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraintBearing.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraintBearing.cpp index b1aa7b76838c..c36ae9ae8c2c 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraintBearing.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraintBearing.cpp @@ -118,7 +118,7 @@ void ViewProviderFemConstraintBearing::updateData(const App::Property* prop) if (strcmp(prop->getName(),"BasePoint") == 0) { // Remove and recreate the symbol - pShapeSep->removeAllChildren(); + Gui::coinRemoveAllChildren(pShapeSep); // This should always point outside of the cylinder Base::Vector3d normal = pcConstraint->NormalDirection.getValue(); diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraintContact.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraintContact.cpp index eae13949e04b..25faff7f4441 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraintContact.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraintContact.cpp @@ -121,7 +121,7 @@ void ViewProviderFemConstraintContact::updateData(const App::Property* prop) std::vector::const_iterator n = normals.begin(); // Points and Normals are always updated together - pShapeSep->removeAllChildren(); + Gui::coinRemoveAllChildren(pShapeSep); for (std::vector::const_iterator p = points.begin(); p != points.end(); p++) { //Define base and normal directions diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraintDisplacement.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraintDisplacement.cpp index 4929cebe1c8c..7b192234c01e 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraintDisplacement.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraintDisplacement.cpp @@ -186,7 +186,7 @@ void ViewProviderFemConstraintDisplacement::updateData(const App::Property* prop int idrotz = 0; #else // Note: Points and Normals are always updated together - pShapeSep->removeAllChildren(); + Gui::coinRemoveAllChildren(pShapeSep); #endif for (std::vector::const_iterator p = points.begin(); p != points.end(); p++) { diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraintFixed.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraintFixed.cpp index 236526c6c89e..8f749bc4dde4 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraintFixed.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraintFixed.cpp @@ -143,7 +143,7 @@ void ViewProviderFemConstraintFixed::updateData(const App::Property* prop) int idx = 0; #else // Note: Points and Normals are always updated together - pShapeSep->removeAllChildren(); + Gui::coinRemoveAllChildren(pShapeSep); #endif for (std::vector::const_iterator p = points.begin(); p != points.end(); p++) { diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraintFluidBoundary.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraintFluidBoundary.cpp index dbfbe1a14ec2..4f5b5cc9d4b6 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraintFluidBoundary.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraintFluidBoundary.cpp @@ -170,7 +170,7 @@ void ViewProviderFemConstraintFluidBoundary::updateData(const App::Property* pro int idx = 0; #else // Redraw all arrows - pShapeSep->removeAllChildren(); + Gui::coinRemoveAllChildren(pShapeSep); #endif // This should always point outside of the solid Base::Vector3d normal = pcConstraint->NormalDirection.getValue(); @@ -272,7 +272,7 @@ void ViewProviderFemConstraintFluidBoundary::updateData(const App::Property* pro int idx = 0; #else // Note: Points and Normals are always updated together - pShapeSep->removeAllChildren(); + Gui::coinRemoveAllChildren(pShapeSep); #endif for (std::vector::const_iterator p = points.begin(); p != points.end(); p++) { diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraintForce.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraintForce.cpp index bb2203a253d4..8b3ddc4221bb 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraintForce.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraintForce.cpp @@ -139,7 +139,7 @@ void ViewProviderFemConstraintForce::updateData(const App::Property* prop) int idx = 0; #else // Redraw all arrows - pShapeSep->removeAllChildren(); + Gui::coinRemoveAllChildren(pShapeSep); #endif // This should always point outside of the solid Base::Vector3d normal = pcConstraint->NormalDirection.getValue(); diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraintGear.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraintGear.cpp index d2cf2cb48a0b..b6da90941576 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraintGear.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraintGear.cpp @@ -115,7 +115,7 @@ void ViewProviderFemConstraintGear::updateData(const App::Property* prop) if (strcmp(prop->getName(),"BasePoint") == 0) { if (pcConstraint->Height.getValue() > Precision::Confusion()) { // Remove and recreate the symbol - pShapeSep->removeAllChildren(); + Gui::coinRemoveAllChildren(pShapeSep); Base::Vector3d base = pcConstraint->BasePoint.getValue(); Base::Vector3d axis = pcConstraint->Axis.getValue(); diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraintHeatflux.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraintHeatflux.cpp index 37cec85e6d43..f4d24e51fbf4 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraintHeatflux.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraintHeatflux.cpp @@ -120,7 +120,7 @@ void ViewProviderFemConstraintHeatflux::updateData(const App::Property* prop) std::vector::const_iterator n = normals.begin(); // Note: Points and Normals are always updated together - pShapeSep->removeAllChildren(); + Gui::coinRemoveAllChildren(pShapeSep); for (std::vector::const_iterator p = points.begin(); p != points.end(); p++) { //Define base and normal directions diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraintPlaneRotation.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraintPlaneRotation.cpp index 8600488201cc..06b2902a681b 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraintPlaneRotation.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraintPlaneRotation.cpp @@ -119,7 +119,7 @@ void ViewProviderFemConstraintPlaneRotation::updateData(const App::Property* pro std::vector::const_iterator n = normals.begin(); // Points and Normals are always updated together - pShapeSep->removeAllChildren(); + Gui::coinRemoveAllChildren(pShapeSep); for (std::vector::const_iterator p = points.begin(); p != points.end(); p++) { //Define base and normal directions diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraintPressure.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraintPressure.cpp index 95a04c123558..8ea38cb8a178 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraintPressure.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraintPressure.cpp @@ -127,7 +127,7 @@ void ViewProviderFemConstraintPressure::updateData(const App::Property* prop) int idx = 0; #else // Redraw all arrows - pShapeSep->removeAllChildren(); + Gui::coinRemoveAllChildren(pShapeSep); #endif for (std::vector::const_iterator p = points.begin(); p != points.end(); p++) { diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraintPulley.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraintPulley.cpp index c634543bf386..d2bd82db33e0 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraintPulley.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraintPulley.cpp @@ -114,7 +114,7 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop) if (strcmp(prop->getName(),"BasePoint") == 0) { if (pcConstraint->Height.getValue() > Precision::Confusion()) { // Remove and recreate the symbol - pShapeSep->removeAllChildren(); + Gui::coinRemoveAllChildren(pShapeSep); // This should always point outside of the cylinder Base::Vector3d base = pcConstraint->BasePoint.getValue(); diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraintTemperature.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraintTemperature.cpp index 707d6227eb1c..b4c5753070c5 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraintTemperature.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraintTemperature.cpp @@ -119,7 +119,7 @@ void ViewProviderFemConstraintTemperature::updateData(const App::Property* prop) std::vector::const_iterator n = normals.begin(); // Note: Points and Normals are always updated together - pShapeSep->removeAllChildren(); + Gui::coinRemoveAllChildren(pShapeSep); for (std::vector::const_iterator p = points.begin(); p != points.end(); p++) { //Define base and normal directions diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraintTransform.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraintTransform.cpp index a70dcb8dc8e0..24e55d867619 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraintTransform.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraintTransform.cpp @@ -135,7 +135,7 @@ void ViewProviderFemConstraintTransform::updateData(const App::Property* prop) std::vector::const_iterator n = normals.begin(); // Points and Normals are always updated together - pShapeSep->removeAllChildren(); + Gui::coinRemoveAllChildren(pShapeSep); for (std::vector::const_iterator p = points.begin(); p != points.end(); p++) { SbVec3f base(p->x, p->y, p->z); @@ -269,7 +269,7 @@ void ViewProviderFemConstraintTransform::updateData(const App::Property* prop) } else if (transform_type == "Cylindrical") { // Points and Normals are always updated together - pShapeSep->removeAllChildren(); + Gui::coinRemoveAllChildren(pShapeSep); const std::vector& points = pcConstraint->Points.getValues(); const std::vector& normals = pcConstraint->Normals.getValues(); diff --git a/src/Mod/Inspection/Gui/ViewProviderInspection.cpp b/src/Mod/Inspection/Gui/ViewProviderInspection.cpp index 5b88fd03368a..83ec11beeca0 100644 --- a/src/Mod/Inspection/Gui/ViewProviderInspection.cpp +++ b/src/Mod/Inspection/Gui/ViewProviderInspection.cpp @@ -232,7 +232,7 @@ void ViewProviderInspection::updateData(const App::Property* prop) } } - this->pcLinkRoot->removeAllChildren(); + Gui::coinRemoveAllChildren(this->pcLinkRoot); this->pcLinkRoot->addChild(this->pcCoords); this->pcCoords->point.setNum(points.size()); SbVec3f* pts = this->pcCoords->point.startEditing(); diff --git a/src/Mod/Mesh/Gui/MeshEditor.cpp b/src/Mod/Mesh/Gui/MeshEditor.cpp index 749a0514e872..4e759d754de5 100644 --- a/src/Mod/Mesh/Gui/MeshEditor.cpp +++ b/src/Mod/Mesh/Gui/MeshEditor.cpp @@ -478,11 +478,11 @@ void MeshFillHole::startEditing(MeshGui::ViewProviderMesh* vp) myConnection = App::GetApplication().signalChangedObject.connect( boost::bind(&MeshFillHole::slotChangedObject, this, _1, _2)); - myBoundariesRoot->removeAllChildren(); + Gui::coinRemoveAllChildren(myBoundariesRoot); myBoundariesRoot->addChild(viewer->getHeadlight()); myBoundariesRoot->addChild(viewer->getSoRenderManager()->getCamera()); myBoundariesRoot->addChild(myBoundariesGroup); - myBoundaryRoot->removeAllChildren(); + Gui::coinRemoveAllChildren(myBoundaryRoot); myBoundaryRoot->addChild(viewer->getHeadlight()); myBoundaryRoot->addChild(viewer->getSoRenderManager()->getCamera()); createPolygons(); @@ -541,7 +541,7 @@ void MeshFillHole::closeBridge() void MeshFillHole::slotChangedObject(const App::DocumentObject& Obj, const App::Property& Prop) { if (&Obj == myMesh && strcmp(Prop.getName(),"Mesh") == 0) { - myBoundariesGroup->removeAllChildren(); + Gui::coinRemoveAllChildren(myBoundariesGroup); myVertex->point.setNum(0); myNumPoints = 0; myPolygon.clear(); diff --git a/src/Mod/Mesh/Gui/ViewProviderCurvature.cpp b/src/Mod/Mesh/Gui/ViewProviderCurvature.cpp index 3c5235a26692..8261ecc8a7d0 100644 --- a/src/Mod/Mesh/Gui/ViewProviderCurvature.cpp +++ b/src/Mod/Mesh/Gui/ViewProviderCurvature.cpp @@ -290,7 +290,7 @@ void ViewProviderMeshCurvature::updateData(const App::Property* prop) // set to the expected size if (prop->getTypeId().isDerivedFrom(App::PropertyLink::getClassTypeId())) { Mesh::Feature* object = static_cast(prop)->getValue(); - this->pcLinkRoot->removeAllChildren(); + Gui::coinRemoveAllChildren(this->pcLinkRoot); if (object) { const Mesh::MeshObject& kernel = object->Mesh.getValue(); pcColorMat->diffuseColor.setNum((int)kernel.countPoints()); diff --git a/src/Mod/Mesh/Gui/ViewProviderMeshFaceSet.cpp b/src/Mod/Mesh/Gui/ViewProviderMeshFaceSet.cpp index 4e89d5ea0287..822de958c9a8 100644 --- a/src/Mod/Mesh/Gui/ViewProviderMeshFaceSet.cpp +++ b/src/Mod/Mesh/Gui/ViewProviderMeshFaceSet.cpp @@ -154,7 +154,7 @@ void ViewProviderMeshFaceSet::updateData(const App::Property* prop) if (direct != directRendering) { directRendering = direct; - pcShapeGroup->removeAllChildren(); + Gui::coinRemoveAllChildren(pcShapeGroup); if (directRendering) { pcShapeGroup->addChild(pcMeshNode); diff --git a/src/Mod/Part/Gui/ViewProvider2DObject.cpp b/src/Mod/Part/Gui/ViewProvider2DObject.cpp index adeff1fb66dd..d303939cfd94 100644 --- a/src/Mod/Part/Gui/ViewProvider2DObject.cpp +++ b/src/Mod/Part/Gui/ViewProvider2DObject.cpp @@ -128,7 +128,7 @@ SoSeparator* ViewProvider2DObject::createGrid(void) double zGrid = 0.0; // carpet-grid separation SoGroup *parent = new Gui::SoSkipBoundingGroup(); - GridRoot->removeAllChildren(); + Gui::coinRemoveAllChildren(GridRoot); GridRoot->addChild(parent); SoBaseColor *mycolor; SoVertexProperty *vts; @@ -228,7 +228,7 @@ void ViewProvider2DObject::updateData(const App::Property* prop) if (prop->getTypeId() == Part::PropertyPartShape::getClassTypeId()) { Base::BoundBox3d bbox = static_cast(prop)->getBoundingBox(); if (!bbox.IsValid()) return; - GridRoot->removeAllChildren(); + Gui::coinRemoveAllChildren(GridRoot); Base::Placement place = static_cast(prop)->getComplexData()->getPlacement(); place.invert(); Base::ViewProjMatrix proj(place.toMatrix()); @@ -252,11 +252,11 @@ void ViewProvider2DObject::onChanged(const App::Property* prop) if (ShowGrid.getValue()) createGrid(); else - GridRoot->removeAllChildren(); + Gui::coinRemoveAllChildren(GridRoot); } if ((prop == &GridSize) || (prop == &GridStyle) || (prop == &TightGrid)) { if (ShowGrid.getValue()) { - GridRoot->removeAllChildren(); + Gui::coinRemoveAllChildren(GridRoot); createGrid(); } } diff --git a/src/Mod/Part/Gui/ViewProviderCurveNet.cpp b/src/Mod/Part/Gui/ViewProviderCurveNet.cpp index 839dcca3eb99..76c27db92113 100644 --- a/src/Mod/Part/Gui/ViewProviderCurveNet.cpp +++ b/src/Mod/Part/Gui/ViewProviderCurveNet.cpp @@ -118,8 +118,8 @@ void ViewProviderCurveNet::updateData(const App::Property* prop) if (cShape.IsNull()) return; - EdgeRoot->removeAllChildren(); - VertexRoot->removeAllChildren(); + Gui::coinRemoveAllChildren(EdgeRoot); + Gui::coinRemoveAllChildren(VertexRoot); try{ computeEdges (EdgeRoot,cShape); diff --git a/src/Mod/Part/Gui/ViewProviderMirror.cpp b/src/Mod/Part/Gui/ViewProviderMirror.cpp index 51452220b77b..d23469783aac 100644 --- a/src/Mod/Part/Gui/ViewProviderMirror.cpp +++ b/src/Mod/Part/Gui/ViewProviderMirror.cpp @@ -167,7 +167,7 @@ void ViewProviderMirror::unsetEdit(int ModNum) mf->Normal.setValue(norm[0],norm[1],norm[2]); pcRoot->removeChild(pcEditNode); - pcEditNode->removeAllChildren(); + Gui::coinRemoveAllChildren(pcEditNode); } else { ViewProviderPart::unsetEdit(ModNum); diff --git a/src/Mod/Part/Gui/ViewProviderSpline.cpp b/src/Mod/Part/Gui/ViewProviderSpline.cpp index feaeb35b97a4..916af374ad1c 100644 --- a/src/Mod/Part/Gui/ViewProviderSpline.cpp +++ b/src/Mod/Part/Gui/ViewProviderSpline.cpp @@ -93,7 +93,7 @@ void ViewProviderSpline::updateData(const App::Property* prop) if (prop->getTypeId() == Part::PropertyPartShape::getClassTypeId() && strcmp(prop->getName(), "Shape") == 0) { // update control points if there if (pcControlPoints) { - pcControlPoints->removeAllChildren(); + Gui::coinRemoveAllChildren(pcControlPoints); showControlPoints(this->ControlPoints.getValue(), prop); } } diff --git a/src/Mod/PartDesign/Gui/ViewProviderTransformed.cpp b/src/Mod/PartDesign/Gui/ViewProviderTransformed.cpp index 2964644423c4..c853f389bd47 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderTransformed.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderTransformed.cpp @@ -119,12 +119,12 @@ void ViewProviderTransformed::unsetEdit(int ModNum) while (pcRejectedRoot->getNumChildren() > 7) { SoSeparator* sep = static_cast(pcRejectedRoot->getChild(7)); SoMultipleCopy* rejectedTrfms = static_cast(sep->getChild(2)); - rejectedTrfms ->removeAllChildren(); + Gui::coinRemoveAllChildren(rejectedTrfms); sep->removeChild(1); sep->removeChild(0); pcRejectedRoot ->removeChild(7); } - pcRejectedRoot->removeAllChildren(); + Gui::coinRemoveAllChildren(pcRejectedRoot); pcRoot->removeChild(pcRejectedRoot); @@ -168,7 +168,7 @@ void ViewProviderTransformed::recomputeFeature(void) while (pcRejectedRoot->getNumChildren() > 7) { SoSeparator* sep = static_cast(pcRejectedRoot->getChild(7)); SoMultipleCopy* rejectedTrfms = static_cast(sep->getChild(2)); - rejectedTrfms ->removeAllChildren(); + Gui::coinRemoveAllChildren(rejectedTrfms); sep->removeChild(1); sep->removeChild(0); pcRejectedRoot ->removeChild(7); diff --git a/src/Mod/Robot/Gui/ViewProviderRobotObject.cpp b/src/Mod/Robot/Gui/ViewProviderRobotObject.cpp index 78d7ac5d113a..65c61fb1b10f 100644 --- a/src/Mod/Robot/Gui/ViewProviderRobotObject.cpp +++ b/src/Mod/Robot/Gui/ViewProviderRobotObject.cpp @@ -111,7 +111,7 @@ void ViewProviderRobotObject::setDragger() void ViewProviderRobotObject::resetDragger() { assert(pcDragger); - pcTcpRoot->removeAllChildren(); + Gui::coinRemoveAllChildren(pcTcpRoot); pcDragger = 0; } @@ -181,7 +181,7 @@ void ViewProviderRobotObject::updateData(const App::Property* prop) QString fn = QString::fromUtf8(filename); QFile file(fn); SoInput in; - pcRobotRoot->removeAllChildren(); + Gui::coinRemoveAllChildren(pcRobotRoot); if (!fn.isEmpty() && file.open(QFile::ReadOnly)) { QByteArray buffer = file.readAll(); in.setBuffer((void *)buffer.constData(), buffer.length()); diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index ea9fb5751d74..d8b418a57df7 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -3528,7 +3528,7 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer // information layer if(rebuildinformationlayer) { // every time we start with empty information layer - edit->infoGroup->removeAllChildren(); + Gui::coinRemoveAllChildren(edit->infoGroup); } ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View"); @@ -4282,7 +4282,7 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer if (ShowGrid.getValue()) createGrid(); else - GridRoot->removeAllChildren(); + Gui::coinRemoveAllChildren(GridRoot); edit->RootCrossCoordinate->point.set1Value(0,SbVec3f(-dMagF, 0.0f, zCross)); edit->RootCrossCoordinate->point.set1Value(1,SbVec3f(dMagF, 0.0f, zCross)); @@ -5297,7 +5297,7 @@ void ViewProviderSketch::rebuildConstraintsVisual(void) { const std::vector &constrlist = getSketchObject()->Constraints.getValues(); // clean up - edit->constrGroup->removeAllChildren(); + Gui::coinRemoveAllChildren(edit->constrGroup); edit->vConstrType.clear(); ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View"); @@ -6056,7 +6056,7 @@ void ViewProviderSketch::unsetEdit(int ModNum) if (edit->sketchHandler) deactivateHandler(); - edit->EditRoot->removeAllChildren(); + Gui::coinRemoveAllChildren(edit->EditRoot); pcRoot->removeChild(edit->EditRoot); //visibility autoation