diff --git a/src/App/MergeDocuments.cpp b/src/App/MergeDocuments.cpp index efbb573399..819a7c364e 100644 --- a/src/App/MergeDocuments.cpp +++ b/src/App/MergeDocuments.cpp @@ -80,6 +80,24 @@ protected: it->second = jt->second; } } + // update the expression if name of the object is used + else if (LocalName == "Expression") { + std::map::iterator it = AttrMap.find("expression"); + if (it != AttrMap.end()) { + // search for the part before the first dot that should be the object name. + std::string expression = it->second; + std::string::size_type dotpos = expression.find_first_of("."); + if (dotpos != std::string::npos) { + std::string name = expression.substr(0, dotpos); + std::map::const_iterator jt = nameMap.find(name); + if (jt != nameMap.end()) { + std::string newexpression = jt->second; + newexpression += expression.substr(dotpos); + it->second = newexpression; + } + } + } + } } } diff --git a/src/Gui/MergeDocuments.cpp b/src/Gui/MergeDocuments.cpp index a21878209e..93316f4fa5 100644 --- a/src/Gui/MergeDocuments.cpp +++ b/src/Gui/MergeDocuments.cpp @@ -80,6 +80,24 @@ protected: it->second = jt->second; } } + // update the expression if name of the object is used + else if (LocalName == "Expression") { + std::map::iterator it = AttrMap.find("expression"); + if (it != AttrMap.end()) { + // search for the part before the first dot that should be the object name. + std::string expression = it->second; + std::string::size_type dotpos = expression.find_first_of("."); + if (dotpos != std::string::npos) { + std::string name = expression.substr(0, dotpos); + std::map::const_iterator jt = nameMap.find(name); + if (jt != nameMap.end()) { + std::string newexpression = jt->second; + newexpression += expression.substr(dotpos); + it->second = newexpression; + } + } + } + } } }