From: vsv Date: Mon, 27 Jan 2020 15:12:53 +0000 (+0300) Subject: Provide access to external part objects for specified widgets X-Git-Tag: V9_5_0a1~62 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1707d06aeafd7013ededb34879e3fc6da5047f86;p=modules%2Fshaper.git Provide access to external part objects for specified widgets --- diff --git a/src/ModuleBase/ModuleBase_ModelWidget.cpp b/src/ModuleBase/ModuleBase_ModelWidget.cpp index de9582a5f..3254241d2 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.cpp +++ b/src/ModuleBase/ModuleBase_ModelWidget.cpp @@ -65,6 +65,7 @@ ModuleBase_ModelWidget::ModuleBase_ModelWidget(QWidget* theParent, myFeatureId = theData->featureId(); myIsInternal = theData->getBooleanAttribute(ATTR_INTERNAL, false); + myUseExternalParts = theData->getBooleanAttribute("allow_parts_content", false); myIsModifiedInEdit = theData->getProperty(ATTR_MODIFIED_IN_EDIT); diff --git a/src/ModuleBase/ModuleBase_ModelWidget.h b/src/ModuleBase/ModuleBase_ModelWidget.h index 4060181c0..6e1122da1 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.h +++ b/src/ModuleBase/ModuleBase_ModelWidget.h @@ -317,6 +317,9 @@ Q_OBJECT virtual bool isReadOnly() const { return !isEnabled(); } + /// Returns true if the widget should have access to external parts + bool canUseExternalParts() const { return myUseExternalParts; } + signals: /// The signal about widget values are to be changed void beforeValuesChanged(); @@ -461,6 +464,9 @@ private: bool myFlushUpdateBlocked; bool myUpdateVisualAttributes; + + /// A flag which indicates that current widget should have access to external parts + bool myUseExternalParts; }; #endif diff --git a/src/ModuleBase/ModuleBase_ViewerFilters.cpp b/src/ModuleBase/ModuleBase_ViewerFilters.cpp index 2777049f8..c28b2eaa9 100644 --- a/src/ModuleBase/ModuleBase_ViewerFilters.cpp +++ b/src/ModuleBase/ModuleBase_ViewerFilters.cpp @@ -20,6 +20,9 @@ #include "ModuleBase_ViewerFilters.h" #include "ModuleBase_IWorkshop.h" #include "ModuleBase_IModule.h" +#include "ModuleBase_Operation.h" +#include "ModuleBase_IPropertyPanel.h" +#include "ModuleBase_ModelWidget.h" #include #include @@ -76,8 +79,12 @@ Standard_Boolean ModuleBase_ShapeDocumentFilter::IsOk( if (aObj) { DocumentPtr aDoc = aObj->document(); SessionPtr aMgr = ModelAPI_Session::get(); - // TODO: disable the next line for the ImportResult feature "objects" widget only - aValid = (aDoc == aMgr->activeDocument() || aDoc == aMgr->moduleDocument()); + + ModuleBase_ModelWidget* aWidget = anOperation->propertyPanel()->activeWidget(); + if (aWidget && aWidget->canUseExternalParts()) + aValid = Standard_True; + else + aValid = (aDoc == aMgr->activeDocument() || aDoc == aMgr->moduleDocument()); } else { // This object is not controlled by the filter