X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_AttributeSelectionList.cpp;h=ae079d7a1673e8158816beeb0416511202124aae;hb=ebf59abe16d4ccc81cd1eb506f1f897c06a41ccb;hp=24a9efca5308d5684d3030a0b55c6ac5d4fd8f54;hpb=a24b7e6f4d112d5e7889fd76f030298fc428cd01;p=modules%2Fshaper.git diff --git a/src/Model/Model_AttributeSelectionList.cpp b/src/Model/Model_AttributeSelectionList.cpp index 24a9efca5..ae079d7a1 100644 --- a/src/Model/Model_AttributeSelectionList.cpp +++ b/src/Model/Model_AttributeSelectionList.cpp @@ -39,6 +39,7 @@ void Model_AttributeSelectionList::append( if (owner()) { aNewAttr->setObject(owner()); } + aNewAttr->setID(id()); mySize->Set(aNewTag); aNewAttr->setValue(theContext, theSubShape); owner()->data()->sendAttributeUpdated(this); @@ -95,12 +96,28 @@ void Model_AttributeSelectionList::clear() mySize->Set(0); TDF_ChildIterator aSubIter(mySize->Label()); for(; aSubIter.More(); aSubIter.Next()) { - aSubIter.Value().ForgetAllAttributes(Standard_True); + TDF_Label aLab = aSubIter.Value(); + std::shared_ptr aNewAttr = + std::shared_ptr(new Model_AttributeSelection(aLab)); + if (owner()) { + aNewAttr->setObject(owner()); + } + REMOVE_BACK_REF(aNewAttr->context()); + + aLab.ForgetAllAttributes(Standard_True); } owner()->data()->sendAttributeUpdated(this); } } +bool Model_AttributeSelectionList::isInitialized() +{ + if (size() == 0) { // empty list is not initialized list: sketch will be not valid after add/undo + return false; + } + return ModelAPI_AttributeSelectionList::isInitialized(); +} + Model_AttributeSelectionList::Model_AttributeSelectionList(TDF_Label& theLabel) { myIsInitialized = theLabel.FindAttribute(TDataStd_Integer::GetID(), mySize) == Standard_True;