From 8d394d6cade9024cea6cf75acafd758506a789d8 Mon Sep 17 00:00:00 2001 From: azv Date: Mon, 17 Jun 2019 14:23:31 +0300 Subject: [PATCH] Fix regression in Recover feature during HDF reading. --- src/FeaturesPlugin/FeaturesPlugin_Recover.cpp | 8 +++++++- src/FeaturesPlugin/FeaturesPlugin_Recover.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/FeaturesPlugin/FeaturesPlugin_Recover.cpp b/src/FeaturesPlugin/FeaturesPlugin_Recover.cpp index 4cf0a75c3..bae08ab42 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Recover.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Recover.cpp @@ -34,6 +34,7 @@ #include FeaturesPlugin_Recover::FeaturesPlugin_Recover() + : myClearListOnTypeChange(true) { } @@ -43,6 +44,11 @@ void FeaturesPlugin_Recover::initAttributes() data()->addAttribute(RECOVERED_ENTITIES(), ModelAPI_AttributeRefList::typeId()); data()->addAttribute(METHOD(), ModelAPI_AttributeString::typeId()); + if (!string(METHOD())->isInitialized()) { + myClearListOnTypeChange = false; + string(METHOD())->setValue(METHOD_DEFAULT()); + myClearListOnTypeChange = true; + } ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), METHOD()); // set default method for recovering string(METHOD())->setValue(METHOD_DEFAULT()); @@ -89,6 +95,6 @@ void FeaturesPlugin_Recover::execute() void FeaturesPlugin_Recover::attributeChanged(const std::string& theID) { - if (theID == METHOD()) + if (theID == METHOD() && myClearListOnTypeChange) reflist(RECOVERED_ENTITIES())->clear(); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_Recover.h b/src/FeaturesPlugin/FeaturesPlugin_Recover.h index ac2de898c..8f2377445 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Recover.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Recover.h @@ -38,6 +38,8 @@ class FeaturesPlugin_Recover : public ModelAPI_Feature FeaturePtr myCurrentBase; /// previous state of persistent flag bool myPersistent; + /// necessity to clean recovered list while changing the type of recover + bool myClearListOnTypeChange; public: /// Extrusion kind inline static const std::string& ID() -- 2.39.2