Fix regressions in 'test.models'.
}
std::pair<std::wstring, bool> getDefaultName(const std::shared_ptr<ModelAPI_Result>& theResult,
- const bool theInherited)
+ const bool theInherited,
+ const bool theRecursive)
{
typedef std::list< std::pair < std::string, std::list<ObjectPtr> > > ListOfReferences;
// return name of reference result only if it has been renamed by the user,
// in other case compose a default name
if (anObjRes->data()->hasUserDefinedName() ||
- anObjRes->data()->name() != getDefaultName(anObjRes).first) {
+ (theRecursive && anObjRes->data()->name() != getDefaultName(anObjRes).first)) {
std::wstringstream aName;
aName << anObjRes->data()->name();
std::map<ResultPtr, int>::iterator aFound = aNbRefToObject.find(anObjRes);
/*! 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<std::wstring, bool> getDefaultName(
- const std::shared_ptr<ModelAPI_Result>& theResult, const bool theInherited = true);
+ const std::shared_ptr<ModelAPI_Result>& theResult,
+ const bool theInherited = true,
+ const bool theRecursive = false);
/*! Collect all parents for the given feature, including the Part
*/
std::list<ResultPtr> allRes;
ModelAPI_Tools::allResults(theFeature, allRes);
for(std::list<ResultPtr>::iterator aRes = allRes.begin(); aRes != allRes.end(); aRes++) {
- std::pair<std::wstring, bool> aName = ModelAPI_Tools::getDefaultName(*aRes);
+ std::pair<std::wstring, bool> 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);