From bf28130e010a4dbffe57cb19c81e5965cdb817cd Mon Sep 17 00:00:00 2001 From: nds Date: Fri, 28 Aug 2015 14:30:37 +0300 Subject: [PATCH] Issue #851 Show only action should not hide sketch entities when the sketch operation is active. --- src/FeaturesPlugin/movement_widget.xml | 2 +- src/FeaturesPlugin/placement_widget.xml | 3 +- src/FeaturesPlugin/rotation_widget.xml | 3 +- src/GeomValidators/GeomValidators_PartSet.cpp | 35 ++++++------------- src/ModuleBase/ModuleBase_Tools.cpp | 2 +- src/PartSet/PartSet_SketcherMgr.cpp | 6 +++- src/XGUI/XGUI_Displayer.cpp | 2 +- 7 files changed, 23 insertions(+), 30 deletions(-) diff --git a/src/FeaturesPlugin/movement_widget.xml b/src/FeaturesPlugin/movement_widget.xml index 421a8851d..e7e162d0a 100644 --- a/src/FeaturesPlugin/movement_widget.xml +++ b/src/FeaturesPlugin/movement_widget.xml @@ -5,7 +5,7 @@ label="Main objects" icon=":icons/cut_shape.png" tooltip="Select a solid objects" - type_choice="Compounds Solids" + type_choice="Objects Solids" use_choice="false" concealment="true"> diff --git a/src/FeaturesPlugin/placement_widget.xml b/src/FeaturesPlugin/placement_widget.xml index 1989fb3a9..cefe7672e 100644 --- a/src/FeaturesPlugin/placement_widget.xml +++ b/src/FeaturesPlugin/placement_widget.xml @@ -5,8 +5,9 @@ label="Select a solid objects" icon=":icons/cut_shape.png" tooltip="Select a solid objects" - type_choice="Solids" + type_choice="Objects Solids" concealment="true" > + + activeDocument() == aMgr->moduleDocument(); - - if (theAttribute->attributeType() == ModelAPI_AttributeSelectionList::typeId()) { - AttributeSelectionListPtr aSelectionListAttr = - std::dynamic_pointer_cast(theAttribute); - // all context objects should be sketch entities - for (int i = 0, aSize = aSelectionListAttr->size(); i < aSize; i++) { - AttributeSelectionPtr aSelectAttr = aSelectionListAttr->value(i); - - GeomShapePtr aShape = aSelectAttr->value(); - if (!aShape.get()) { - ResultPtr aResult = aSelectAttr->context(); - if (aResult.get()) - aShape = aResult->shape(); - } - TopoDS_Shape aTopoShape = aShape->impl(); - TopAbs_ShapeEnum aShapeType = aTopoShape.ShapeType(); - - if (isPartSetDocument) - aValid = aShapeType == TopAbs_COMPOUND; - else { - TopoDS_Shape aTopoShape = aShape->impl(); - aShapeType = GeomValidators_Tools::getCompoundSubType(aTopoShape); - - aValid = aShapeType == TopAbs_SOLID; + if (!isPartSetDocument) + aValid = true; + else { + // only hole objects should be selected in PartSet document, there is no decomposition + if (theAttribute->attributeType() == ModelAPI_AttributeSelectionList::typeId()) { + AttributeSelectionListPtr aSelectionListAttr = + std::dynamic_pointer_cast(theAttribute); + for (int i = 0, aSize = aSelectionListAttr->size(); i < aSize; i++) { + AttributeSelectionPtr aSelectAttr = aSelectionListAttr->value(i); + GeomShapePtr aShape = aSelectAttr->value(); + aValid = !aShape.get(); } } } diff --git a/src/ModuleBase/ModuleBase_Tools.cpp b/src/ModuleBase/ModuleBase_Tools.cpp index b0ee536de..a3cfca0a6 100755 --- a/src/ModuleBase/ModuleBase_Tools.cpp +++ b/src/ModuleBase/ModuleBase_Tools.cpp @@ -216,7 +216,7 @@ TopAbs_ShapeEnum shapeType(const QString& theType) MyShapeTypes["shell"] = TopAbs_SHELL; MyShapeTypes["solid"] = TopAbs_SOLID; MyShapeTypes["solids"] = TopAbs_SOLID; - MyShapeTypes["compounds"] = TopAbs_COMPOUND; + MyShapeTypes["objects"] = TopAbs_SHAPE; } QString aType = theType.toLower(); if (MyShapeTypes.contains(aType)) diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index 0bea2148a..b7a89b356 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -192,7 +192,9 @@ void PartSet_SketcherMgr::onEnterViewPort() // redisplayed before this update, the feature presentation jumps from reset value to current. myIsMouseOverWindow = true; myIsResetCurrentValue = false; - operationMgr()->onValidateOperation(); + // it is important to validate operation here only if sketch entity create operation is active + // because at this operation we reacts to the mouse leave/enter view port + //operationMgr()->onValidateOperation(); #ifdef DEBUG_MOUSE_OVER_WINDOW_FLAGS qDebug(QString("onEnterViewPort: %1").arg(mouseOverWindowFlagsInfo()).toStdString().c_str()); #endif @@ -203,6 +205,8 @@ void PartSet_SketcherMgr::onEnterViewPort() if (!isNestedCreateOperation(getCurrentOperation())) return; + operationMgr()->onValidateOperation(); + // we need change displayed state of the current operation feature // if the feature is presentable, e.g. distance construction. It has no results, so workshop does // not accept a signal about the result created. Nothing is shown until mouse is moved out/in view diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index f91e8fa08..ff4127e2f 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -354,7 +354,7 @@ void XGUI_Displayer::activateObjects(const QIntList& theModes, const QObjectPtrL // Convert shape types to selection types QIntList aModes; foreach(int aType, theModes) { - if (aType > TopAbs_SHAPE) + if (aType >= TopAbs_SHAPE) aModes.append(aType); else aModes.append(AIS_Shape::SelectionMode((TopAbs_ShapeEnum)aType)); -- 2.39.2