]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for opening old saves without copy attribute in SketchPlugin_SketchEntity
authordbv <dbv@opencascade.com>
Mon, 21 Dec 2015 13:07:39 +0000 (16:07 +0300)
committerdbv <dbv@opencascade.com>
Mon, 21 Dec 2015 13:07:39 +0000 (16:07 +0300)
src/SketchPlugin/SketchPlugin_Sketch.cpp
src/SketchPlugin/SketchPlugin_SketchEntity.cpp

index 2117bc8b0f1b12a109aaa9ccfdee818e09fc144c..bc71a6445737f3515aeba053bd25d96a157b3ff8 100644 (file)
@@ -310,6 +310,11 @@ FeaturePtr SketchPlugin_Sketch::addUniqueNamedCopiedFeature(FeaturePtr theFeatur
   // text expressions could block setValue of some attributes
   SketchPlugin_Tools::clearExpressions(aNewFeature);
   // Set copy attribute
+  std::shared_ptr<ModelAPI_AttributeBoolean> anAttr = aNewFeature->data()->boolean(SketchPlugin_SketchEntity::COPY_ID());
+  if(!anAttr.get()) {
+    aNewFeature->data()->addAttribute(SketchPlugin_SketchEntity::COPY_ID(), ModelAPI_AttributeBoolean::typeId());
+    ModelAPI_Session::get()->validators()->registerNotObligatory(aNewFeature->getKind(), SketchPlugin_SketchEntity::COPY_ID());
+  }
   aNewFeature->data()->boolean(SketchPlugin_SketchEntity::COPY_ID())->setValue(theIsCopy);
 
   return aNewFeature;
index 5382b6cc638fc1b6e24d7b32cc9dcc99f97174ac..9e95496ef455fa95572ba3c4f53c1a0c82b3ac47 100644 (file)
@@ -14,7 +14,5 @@ SketchPlugin_SketchEntity::SketchPlugin_SketchEntity()
 void SketchPlugin_SketchEntity::initAttributes()
 {
   data()->addAttribute(AUXILIARY_ID(), ModelAPI_AttributeBoolean::typeId());
-  data()->addAttribute(COPY_ID(), ModelAPI_AttributeBoolean::typeId());
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), AUXILIARY_ID());
-  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), COPY_ID());
 }