From 2b3ac46356ff954f1715f2f0e96c41726e585b10 Mon Sep 17 00:00:00 2001 From: nds Date: Thu, 2 Apr 2015 17:07:49 +0300 Subject: [PATCH] The bug about sketch sub-entities with constraints visualized after open a document. --- src/PartSet/PartSet_Module.cpp | 10 ++---- src/PartSet/PartSet_SketcherMgr.cpp | 47 +++++++++++++++-------------- 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index f62c677a2..be788bd5a 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -280,14 +280,8 @@ bool PartSet_Module::canRedo() const bool PartSet_Module::canDisplayObject(const ObjectPtr& theObject) const { - // the display should be possible almost always, with exception of some specific cases - - bool aCanDisplay = true; - - if (mySketchMgr->activeSketch()) { - aCanDisplay = mySketchMgr->canDisplayObject(theObject); - } - return aCanDisplay; + // the sketch manager put the restriction to the objects display + return mySketchMgr->canDisplayObject(theObject); } bool PartSet_Module::addViewerItems(QMenu* theMenu, const QMap& theStdActions) const diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index 10a008fee..05cf9b550 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -776,42 +776,45 @@ bool PartSet_SketcherMgr::canRedo() const bool PartSet_SketcherMgr::canDisplayObject(const ObjectPtr& theObject) const { bool aCanDisplay = true; - // 1. the sketch feature should not be displayed during the sketch active operation - // it is hidden by a sketch operation start and shown by a sketch stop, just the sketch - // nested features can be visualized - CompositeFeaturePtr aSketchFeature = activeSketch(); - if (aSketchFeature.get() != NULL) { + + bool aHasActiveSketch = activeSketch().get() != NULL; + if (aHasActiveSketch) { + // 1. the sketch feature should not be displayed during the sketch active operation + // it is hidden by a sketch operation start and shown by a sketch stop, just the sketch + // nested features can be visualized FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); - if (aFeature.get() != NULL && aFeature == aSketchFeature) + if (aFeature.get() != NULL && aFeature == activeSketch()) aCanDisplay = false; } - // 2. For created nested feature operation do not display the created feature if + else { // there are no an active sketch + // 2. sketch sub-features should not visualized if the sketch operatio is not active + FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); + if (aFeature.get() != NULL) { + std::shared_ptr aSketchFeature = + std::dynamic_pointer_cast(aFeature); + if (aSketchFeature.get() == NULL) + aCanDisplay = false; + } + } + + // 3. For created nested feature operation do not display the created feature if // the mouse curstor leaves the OCC window. // The correction cases, which ignores this condition: // a. the property panel values modification // b. the popup menu activated // c. widget editor control - if (aCanDisplay) { - if (!isNestedCreateOperation(getCurrentOperation())) - return aCanDisplay; - + if (aCanDisplay && isNestedCreateOperation(getCurrentOperation())) { ModuleBase_Operation* aOperation = getCurrentOperation(); ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel(); ModuleBase_ModelWidget* anActiveWdg = aPanel ? aPanel->activeWidget() : 0; + ModuleBase_WidgetEditor* anEditorWdg = anActiveWdg ? dynamic_cast(anActiveWdg) : 0; // the active widget editor should not influence here. The presentation should be visible always // when this widget is active. - if (anActiveWdg) { - ModuleBase_WidgetEditor* anEditorWdg = dynamic_cast(anActiveWdg); - if (anEditorWdg) { - return aCanDisplay; - } + if (!anEditorWdg && !myIsPopupMenuActive) { + // during a nested create operation, the feature is redisplayed only if the mouse over view + // of there was a value modified in the property panel after the mouse left the view + aCanDisplay = myIsPropertyPanelValueChanged || myIsMouseOverWindow; } - if (myIsPopupMenuActive) - return aCanDisplay; - - // during a nested create operation, the feature is redisplayed only if the mouse over view - // of there was a value modified in the property panel after the mouse left the view - aCanDisplay = myIsPropertyPanelValueChanged || myIsMouseOverWindow; } return aCanDisplay; } -- 2.39.2