From 9402bbaf74282c40f37ccdbec0578c313e04cdde Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 5 Nov 2014 08:04:10 +0300 Subject: [PATCH] Regression during edit operation. Edit sketch, select a line, as a result the property panel is filled and closed during this action. It should be shown and filled with the parameters of the selected object. The second regression: select a line, grab and try to drag any other object. The initially selected is moved as a result. --- src/PartSet/PartSet_OperationFeatureEdit.cpp | 14 +++++++++----- src/PartSet/PartSet_OperationSketch.cpp | 10 ++++++++-- src/XGUI/XGUI_Selection.cpp | 10 ++++++---- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/PartSet/PartSet_OperationFeatureEdit.cpp b/src/PartSet/PartSet_OperationFeatureEdit.cpp index 517c77cae..dcc8db879 100644 --- a/src/PartSet/PartSet_OperationFeatureEdit.cpp +++ b/src/PartSet/PartSet_OperationFeatureEdit.cpp @@ -149,16 +149,20 @@ void PartSet_OperationFeatureEdit::mousePressed(QMouseEvent* theEvent, ModuleBas } } ObjectPtr aObject; - if (!aSelected.empty()) { + /*if (!aSelected.empty()) { aObject = aSelected.first().object(); } else { if (!aHighlighted.empty()) aObject = aHighlighted.first().object(); + }*/ + // the priority to a highlighted object in order to edit it, even if the selected object is + // the feature of this operation. Otherwise, the highlighting is ignored and the selected + // object is moved + if (!aHighlighted.empty()) { + aObject = aHighlighted.front().object(); } - //if (!theHighlighted.empty()) - // aObject = theHighlighted.front().object(); - //if (!aObject && !theSelected.empty()) // changed for a constrain - // aObject = theSelected.front().object(); + if (!aObject && !aSelected.empty()) // changed for a constrain + aObject = aSelected.front().object(); FeaturePtr aFeature = ModelAPI_Feature::feature(aObject); if (!aFeature || aFeature != feature() || (aSelected.size() > 1)) { diff --git a/src/PartSet/PartSet_OperationSketch.cpp b/src/PartSet/PartSet_OperationSketch.cpp index 64f77867c..7f5dcd758 100644 --- a/src/PartSet/PartSet_OperationSketch.cpp +++ b/src/PartSet/PartSet_OperationSketch.cpp @@ -70,7 +70,10 @@ void PartSet_OperationSketch::mousePressed(QMouseEvent* theEvent, ModuleBase_IVi //if (aHasShift && aSelected.size() > 0) // return; - if (aSelected.size() > 0) { + // there should be a start of operation, which uses the pre-highlighted objects, + // the selected ones are collected here and are processed by a mouse move + if (aHighlighted.size() == 1) { + //if (aSelected.size() > 0) { ObjectPtr aFeature = aSelected.first().object(); if (aFeature) { std::string anOperationType = @@ -78,7 +81,10 @@ void PartSet_OperationSketch::mousePressed(QMouseEvent* theEvent, ModuleBase_IVi PartSet_OperationFeatureEditMulti::Type() : PartSet_OperationFeatureEdit::Type(); restartOperation(anOperationType, aFeature); } - } //else + } + else + myFeatures = aHighlighted; + //else //myFeatures = aSelected; } diff --git a/src/XGUI/XGUI_Selection.cpp b/src/XGUI/XGUI_Selection.cpp index 7ef11f4f6..d4fe690b1 100644 --- a/src/XGUI/XGUI_Selection.cpp +++ b/src/XGUI/XGUI_Selection.cpp @@ -51,7 +51,7 @@ QList XGUI_Selection::getSelected(int theShapeTypeToSkip) QList XGUI_Selection::getHighlighted(int theShapeTypeToSkip) const { - std::set aPrsFeatures; + //std::set aPrsFeatures; QList aPresentations; XGUI_Displayer* aDisplayer = myWorkshop->displayer(); @@ -62,10 +62,12 @@ QList XGUI_Selection::getHighlighted(int theShapeTypeToSki aPrs.setInteractive(anIO); ObjectPtr aResult = aDisplayer->getObject(anIO); - if (aPrsFeatures.find(aResult) == aPrsFeatures.end()) { + // we should not check the appearance of this feature because there can be some selected shapes + // for one feature + //if (aPrsFeatures.find(aResult) == aPrsFeatures.end()) { aPrs.setFeature(aResult); - aPrsFeatures.insert(aResult); - } + //aPrsFeatures.insert(aResult); + //} if (aContext->HasOpenedContext()) { TopoDS_Shape aShape = aContext->DetectedShape(); if (!aShape.IsNull() && aShape.ShapeType() != theShapeTypeToSkip) -- 2.39.2