From 0f86afa019261b5f6d1ad0594557111c64ba7332 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 17 Mar 2020 16:43:05 +0100 Subject: [PATCH] App: GroupExtension::getGroupOfObject considers App::GroupExtension or App::GroupExtensionPython --- src/App/GroupExtension.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/App/GroupExtension.cpp b/src/App/GroupExtension.cpp index e716c315a7..924dbf751f 100644 --- a/src/App/GroupExtension.cpp +++ b/src/App/GroupExtension.cpp @@ -39,6 +39,13 @@ using namespace App; EXTENSION_PROPERTY_SOURCE(App::GroupExtension, App::DocumentObjectExtension) +namespace App { +EXTENSION_PROPERTY_SOURCE_TEMPLATE(App::GroupExtensionPython, App::GroupExtension) + +// explicit template instantiation +template class AppExport ExtensionPythonT>; +} + GroupExtension::GroupExtension() { initExtensionType(GroupExtension::getExtensionClassTypeId()); @@ -291,11 +298,13 @@ int GroupExtension::countObjectsOfType(const Base::Type& typeId) const DocumentObject* GroupExtension::getGroupOfObject(const DocumentObject* obj) { - //note that we return here only Groups, but nothing derived from it, e.g. no GeoFeatureGroups. + //note that we return here only Groups, but nothing derived from it, e.g. no GeoFeatureGroups. //That is important as there are clear differences between groups/geofeature groups (e.g. an object //can be in only one group, and only one geofeaturegroup, however, it can be in both at the same time) for (auto o : obj->getInList()) { - if(o->hasExtension(App::GroupExtension::getExtensionClassTypeId(), false)) + if (o->hasExtension(App::GroupExtension::getExtensionClassTypeId(), false)) + return o; + if (o->hasExtension(App::GroupExtensionPython::getExtensionClassTypeId(), false)) return o; } @@ -428,10 +437,3 @@ void GroupExtension::getAllChildren(std::vector &res, ext->getAllChildren(res,rset); } } - -namespace App { -EXTENSION_PROPERTY_SOURCE_TEMPLATE(App::GroupExtensionPython, App::GroupExtension) - -// explicit template instantiation -template class AppExport ExtensionPythonT>; -}