From: dbv Date: Thu, 18 Feb 2016 14:33:39 +0000 (+0300) Subject: Bug #1281: "Load study" doesn't work with revolution X-Git-Tag: V_2.2.0~98 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=68d4cb233e48ce3c2ca827d8c32bf5fe54e6bf8c;p=modules%2Fshaper.git Bug #1281: "Load study" doesn't work with revolution --- diff --git a/src/Model/Model_AttributeRefList.cpp b/src/Model/Model_AttributeRefList.cpp index a1e0aeb66..cf45b99a9 100644 --- a/src/Model/Model_AttributeRefList.cpp +++ b/src/Model/Model_AttributeRefList.cpp @@ -68,7 +68,7 @@ int Model_AttributeRefList::size(const bool theWithEmpty) const int aResult = 0; const TDF_LabelList& aList = myRef->List(); for (TDF_ListIteratorOfLabelList aLIter(aList); aLIter.More(); aLIter.Next()) { - if (!aLIter.Value().IsNull()) aResult++; + if (!aLIter.Value().IsNull() && !aLIter.Value().IsRoot()) aResult++; } return aResult; } @@ -90,7 +90,7 @@ list Model_AttributeRefList::list() const TDF_LabelList& aList = myRef->List(); for (TDF_ListIteratorOfLabelList aLIter(aList); aLIter.More(); aLIter.Next()) { ObjectPtr anObj; - if (!aLIter.Value().IsNull()) + if (!aLIter.Value().IsNull() && !aLIter.Value().IsRoot()) anObj = aDoc->objects()->object(aLIter.Value()); aResult.push_back(anObj); } @@ -129,10 +129,10 @@ ObjectPtr Model_AttributeRefList::object(const int theIndex, const bool theWithE const TDF_LabelList& aList = myRef->List(); int anIndex = -1; for (TDF_ListIteratorOfLabelList aLIter(aList); aLIter.More(); aLIter.Next()) { - if (theWithEmpty || !aLIter.Value().IsNull()) + if (theWithEmpty || (!aLIter.Value().IsNull() && !aLIter.Value().IsRoot())) anIndex++; if (anIndex == theIndex) { - if (aLIter.Value().IsNull()) { // null label => null sub + if (aLIter.Value().IsNull() || aLIter.Value().IsRoot()) { // null label => null sub return ObjectPtr(); } return aDoc->objects()->object(aLIter.Value()); @@ -155,6 +155,8 @@ void Model_AttributeRefList::substitute(const ObjectPtr& theCurrent, const Objec std::shared_ptr aNewData = std::dynamic_pointer_cast(theNew->data()); aNewLab = aNewData->label().Father(); + } else { + aNewLab = aCurrentLab.Root(); // root means null object } // do the substitution ADD_BACK_REF(theNew);