From: mpv Date: Tue, 18 Apr 2017 10:32:14 +0000 (+0300) Subject: Fix for the issue #2132 : save current feature correctly for the composite features... X-Git-Tag: V_2.7.1~50 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a8c38afe7673aa74f9ab67c21c3244a7bd080f03;p=modules%2Fshaper.git Fix for the issue #2132 : save current feature correctly for the composite features, do not make nested features be active on open (this disables composites) --- diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index bf263768d..10d4605f2 100755 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -244,7 +244,17 @@ bool Model_Document::save( if (currentFeature(false) != lastFeature()) { aSession->setCheckTransactions(false); aWasCurrent = currentFeature(false); - setCurrentFeature(lastFeature(), false); + // if last is nested into something else, make this something else as last: + // otherwise it will look like edition of sub-element, so, the main will be disabled + FeaturePtr aLast = lastFeature(); + if (aLast.get()) { + CompositeFeaturePtr aMain = ModelAPI_Tools::compositeOwner(aLast); + while(aMain.get()) { + aLast = aMain; + aMain = ModelAPI_Tools::compositeOwner(aLast); + } + } + setCurrentFeature(aLast, true); } // create a directory in the root document if it is not yet exist Handle(Model_Application) anApp = Model_Application::getApplication(); @@ -1115,7 +1125,7 @@ void Model_Document::setCurrentFeature( if (isSub(aMain, anIter)) // sub-elements of not-disabled feature are not disabled aDisabledFlag = false; else if (anOwners.find(anIter) != anOwners.end()) - // disable the higher-level feature is the nested is the current + // disable the higher-level feature if the nested is the current aDisabledFlag = true; }