From db5857ef624bebc717c489f4c374af49c299a5e8 Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 7 Nov 2017 12:35:10 +0300 Subject: [PATCH] Open document problem is corrected: after opening a document, all default filters (global also) are removed. Solution: "clearViewer" is moved to exact place where it is necessary, it should not be called by openDirectory in OpenParts mode. --- src/PartSet/PartSet_Filters.cpp | 15 +++++++++++---- src/PartSet/PartSet_Module.cpp | 1 - src/XGUI/XGUI_Workshop.cpp | 3 +++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/PartSet/PartSet_Filters.cpp b/src/PartSet/PartSet_Filters.cpp index 2851ea877..afe4fbbda 100644 --- a/src/PartSet/PartSet_Filters.cpp +++ b/src/PartSet/PartSet_Filters.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -57,11 +58,17 @@ Standard_Boolean PartSet_GlobalFilter::IsOk(const Handle(SelectMgr_EntityOwner)& ResultPtr aResult = std::dynamic_pointer_cast(aObj); // result of parts belongs to PartSet document and can be selected only when PartSet // is active in order to do not select the result of the active part. - if (aResult.get() && aResult->groupName() == ModelAPI_ResultPart::group()) { - SessionPtr aMgr = ModelAPI_Session::get(); - aValid = aMgr->activeDocument() == aMgr->moduleDocument(); + if (aResult.get()) { + if (aResult->groupName() == ModelAPI_ResultPart::group()) { + SessionPtr aMgr = ModelAPI_Session::get(); + aValid = aMgr->activeDocument() == aMgr->moduleDocument(); + } else if (aResult->groupName() == ModelAPI_ResultGroup::group()) { + aValid = Standard_False; + } else + aValid = Standard_True; } - else { + else { // possibly this code is obsolete, as a feature object can be selected in recovery + // only and there can not be Group feature FeaturePtr aFeature = ModelAPI_Feature::feature(aObj); if (aFeature) { aValid = aFeature->getKind() != "Group"; diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 8ae275c83..3f3c23bd5 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -624,7 +624,6 @@ bool PartSet_Module::isSketchNeutralPointActivated() const void PartSet_Module::closeDocument() { myActivePartIndex = QModelIndex(); - clearViewer(); } void PartSet_Module::clearViewer() diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index e3bca97c2..92158be6a 100755 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -2259,6 +2259,9 @@ void XGUI_Workshop::closeDocument() objectBrowser()->clearContent(); module()->closeDocument(); + // we need to clear viewer (with created filters) to do not have problems in 2nd SALOME study + module()->clearViewer(); + // data model need not process the document's signals about objects modifications as // the document is closed -- 2.39.2