X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSetPlugin%2FPartSetPlugin_Duplicate.cpp;h=462a7366bdab45a2b9ebef798aa12ccf0bc41bdf;hb=61cd0845b41710ad4e7eae07cc6106904be67b9f;hp=37ff14adda0865bf2aeae1e5087d5044c27ae6b7;hpb=38afbd899a8645c83e17f2c24a17a2b7414911b4;p=modules%2Fshaper.git diff --git a/src/PartSetPlugin/PartSetPlugin_Duplicate.cpp b/src/PartSetPlugin/PartSetPlugin_Duplicate.cpp index 37ff14add..462a7366b 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,19 @@ 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(); } + +const std::string& PartSetPlugin_Duplicate::documentToAdd() +{ + // part must be added only to the module document + return ModelAPI_Session::get()->moduleDocument()->kind(); +}