Salome HOME
Fix regression in Recover feature during HDF reading.
authorazv <azv@opencascade.com>
Mon, 17 Jun 2019 11:23:31 +0000 (14:23 +0300)
committerazv <azv@opencascade.com>
Mon, 17 Jun 2019 11:24:34 +0000 (14:24 +0300)
src/FeaturesPlugin/FeaturesPlugin_Recover.cpp
src/FeaturesPlugin/FeaturesPlugin_Recover.h

index 4cf0a75c315110abc23766fd59bbf105b8a81f61..bae08ab42a3bece6b30781e23ecec49bdceaf4e6 100644 (file)
@@ -34,6 +34,7 @@
 #include <GeomAlgoAPI_Tools.h>
 
 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();
 }
index ac2de898c1a744a2aa402873a5a27b89009889a3..8f23774452fbc8ba4c692c55d8c6f6b47673613f 100644 (file)
@@ -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()