From: dbv Date: Mon, 21 Dec 2015 13:07:39 +0000 (+0300) Subject: Fix for opening old saves without copy attribute in SketchPlugin_SketchEntity X-Git-Tag: V_2.1.0~127 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=75be2618528ea410f9f7de9949fcb6f983d8a776;p=modules%2Fshaper.git Fix for opening old saves without copy attribute in SketchPlugin_SketchEntity --- diff --git a/src/SketchPlugin/SketchPlugin_Sketch.cpp b/src/SketchPlugin/SketchPlugin_Sketch.cpp index 2117bc8b0..bc71a6445 100644 --- a/src/SketchPlugin/SketchPlugin_Sketch.cpp +++ b/src/SketchPlugin/SketchPlugin_Sketch.cpp @@ -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 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; diff --git a/src/SketchPlugin/SketchPlugin_SketchEntity.cpp b/src/SketchPlugin/SketchPlugin_SketchEntity.cpp index 5382b6cc6..9e95496ef 100644 --- a/src/SketchPlugin/SketchPlugin_SketchEntity.cpp +++ b/src/SketchPlugin/SketchPlugin_SketchEntity.cpp @@ -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()); }