From 7f1e48a3f89a42631e1defa993d5ebda38e9a18d Mon Sep 17 00:00:00 2001 From: mpv Date: Tue, 23 Dec 2014 11:54:12 +0300 Subject: [PATCH] Issue #294 : remove dependency between the copied part and the original one --- src/PartSetPlugin/PartSetPlugin_Duplicate.cpp | 6 +++--- src/PartSetPlugin/PartSetPlugin_Duplicate.h | 6 ------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/PartSetPlugin/PartSetPlugin_Duplicate.cpp b/src/PartSetPlugin/PartSetPlugin_Duplicate.cpp index 37ff14add..35134c64b 100644 --- a/src/PartSetPlugin/PartSetPlugin_Duplicate.cpp +++ b/src/PartSetPlugin/PartSetPlugin_Duplicate.cpp @@ -21,7 +21,6 @@ PartSetPlugin_Duplicate::PartSetPlugin_Duplicate() void PartSetPlugin_Duplicate::initAttributes() { PartSetPlugin_Part::initAttributes(); - data()->addAttribute(ORIGIN_REF(), ModelAPI_AttributeRefAttr::type()); std::shared_ptr aPManager = ModelAPI_Session::get(); std::shared_ptr aRoot = aPManager->moduleDocument(); @@ -37,12 +36,13 @@ void PartSetPlugin_Duplicate::initAttributes() if (aSource) { std::shared_ptr aCopy = aPManager->copy( aSource->data()->document(ModelAPI_ResultPart::DOC_REF())->value(), data()->name()); - data()->refattr(ORIGIN_REF())->setObject(aSource); + } else { // invalid part copy: do nothing, keep this in empty name + data()->setName(""); } } void PartSetPlugin_Duplicate::execute() { - if (data()->refattr(ORIGIN_REF())->object()) + if (!data()->name().empty()) PartSetPlugin_Part::execute(); } diff --git a/src/PartSetPlugin/PartSetPlugin_Duplicate.h b/src/PartSetPlugin/PartSetPlugin_Duplicate.h index 9ace34a5c..8217ed874 100644 --- a/src/PartSetPlugin/PartSetPlugin_Duplicate.h +++ b/src/PartSetPlugin/PartSetPlugin_Duplicate.h @@ -23,12 +23,6 @@ class PartSetPlugin_Duplicate : public PartSetPlugin_Part return MY_DUPLICATE_KIND; } - /// the reference to copy: reference to the attribute - inline static const std::string& ORIGIN_REF() - { - static const std::string MY_DUPLICATE_ID("Origin"); - return MY_DUPLICATE_ID; - } /// Makes a new part, copy of active PartSetPlugin_Duplicate(); -- 2.39.2