PropertyLinks: refactor property link API
* Create new class PropertyLinkBase as the common parent class for all type of links. See the class document for details of its API. * Added new link scope 'Hidden' that is ignored during normal object dependency calculation, but still keep tracks of object remove, relabel, etc. * There is a new concept called 'Shadow subname' introduced in this patch, which will only be meaningful in future topological naming feature. See [here](https://git.io/fjXKR) for more details. * DocumentObject added a new API adjustRelativeLink() and a helper resolveRelativeLink() function.
This commit is contained in:
@@ -791,3 +791,19 @@ Py::List DocumentObjectPy::getParents() const {
|
||||
ret.append(Py::TupleN(Py::Object(v.first->getPyObject(),true),Py::String(v.second)));
|
||||
return ret;
|
||||
}
|
||||
|
||||
PyObject *DocumentObjectPy::adjustRelativeLinks(PyObject *args) {
|
||||
PyObject *pyobj;
|
||||
PyObject *recursive = Py_True;
|
||||
if (!PyArg_ParseTuple(args, "O!|O",&DocumentObjectPy::Type,&pyobj,&recursive))
|
||||
return NULL;
|
||||
PY_TRY {
|
||||
auto obj = static_cast<DocumentObjectPy*>(pyobj)->getDocumentObjectPtr();
|
||||
auto inList = obj->getInListEx(true);
|
||||
inList.insert(obj);
|
||||
std::set<App::DocumentObject *> visited;
|
||||
return Py::new_reference_to(Py::Boolean(
|
||||
getDocumentObjectPtr()->adjustRelativeLinks(inList,
|
||||
PyObject_IsTrue(recursive)?&visited:nullptr)));
|
||||
}PY_CATCH
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user