From: vsv Date: Thu, 12 Jan 2017 15:03:25 +0000 (+0300) Subject: Update commands state on any selection (not only in viewer) X-Git-Tag: V_2.7.0~344^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3f40ea7848d4b8df00bd0b5204f1483fc36beb78;p=modules%2Fshaper.git Update commands state on any selection (not only in viewer) --- diff --git a/src/PartSet/PartSet_Validators.cpp b/src/PartSet/PartSet_Validators.cpp index da35eb489..e41593337 100755 --- a/src/PartSet/PartSet_Validators.cpp +++ b/src/PartSet/PartSet_Validators.cpp @@ -202,9 +202,8 @@ bool PartSet_RigidSelection::isValid(const ModuleBase_ISelection* theSelection, if (aObj.get()) { FeaturePtr aFeature = ModelAPI_Feature::feature(aObj); if (aFeature.get()) { - std::shared_ptr aSketch = - std::dynamic_pointer_cast(aFeature); - if (aSketch.get()) + CompositeFeaturePtr aComp = ModelAPI_Tools::compositeOwner(aFeature); + if (aComp.get() && (aComp->getKind() == SketchPlugin_Sketch::ID())) aCount++; } } diff --git a/src/XGUI/XGUI_ActionsMgr.cpp b/src/XGUI/XGUI_ActionsMgr.cpp index 26e33d3e2..b86390dda 100644 --- a/src/XGUI/XGUI_ActionsMgr.cpp +++ b/src/XGUI/XGUI_ActionsMgr.cpp @@ -101,7 +101,8 @@ void XGUI_ActionsMgr::updateCommandsStatus() { setAllEnabled(); XGUI_Selection* aSelection = myWorkshop->selector()->selection(); - if (aSelection->getSelected(ModuleBase_ISelection::Viewer).size() > 0) + //if (aSelection->getSelected(ModuleBase_ISelection::Viewer).size() > 0) + if (aSelection->getSelected().size() > 0) updateOnViewSelection(); FeaturePtr anActiveFeature = FeaturePtr(); diff --git a/src/XGUI/XGUI_Selection.cpp b/src/XGUI/XGUI_Selection.cpp index 56019f8aa..36849ab9e 100644 --- a/src/XGUI/XGUI_Selection.cpp +++ b/src/XGUI/XGUI_Selection.cpp @@ -273,7 +273,9 @@ QList XGUI_Selection::getHighlighted() const QObjectPtrList XGUI_Selection::selectedObjects() const { - return myWorkshop->objectBrowser()->selectedObjects(); + if (myWorkshop->objectBrowser()) + return myWorkshop->objectBrowser()->selectedObjects(); + return QObjectPtrList(); } void XGUI_Selection::setSelectedObjects( const QObjectPtrList& theObjects ) const