Gui: add coinRemoveAllChildren to work around Coin3D bug

See bug description:
https://bitbucket.org/Coin3D/coin/pull-requests/119/fix-sochildlist-auditing/diff

Because of path based rendering (SoFCPathAnnotation) in mouse over
highlight, this bug causes crash more frequently here comparing to
upstream.

All C++ calling of SoGroup::removeAllChildren() is replaced by
Gui::coinRemoveAllChildren(), and python code is fixed by monkey
patching SoGroup.removeAllChildren() in FreeCADGuiInit.py.
This commit is contained in:
Zheng, Lei
2019-05-31 06:28:00 +08:00
committed by wmayer
parent c9ba972d26
commit 5214f5b7ce
36 changed files with 115 additions and 55 deletions

View File

@@ -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<SoGroup*>(ptr));
Py_Return;
}PY_CATCH;
}