From 75be2618528ea410f9f7de9949fcb6f983d8a776 Mon Sep 17 00:00:00 2001 From: dbv Date: Mon, 21 Dec 2015 16:07:39 +0300 Subject: [PATCH] Fix for opening old saves without copy attribute in SketchPlugin_SketchEntity --- src/SketchPlugin/SketchPlugin_Sketch.cpp | 5 +++++ src/SketchPlugin/SketchPlugin_SketchEntity.cpp | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) 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()); } -- 2.39.2