App: add method DocumentObject::getFirstParent()

This commit is contained in:
wmayer
2023-05-13 15:12:49 +02:00
committed by wwmayer
parent fdf5d22a6b
commit 92de5cbb44
2 changed files with 14 additions and 0 deletions

View File

@@ -897,6 +897,17 @@ std::vector<std::pair<App::DocumentObject *,std::string>> DocumentObject::getPar
return ret;
}
App::DocumentObject* DocumentObject::getFirstParent() const
{
for (auto obj : getInList()) {
if (obj->hasExtension(App::GroupExtension::getExtensionClassTypeId(), true)) {
return obj;
}
}
return nullptr;
}
DocumentObject *DocumentObject::getLinkedObject(
bool recursive, Base::Matrix4D *mat, bool transform, int depth) const
{