// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-// File: ModuleBase_FilterValidated.h
+// File: ModuleBase_FilterValidated.cpp
// Created: 17 Mar 2015
// Author: Natalia ERMOLAEVA
Standard_Boolean ModuleBase_FilterValidated::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
{
+ bool aValid = true;
ModuleBase_Operation* anOperation = myWorkshop->module()->currentOperation();
- if (!anOperation)
- return true;
-
- ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel();
- ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
- if (!anActiveWidget)
- anActiveWidget = aPanel->preselectionWidget();
- ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast<ModuleBase_WidgetValidated*>
- (anActiveWidget);
- ModuleBase_ViewerPrs aPrs;
- myWorkshop->selection()->fillPresentation(aPrs, theOwner);
-
- return !aWidgetValidated || aWidgetValidated->isValidSelection(aPrs);
+ if (anOperation) {
+ ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel();
+ ModuleBase_ModelWidget* aCurrentWidget = aPanel->preselectionWidget();
+ if (!aCurrentWidget)
+ aCurrentWidget = aPanel->activeWidget();
+ ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast<ModuleBase_WidgetValidated*>
+ (aCurrentWidget);
+ ModuleBase_ViewerPrs aPrs;
+ myWorkshop->selection()->fillPresentation(aPrs, theOwner);
+
+ aValid = !aWidgetValidated || aWidgetValidated->isValidSelection(aPrs);
+ }
+
+#ifdef DEBUG_FILTERS
+ qDebug(QString("ModuleBase_FilterValidated::IsOk = %1").arg(aValid).toStdString().c_str());
+#endif
+ return aValid;
}