Core: Add Gui::Document::getTreeRootObjects()

This commit is contained in:
PaddleStroke
2024-05-30 12:20:35 +02:00
parent 238fd6a5fc
commit fb32579498
7 changed files with 57 additions and 3 deletions

View File

@@ -509,6 +509,20 @@ void DocumentPy::setModified(Py::Boolean arg)
getDocumentPtr()->setModified(arg);
}
Py::List DocumentPy::getTreeRootObjects() const
{
std::vector<App::DocumentObject*> objs = getDocumentPtr()->getTreeRootObjects();
Py::List res;
for (auto obj : objs) {
//Note: Here we must force the Py::Object to own this Python object as getPyObject() increments the counter
res.append(Py::Object(obj->getPyObject(), true));
}
return res;
}
PyObject *DocumentPy::getCustomAttributes(const char* attr) const
{
// Note: Here we want to return only a document object if its