From: jfa Date: Wed, 14 Sep 2005 06:35:35 +0000 (+0000) Subject: Force saving of presentations parameters during saving of animation X-Git-Tag: V3_1_0a1~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=87686dc7e3c63c3f86d793005a34bebad5f89149;p=modules%2Fvisu.git Force saving of presentations parameters during saving of animation --- diff --git a/src/VISU_I/VISU_TimeAnimation.cxx b/src/VISU_I/VISU_TimeAnimation.cxx index de93129c..46ec8a89 100644 --- a/src/VISU_I/VISU_TimeAnimation.cxx +++ b/src/VISU_I/VISU_TimeAnimation.cxx @@ -664,19 +664,18 @@ SALOMEDS::SObject_ptr VISU_TimeAnimation::publishInStudy() for (int i = 0; i < getNbFields(); i++) { FieldData& aData = myFieldsLst[i]; + _PTR(SObject) newObj = aStudyBuilder->NewObject(aAnimSObject); aStudyBuilder->Addreference(newObj, aData.myField); + if (aData.myPrs.empty()) { generatePresentations(i); - //VISU::CreateAttributes(myStudy, newObj->GetID().c_str(),"","", - // GetPresentationComment(aData.myPrsType).c_str(),"","",true); - }// else { - ostringstream strOut; - aData.myPrs[0]->ToStream(strOut); - string aPrsComment = strOut.str(); - VISU::CreateAttributes(myStudy, newObj->GetID().c_str(),"","", - aData.myPrs[0]->GetComment(),"",aPrsComment.c_str(),true); - //} + } + ostringstream strOut; + aData.myPrs[0]->ToStream(strOut); + string aPrsComment = strOut.str(); + VISU::CreateAttributes(myStudy, newObj->GetID().c_str(),"","", + aData.myPrs[0]->GetComment(),"",aPrsComment.c_str(),true); } aStudyBuilder->CommitCommand(); @@ -686,7 +685,7 @@ SALOMEDS::SObject_ptr VISU_TimeAnimation::publishInStudy() //************************************************************************ void VISU_TimeAnimation::saveAnimation() { - if (myStudy->GetProperties()->IsLocked()) return; + if (myStudy->GetProperties()->IsLocked()) return; if (myAnimEntry.isEmpty()) return; _PTR(SObject) aAnimSObject = myStudy->FindObjectID(myAnimEntry.latin1()); @@ -707,26 +706,25 @@ void VISU_TimeAnimation::saveAnimation() aCmnt->SetValue(aComment.latin1()); _PTR(ChildIterator) anIter = myStudy->NewChildIterator(aAnimSObject); - int i; - for (i = 0, anIter->Init(); anIter->More(); anIter->Next(), i++) { + int i = 0, nbf = getNbFields(); + for (anIter->Init(); anIter->More(); anIter->Next(), i++) { + if (i >= nbf) break; // it must not be FieldData& aData = myFieldsLst[i]; + // Get presentation name and comment + if (aData.myPrs.empty()) { + generatePresentations(i); + } + ostringstream strOut; + aData.myPrs[0]->ToStream(strOut); + string aPrsComment = strOut.str(); + string aPrsNameTxt = aData.myPrs[0]->GetComment(); + + // Save in study _PTR(SObject) aRefObj = anIter->Value(); _PTR(ChildIterator) anPrsIter = myStudy->NewChildIterator(aRefObj); anPrsIter->Init(); - string aPrsComment, aPrsNameTxt; - if (aData.myPrs.empty()) { - aPrsComment = ""; - aPrsNameTxt = GetPresentationComment(aData.myPrsType); - } else { - ostringstream strOut; - aData.myPrs[0]->ToStream(strOut); - aPrsComment = strOut.str(); - - aPrsNameTxt = aData.myPrs[0]->GetComment(); - } - if (anPrsIter->More()) { _PTR(SObject) aPrsObj = anPrsIter->Value(); anAttr = aStudyBuilder->FindOrCreateAttribute(aPrsObj, "AttributeComment");