From a8c38afe7673aa74f9ab67c21c3244a7bd080f03 Mon Sep 17 00:00:00 2001 From: mpv Date: Tue, 18 Apr 2017 13:32:14 +0300 Subject: [PATCH] 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) --- src/Model/Model_Document.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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; } -- 2.39.2