From: Artem Zhidkov Date: Tue, 22 Dec 2020 05:59:54 +0000 (+0300) Subject: Issue #20456: Another dump study fails X-Git-Tag: V9_7_0a1~62 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=80504d617ac031826f8cbf0e83b8876bf3d8caff;p=modules%2Fshaper.git Issue #20456: Another dump study fails Fix regressions in 'test.models'. --- diff --git a/src/ModelAPI/ModelAPI_Tools.cpp b/src/ModelAPI/ModelAPI_Tools.cpp index 8c03b9ab3..c5985e310 100644 --- a/src/ModelAPI/ModelAPI_Tools.cpp +++ b/src/ModelAPI/ModelAPI_Tools.cpp @@ -617,7 +617,8 @@ void getConcealedResults(const FeaturePtr& theFeature, } std::pair getDefaultName(const std::shared_ptr& theResult, - const bool theInherited) + const bool theInherited, + const bool theRecursive) { typedef std::list< std::pair < std::string, std::list > > ListOfReferences; @@ -707,7 +708,7 @@ std::pair getDefaultName(const std::shared_ptrdata()->hasUserDefinedName() || - anObjRes->data()->name() != getDefaultName(anObjRes).first) { + (theRecursive && anObjRes->data()->name() != getDefaultName(anObjRes).first)) { std::wstringstream aName; aName << anObjRes->data()->name(); std::map::iterator aFound = aNbRefToObject.find(anObjRes); diff --git a/src/ModelAPI/ModelAPI_Tools.h b/src/ModelAPI/ModelAPI_Tools.h index 5fd96b917..ab4633d98 100644 --- a/src/ModelAPI/ModelAPI_Tools.h +++ b/src/ModelAPI/ModelAPI_Tools.h @@ -198,9 +198,12 @@ MODELAPI_EXPORT void getConcealedResults(const std::shared_ptr /*! Return the default name of the result according the features it depends or name of the feature. * Return also whether the name is get from the concealing result of parent object * (means that concealing result has user-defined name). + * \param[in] theRecursive recursively check the concealed results if they have user-defined names */ MODELAPI_EXPORT std::pair getDefaultName( - const std::shared_ptr& theResult, const bool theInherited = true); + const std::shared_ptr& theResult, + const bool theInherited = true, + const bool theRecursive = false); /*! Collect all parents for the given feature, including the Part */ diff --git a/src/ModelHighAPI/ModelHighAPI_Dumper.cpp b/src/ModelHighAPI/ModelHighAPI_Dumper.cpp index cb2323165..33d8cb39a 100644 --- a/src/ModelHighAPI/ModelHighAPI_Dumper.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Dumper.cpp @@ -687,7 +687,7 @@ void ModelHighAPI_Dumper::saveResultNames(const FeaturePtr& theFeature) std::list allRes; ModelAPI_Tools::allResults(theFeature, allRes); for(std::list::iterator aRes = allRes.begin(); aRes != allRes.end(); aRes++) { - std::pair aName = ModelAPI_Tools::getDefaultName(*aRes); + std::pair aName = ModelAPI_Tools::getDefaultName(*aRes, true, true); std::string aDefaultName = Locale::Convert::toString(aName.first); std::string aResName = Locale::Convert::toString((*aRes)->data()->name()); bool isUserDefined = !(isFeatureDefaultName && aDefaultName == aResName);