2. Document shape filter check whether the operation is started itself. This improvement is similar to the infinite filter using. The matter is that the nested operation stop should not remove the filter from the context. If it is happened, objects from out parts is selected in sketch operation after, for example, translate operation stop. So, it seems that it is a best decision to check the active operation availability in the filter.
label="Select a sketch face"
icon=":icons/sketch.png"
tooltip="Select a sketch face"
- type_choice="Faces">
+ use_choice="false"
+ type_choice="Faces Compound">
<validator id="PartSet_SketchEntityValidator" parameters="Sketch"/>
</multi_selector>
<groupbox title="From">
MyShapeTypes["shell"] = TopAbs_SHELL;
MyShapeTypes["solid"] = TopAbs_SOLID;
MyShapeTypes["solids"] = TopAbs_SOLID;
+ MyShapeTypes["compound"] = TopAbs_COMPOUND;
}
QString aType = theType.toLower();
if (MyShapeTypes.contains(aType))
#include "ModuleBase_ViewerFilters.h"
#include "ModuleBase_IWorkshop.h"
+#include "ModuleBase_IModule.h"
#include <ModelAPI_Session.h>
#include <ModelAPI_Document.h>
//TODO (VSV): Check bug in OCCT: Filter result is ignored (bug25340)
Standard_Boolean ModuleBase_ShapeDocumentFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
{
+ ModuleBase_Operation* anOperation = myWorkshop->module()->currentOperation();
+ // the shapes from different documents should be provided if there is no started operation
+ // in order to show/hide results
+ if (!anOperation)
+ return true;
+
if (theOwner->HasSelectable()) {
Handle(AIS_InteractiveObject) aAisObj =
Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
QString aTypesStr = aPropertyTypes.c_str();
QStringList aShapeTypes = aTypesStr.split(' ');
- //myIsUseChoice = theData->getBooleanAttribute("use_choice", true);
+ myIsUseChoice = theData->getBooleanAttribute("use_choice", true);
myTypeCombo->addItems(aShapeTypes);
aMainLay->addWidget(myTypeCombo, 0, 1);
// if the xml definition contains one type, the controls to select a type should not be shown
- if (aShapeTypes.size() == 1/* || !myIsUseChoice*/) {
+ if (aShapeTypes.size() == 1 || !myIsUseChoice) {
aTypeLabel->setVisible(false);
myTypeCombo->setVisible(false);
}
{
QIntList aShapeTypes;
- if (myTypeCombo->count() > 1) {
+ if (myTypeCombo->count() > 1 && myIsUseChoice) {
aShapeTypes.append(ModuleBase_Tools::shapeType(myTypeCombo->currentText()));
}
else {
/// Variable of GeomSelection
QList<GeomSelection> mySelection;
- //bool myIsUseChoice;
+ bool myIsUseChoice;
};
#endif /* MODULEBASE_WIDGETFILESELECTOR_H_ */
bool ModuleBase_WidgetSelector::isValidSelectionCustom(const ModuleBase_ViewerPrs& thePrs)
{
GeomShapePtr aShape = myWorkshop->selection()->getShape(thePrs);
- bool aValid;
- // if there is no selected shape, the method returns true
- if (!aShape.get())
- aValid = true;
- else {
+ bool aValid = true;
+ if (!aShape.get()) {
+ ResultPtr aResult = myWorkshop->selection()->getResult(thePrs);
+ if (aResult.get())
+ aShape = aResult->shape();
+ }
+ if (aShape.get()) {
// Check that the selection corresponds to selection type
TopoDS_Shape aTopoShape = aShape->impl<TopoDS_Shape>();
aValid = acceptSubShape(aTopoShape);
#include "PartSet_Filters.h"
#include <ModuleBase_IWorkshop.h>
+#include "ModuleBase_IModule.h"
#include <ModelAPI_Feature.h>
#include <FeaturesPlugin_Group.h>
Standard_Boolean PartSet_GlobalFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
{
+ ModuleBase_Operation* anOperation = myWorkshop->module()->currentOperation();
+ // the shapes from different documents should be provided if there is no started operation
+ // in order to show/hide results
+ if (!anOperation)
+ return true;
+
if (ModuleBase_ShapeDocumentFilter::IsOk(theOwner)) {
if (theOwner->HasSelectable()) {
Handle(AIS_InteractiveObject) aAisObj =
Events_Loop* aLoop = Events_Loop::loop();
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED));
+ if (myDocumentShapeFilter.IsNull())
+ myDocumentShapeFilter = new PartSet_GlobalFilter(myWorkshop);
+ myWorkshop->viewer()->addSelectionFilter(myDocumentShapeFilter);
+
if (myFilterInfinite.IsNull())
myFilterInfinite = new PartSet_FilterInfinite();
myWorkshop->viewer()->addSelectionFilter(myFilterInfinite);
breakOperationSequence();
}
-void PartSet_Module::sendOperation(ModuleBase_Operation* theOperation)
-{
- // Install the document filter before any other filter
- if (myDocumentShapeFilter.IsNull())
- myDocumentShapeFilter = new PartSet_GlobalFilter(myWorkshop);
- myWorkshop->viewer()->addSelectionFilter(myDocumentShapeFilter);
-
- ModuleBase_IModule::sendOperation(theOperation);
-}
-
void PartSet_Module::onOperationStarted(ModuleBase_Operation* theOperation)
{
if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
else if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
mySketchMgr->stopNestedSketch(theOperation);
}
- myWorkshop->viewer()->removeSelectionFilter(myDocumentShapeFilter);
+ //myWorkshop->viewer()->removeSelectionFilter(myDocumentShapeFilter);
}
ModuleBase_Operation* PartSet_Module::currentOperation() const
/// \param theObjectBrowser a pinter on Object Browser widget
virtual void customizeObjectBrowser(QWidget* theObjectBrowser);
- /// Sends the operation for launching
- /// \param theOperation the operation
- virtual void sendOperation(ModuleBase_Operation* theOperation);
-
public slots:
/// SLOT, that is called by no more widget signal emitted by property panel
/// Set a specific flag to restart the sketcher operation