From 10f201c1e81a78ad0635500482a59564d4e4d67d Mon Sep 17 00:00:00 2001 From: nds Date: Mon, 19 Jan 2015 15:25:49 +0300 Subject: [PATCH] Issue #355 Delete: elements of sketch and constraints Delete action on multi-selection. --- src/Model/Model_Document.cpp | 6 ------ src/PartSet/PartSet_Module.cpp | 35 +++++++++++++++++----------------- 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index 38ba4adf1..c923ee4ca 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -593,12 +593,6 @@ void Model_Document::refsToFeature(FeaturePtr theFeature, if (aFeature.get() != NULL) theRefs.insert(aFeature); } - - if (!aRefs.empty()) { - FeaturePtr aFeature = ModelAPI_Feature::feature(aResult); - if (aFeature.get() != NULL) - theRefs.insert(aFeature); - } } } // the dependencies can be in the feature itself diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 6755bc6e5..3a51f9ab1 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -213,21 +213,21 @@ bool PartSet_Module::canDisplayObject(const ObjectPtr& theObject) const void PartSet_Module::addViewerItems(QMenu* theMenu) const { - if (isSketchOperationActive() || isSketchFeatureOperationActive()) { - ModuleBase_ISelection* aSelection = myWorkshop->selection(); - QObjectPtrList aObjects = aSelection->selectedPresentations(); - if (aObjects.size() > 0) { - bool hasFeature = false; - foreach(ObjectPtr aObject, aObjects) - { - FeaturePtr aFeature = ModelAPI_Feature::feature(aObject); - if (aFeature.get() != NULL) { - hasFeature = true; - } + if (!isSketchOperationActive() && !isSketchFeatureOperationActive()) + return; + ModuleBase_ISelection* aSelection = myWorkshop->selection(); + QObjectPtrList aObjects = aSelection->selectedPresentations(); + if (aObjects.size() > 0) { + bool hasFeature = false; + foreach(ObjectPtr aObject, aObjects) + { + FeaturePtr aFeature = ModelAPI_Feature::feature(aObject); + if (aFeature.get() != NULL) { + hasFeature = true; } - if (hasFeature) - theMenu->addAction(action("DELETE_PARTSET_CMD")); } + if (hasFeature) + theMenu->addAction(action("DELETE_PARTSET_CMD")); } } @@ -472,19 +472,18 @@ void PartSet_Module::onAction(bool isChecked) void PartSet_Module::deleteObjects() { - if (isSketchOperationActive() || isSketchFeatureOperationActive()) + bool isSketchOp = isSketchOperationActive(); + if (!isSketchOp && !isSketchFeatureOperationActive()) return; XGUI_ModuleConnector* aConnector = dynamic_cast(workshop()); XGUI_Workshop* aWorkshop = aConnector->workshop(); XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr(); - if(anOpMgr->canAbortOperation()) { + if (!isSketchOp && anOpMgr->canAbortOperation()) { ModuleBase_Operation* aCurrentOp = anOpMgr->currentOperation(); if (aCurrentOp) { - bool isSketchOp = aCurrentOp->id().toStdString() == SketchPlugin_Sketch::ID(); - if (!isSketchOp) - aCurrentOp->abort(); + aCurrentOp->abort(); } } // sketch feature should be skipped, only sub-features can be removed -- 2.39.2