Core: Add beforeDelete python interface.

This commit is contained in:
paddle
2025-09-19 08:56:41 +02:00
committed by Chris Hennes
parent b51b1612de
commit 97c323c904
2 changed files with 32 additions and 0 deletions

View File

@@ -759,6 +759,32 @@ void ViewProviderFeaturePythonImp::finishRestoring()
}
}
void ViewProviderFeaturePythonImp::beforeDelete()
{
_FC_PY_CALL_CHECK(beforeDelete, return);
Base::PyGILStateLocker lock;
try {
if (has__object__) {
Base::pyCall(py_beforeDelete.ptr());
}
else {
Py::Tuple args(1);
args.setItem(0, Py::Object(object->getPyObject(), true));
Base::pyCall(py_beforeDelete.ptr(), args.ptr());
}
}
catch (Py::Exception&) {
if (PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
PyErr_Clear();
}
else {
Base::PyException e;
e.reportException();
}
}
}
ViewProviderFeaturePythonImp::ValueT
ViewProviderFeaturePythonImp::onDelete(const std::vector<std::string> & sub)
{