From 3f40ea7848d4b8df00bd0b5204f1483fc36beb78 Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 12 Jan 2017 18:03:25 +0300 Subject: [PATCH] Update commands state on any selection (not only in viewer) --- src/PartSet/PartSet_Validators.cpp | 5 ++--- src/XGUI/XGUI_ActionsMgr.cpp | 3 ++- src/XGUI/XGUI_Selection.cpp | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) 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 -- 2.39.2