X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_AttributeRefAttr.cpp;h=0c24fe3e1b762cfa047e634473aca9408b288c2c;hb=ebf59abe16d4ccc81cd1eb506f1f897c06a41ccb;hp=38e989e047ca7f10928df123f79e44117b43d02a;hpb=a1f792970074d097f2f8a408dfcae5f6c263a6ca;p=modules%2Fshaper.git diff --git a/src/Model/Model_AttributeRefAttr.cpp b/src/Model/Model_AttributeRefAttr.cpp index 38e989e04..0c24fe3e1 100644 --- a/src/Model/Model_AttributeRefAttr.cpp +++ b/src/Model/Model_AttributeRefAttr.cpp @@ -7,6 +7,7 @@ #include "Model_AttributeRefAttr.h" #include "Model_Application.h" #include "Model_Data.h" +#include "Model_Objects.h" #include using namespace std; @@ -45,7 +46,7 @@ void Model_AttributeRefAttr::setObject(ObjectPtr theObject) { // the back reference from the previous object to the attribute should be removed ObjectPtr anObject = object(); - if (theObject && (!myIsInitialized || myID->Get().Length() != 0 || object() != theObject)) { + if (theObject.get() && (!myIsInitialized || myID->Get().Length() != 0 || object() != theObject)) { REMOVE_BACK_REF(anObject); std::shared_ptr aData = std::dynamic_pointer_cast( @@ -76,13 +77,21 @@ ObjectPtr Model_AttributeRefAttr::object() owner()->document()); if (aDoc) { TDF_Label aRefLab = myRef->Get(); - return aDoc->object(aRefLab); + return aDoc->objects()->object(aRefLab); } } // not initialized return ObjectPtr(); } +bool Model_AttributeRefAttr::isInitialized() +{ + if (myRef->Get() == myRef->Label()) { // empty is not initialized: sketch parallelity + return false; + } + return ModelAPI_AttributeRefAttr::isInitialized(); +} + Model_AttributeRefAttr::Model_AttributeRefAttr(TDF_Label& theLabel) { myIsInitialized = theLabel.FindAttribute(TDataStd_Comment::GetID(), myID) == Standard_True;