From 0b712f2f3a23fd8a22f9ac5f38e10f2b3d178f17 Mon Sep 17 00:00:00 2001 From: mpv Date: Wed, 18 Nov 2015 09:09:12 +0300 Subject: [PATCH] Fix for the issue #1091 --- src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp | 5 ++++- src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.h | 2 +- src/Model/Model_Update.cpp | 8 +++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp index f2edb24b4..d9ff9ccfc 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp @@ -115,7 +115,10 @@ void FeaturesPlugin_CompositeSketch::execute() if(!aConstruction.get()) { return; } - selection(SKETCH_SELECTION_ID())->setValue(aSketchRes, std::shared_ptr()); + + if (!selection(SKETCH_SELECTION_ID())->isInitialized() || selection(SKETCH_SELECTION_ID())->context() != aSketchRes) { + selection(SKETCH_SELECTION_ID())->setValue(aSketchRes, std::shared_ptr()); + } int aSketchFacesNum = aConstruction->facesNum(); if(aSketchFacesNum == 0) { return; diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.h b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.h index 806a004cd..422fd9d18 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.h +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.h @@ -27,7 +27,7 @@ class FeaturesPlugin_CompositeSketch : public ModelAPI_CompositeFeature return MY_SKETCH_OBJECT_ID; } - /// Attribute name of sketch feature. + /// Attribute name of sketch feature selection: needed for naming of the selected sketch. inline static const std::string& SKETCH_SELECTION_ID() { static const std::string MY_SKETCH_SELECTION_ID("sketch_selection"); diff --git a/src/Model/Model_Update.cpp b/src/Model/Model_Update.cpp index e6d83e197..5d198d19a 100644 --- a/src/Model/Model_Update.cpp +++ b/src/Model/Model_Update.cpp @@ -172,7 +172,8 @@ void Model_Update::processEvent(const std::shared_ptr& theMessag // place where results are cleared) myIsParamUpdated = false; myUpdated.clear(); - myModification = 0; + // do not erase it since there may be modification increment on start of operation + //myModification = 0; myWaitForFinish.clear(); } } @@ -240,6 +241,8 @@ void Model_Update::processOperation(const bool theTotalUpdate, const bool theFin isAutomaticChanged = true; myIsAutomatic = true; } + // modifications inside of the iteration will be different from modification that comes outside + myModification++; // init iteration from the root document iterateUpdate(CompositeFeaturePtr()); @@ -455,6 +458,9 @@ bool Model_Update::isOlder(std::shared_ptr theFeature, std::shared_ptr aRes = *aRIter; if (!aRes->isDisabled()) { std::map, int >::iterator anRIter = myUpdated.find(aRes); + int aResultID = aRes->data()->updateID(); + if (aResultID < anArgID) + return true; if (anRIter == myUpdated.end()) // not updated at all return true; if (anRIter->second < anAIter->second) -- 2.39.2