From bc250222327d0b3f7e67fb35f0a1967c746e1fc6 Mon Sep 17 00:00:00 2001 From: mpv Date: Mon, 26 Nov 2018 16:10:39 +0300 Subject: [PATCH] Fix for the issue #2718 : results will be removed in case feature is invalid anyway. But in Update - class it is done without "Forever" class to keep references (although invalid) and restore back-references correctly if result become valid. --- src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp | 2 -- src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp | 2 -- src/FeaturesPlugin/FeaturesPlugin_Placement.cpp | 1 - src/FeaturesPlugin/FeaturesPlugin_Scale.cpp | 2 -- src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp | 1 - src/FeaturesPlugin/FeaturesPlugin_Translation.cpp | 3 --- src/ModelAPI/ModelAPI_Feature.cpp | 4 ++-- 7 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp b/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp index 85390b59e..2a7bec49c 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp @@ -86,7 +86,6 @@ void FeaturesPlugin_MultiRotation::performRotation1D() anObjectsSelList->value(anObjectsIndex); std::shared_ptr anObject = anObjectAttr->value(); if(!anObject.get()) { // may be for not-activated parts - eraseResults(); return; } anObjects.push_back(anObject); @@ -237,7 +236,6 @@ void FeaturesPlugin_MultiRotation::performRotation2D() anObjectsSelList->value(anObjectsIndex); std::shared_ptr anObject = anObjectAttr->value(); if(!anObject.get()) { // may be for not-activated parts - eraseResults(); return; } anObjects.push_back(anObject); diff --git a/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp b/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp index 355a0fdfd..ffe7c5b25 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp @@ -94,7 +94,6 @@ void FeaturesPlugin_MultiTranslation::performOneDirection() anObjectsSelList->value(anObjectsIndex); std::shared_ptr anObject = anObjectAttr->value(); if(!anObject.get()) { // may be for not-activated parts - eraseResults(); return; } anObjects.push_back(anObject); @@ -238,7 +237,6 @@ void FeaturesPlugin_MultiTranslation::performTwoDirection() anObjectsSelList->value(anObjectsIndex); std::shared_ptr anObject = anObjectAttr->value(); if(!anObject.get()) { // may be for not-activated parts - eraseResults(); return; } anObjects.push_back(anObject); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp b/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp index ad4975878..de1e0a219 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp @@ -68,7 +68,6 @@ void FeaturesPlugin_Placement::execute() anObjectsSelList->value(anObjectsIndex); std::shared_ptr anObject = anObjectAttr->value(); if(!anObject.get()) { // may be for not-activated parts - eraseResults(); return; } anObjects.push_back(anObject); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Scale.cpp b/src/FeaturesPlugin/FeaturesPlugin_Scale.cpp index a60b77984..bc1ef0189 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Scale.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Scale.cpp @@ -90,7 +90,6 @@ void FeaturesPlugin_Scale::performScaleByFactor() anObjectsSelList->value(anObjectsIndex); std::shared_ptr anObject = anObjectAttr->value(); if(!anObject.get()) { // may be for not-activated parts - eraseResults(); return; } anObjects.push_back(anObject); @@ -174,7 +173,6 @@ void FeaturesPlugin_Scale::performScaleByDimensions() anObjectsSelList->value(anObjectsIndex); std::shared_ptr anObject = anObjectAttr->value(); if(!anObject.get()) { // may be for not-activated parts - eraseResults(); return; } anObjects.push_back(anObject); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp b/src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp index 6d2cb59d2..f2a56036f 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp @@ -102,7 +102,6 @@ bool FeaturesPlugin_Symmetry::collectSourceObjects(ListOfShape& theSourceShapes, anObjectsSelList->value(anObjectsIndex); std::shared_ptr anObject = anObjectAttr->value(); if (!anObject.get()) { // may be for not-activated parts - eraseResults(); return false; } theSourceShapes.push_back(anObject); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Translation.cpp b/src/FeaturesPlugin/FeaturesPlugin_Translation.cpp index 9c32428bb..95e8644c1 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Translation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Translation.cpp @@ -105,7 +105,6 @@ void FeaturesPlugin_Translation::performTranslationByAxisAndDistance() anObjectsSelList->value(anObjectsIndex); std::shared_ptr anObject = anObjectAttr->value(); if(!anObject.get()) { // may be for not-activated parts - eraseResults(); return; } anObjects.push_back(anObject); @@ -230,7 +229,6 @@ void FeaturesPlugin_Translation::performTranslationByDimensions() anObjectsSelList->value(anObjectsIndex); std::shared_ptr anObject = anObjectAttr->value(); if(!anObject.get()) { // may be for not-activated parts - eraseResults(); return; } anObjects.push_back(anObject); @@ -317,7 +315,6 @@ void FeaturesPlugin_Translation::performTranslationByTwoPoints() anObjectsSelList->value(anObjectsIndex); std::shared_ptr anObject = anObjectAttr->value(); if(!anObject.get()) { // may be for not-activated parts - eraseResults(); return; } anObjects.push_back(anObject); diff --git a/src/ModelAPI/ModelAPI_Feature.cpp b/src/ModelAPI/ModelAPI_Feature.cpp index 236ee3dff..4ac1b9886 100644 --- a/src/ModelAPI/ModelAPI_Feature.cpp +++ b/src/ModelAPI/ModelAPI_Feature.cpp @@ -91,7 +91,7 @@ void ModelAPI_Feature::setResult(const std::shared_ptr& theResu void ModelAPI_Feature::removeResult(const std::shared_ptr& theResult) { theResult->setDisabled(theResult, true); - // flush visualisation changes + // flush visualization changes static Events_Loop* aLoop = Events_Loop::loop(); static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); aLoop->flush(aRedispEvent); @@ -138,7 +138,7 @@ void ModelAPI_Feature::removeResults( } } if (!aGroup.empty() && theFlush) { - // flush visualisation changes + // flush visualization changes static Events_Loop* aLoop = Events_Loop::loop(); static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); aLoop->flush(aRedispEvent); -- 2.30.2