X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_Objects.cpp;h=152aaaeb84ee27a8c4211c1c3d3618dae7221f50;hb=8d04b5f4360b23cf376beff9c5e7c12d0e6a5f1e;hp=971f8a3051da67e66a5be5758220243b815f44e9;hpb=819ac55df60ac23a041c86f1c2dc99a1348f3826;p=modules%2Fshaper.git diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index 971f8a305..152aaaeb8 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -32,6 +32,8 @@ #include #include #include +#include + #include #include @@ -874,11 +876,30 @@ void Model_Objects::synchronizeFeatures( if (anUpdatedMap.Contains(aFeatureLabel)) { if (!theOpen) { // on abort/undo/redo reinitialize attributes if something is changed - std::list > anAttrs = - anObject->data()->attributes(""); - std::list >::iterator anAttr = anAttrs.begin(); - for(; anAttr != anAttrs.end(); anAttr++) - (*anAttr)->reinit(); + FiltersFeaturePtr aFilter = std::dynamic_pointer_cast(anObject); + if (aFilter.get()) { // for filters attributes may be added/removed on undo/redo + std::dynamic_pointer_cast(aFilter->data())->clearAttributes(); + aFilter->initAttributes(); + } else { + std::list > anAttrs = + anObject->data()->attributes(""); + std::list >::iterator anAttr = anAttrs.begin(); + for(; anAttr != anAttrs.end(); anAttr++) + (*anAttr)->reinit(); + // if feature contains results, re-init them too + if (aFeature.get()) { + std::list aResults; + ModelAPI_Tools::allResults(aFeature, aResults); + std::list::iterator aResIter = aResults.begin(); + for(; aResIter != aResults.end(); aResIter++) { + std::list > anAttrs = + (*aResIter)->data()->attributes(""); + std::list >::iterator anAttr = anAttrs.begin(); + for(; anAttr != anAttrs.end(); anAttr++) + (*anAttr)->reinit(); + } + } + } } ModelAPI_EventCreator::get()->sendUpdated(anObject, anUpdateEvent); if (aFeature && aFeature->getKind() == "Parameter") { @@ -1827,6 +1848,10 @@ void Model_Objects::updateResults(FeaturePtr theFeature, std::set& t } } + // it may be on undo + if (!theFeature->data() || !theFeature->data()->isValid() || theFeature->isDisabled()) + return; + // check the existing results and remove them if there is nothing on the label std::list::const_iterator aResIter = theFeature->results().cbegin(); while(aResIter != theFeature->results().cend()) { @@ -1843,9 +1868,6 @@ void Model_Objects::updateResults(FeaturePtr theFeature, std::set& t } aResIter++; } - // it may be on undo - if (!theFeature->data() || !theFeature->data()->isValid() || theFeature->isDisabled()) - return; // check that results are presented on all labels int aResSize = int(theFeature->results().size()); TDF_ChildIterator aLabIter(resultLabel(theFeature->data(), 0).Father()); @@ -1877,7 +1899,9 @@ void Model_Objects::updateResults(FeaturePtr theFeature, std::set& t } else if (aGroup->Get() == ModelAPI_ResultGroup::group().c_str()) { aNewBody = createGroup(theFeature->data(), aResIndex); } else if (aGroup->Get() == ModelAPI_ResultField::group().c_str()) { - aNewBody = createField(theFeature->data(), aResIndex); + ResultFieldPtr aField = createField(theFeature->data(), aResIndex); + aField->updateSteps(); // to refresh the internal data + aNewBody = aField; } else if (aGroup->Get() == ModelAPI_ResultParameter::group().c_str()) { theFeature->attributeChanged("expression"); // just produce a value } else {