From: jfa Date: Tue, 2 Nov 2021 15:14:28 +0000 (+0300) Subject: [bos #24727] [CEA] Selection mechanism not working on a re-opened study X-Git-Tag: V9_8_0b1~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=90e8d13429461dc1ddd4b568b7e1fa3975f7193e;p=modules%2Fshaper.git [bos #24727] [CEA] Selection mechanism not working on a re-opened study --- diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index 9f48443fa..787492492 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -2012,6 +2012,23 @@ bool Model_AttributeSelection::restoreContext(std::wstring theName, } } + // Fix for opened study (aDoc->myNamingNames is empty) + if (theValue.IsNull() && aCont->groupName() != ModelAPI_ResultConstruction::group()) { + std::wstring::size_type aSlash = aSubShapeName.rfind(L'/'); + if (aSlash != std::wstring::npos) { + std::wstring aCompName = aSubShapeName.substr(aSlash + 1); + TDF_Label aLab = std::dynamic_pointer_cast(aCont->data())->shapeLab(); + TDF_ChildIDIterator aSubNames (aLab, TDataStd_Name::GetID()); + for (; aSubNames.More(); aSubNames.Next()) { + if (Handle(TDataStd_Name)::DownCast(aSubNames.Value())->Get().IsEqual(aCompName.c_str())) { + theValue = aSubNames.Value()->Label(); + aDoc->addNamingName(theValue, aSubShapeName); + break; + } + } + } + } + if (aCont.get()) { theContext = std::dynamic_pointer_cast(aCont->data())->label(); }