From 5eb15e4219d3d4e5c2650f6c876dbefe17c14aa5 Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Sat, 14 Dec 2019 11:56:51 +0800 Subject: [PATCH] App: do not save external dependency --- src/App/Document.cpp | 3 ++- src/App/DocumentObject.cpp | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/App/Document.cpp b/src/App/Document.cpp index f916e05fc174..10d639de1c68 100644 --- a/src/App/Document.cpp +++ b/src/App/Document.cpp @@ -1832,7 +1832,8 @@ void Document::writeObjects(const std::vector& obj, if(!isExporting(0)) { for(auto o : obj) { - const auto &outList = o->getOutList(DocumentObject::OutListNoHidden); + const auto &outList = o->getOutList(DocumentObject::OutListNoHidden + | DocumentObject::OutListNoXLinked); writer.Stream() << writer.ind() << "<" FC_ELEMENT_OBJECT_DEPS " " FC_ATTR_DEP_OBJ_NAME "=\"" << o->getNameInDocument() << "\" " FC_ATTR_DEP_COUNT "=\"" << outList.size(); diff --git a/src/App/DocumentObject.cpp b/src/App/DocumentObject.cpp index 72b5b309cc9d..a3e88e9f358e 100644 --- a/src/App/DocumentObject.cpp +++ b/src/App/DocumentObject.cpp @@ -284,14 +284,24 @@ void DocumentObject::getOutList(int options, std::vector &res) std::vector props; getPropertyList(props); bool noHidden = !!(options & OutListNoHidden); - bool noXLinked = !!(options & OutListNoXLinked); + std::size_t size = res.size(); for(auto prop : props) { auto link = dynamic_cast(prop); - if(link && (!noXLinked || !PropertyXLink::supportXLink(prop))) + if(link) link->getLinks(res,noHidden); } if(!(options & OutListNoExpression)) ExpressionEngine.getLinks(res); + + if(options & OutListNoXLinked) { + for(auto it=res.begin()+size;it!=res.end();) { + auto obj = *it; + if(obj && obj->getDocument()!=getDocument()) + it = res.erase(it); + else + ++it; + } + } } std::vector DocumentObject::getOutListOfProperty(App::Property* prop) const