#include <ModelAPI_Validator.h>
#include <ModelAPI_CompositeFeature.h>
#include <ModelAPI_Tools.h>
+#include <ModelAPI_Filter.h>
+
#include <Events_Loop.h>
#include <Events_InfoMessage.h>
if (anUpdatedMap.Contains(aFeatureLabel)) {
if (!theOpen) { // on abort/undo/redo reinitialize attributes if something is changed
- std::list<std::shared_ptr<ModelAPI_Attribute> > anAttrs =
- anObject->data()->attributes("");
- std::list<std::shared_ptr<ModelAPI_Attribute> >::iterator anAttr = anAttrs.begin();
- for(; anAttr != anAttrs.end(); anAttr++)
- (*anAttr)->reinit();
+ FiltersFeaturePtr aFilter = std::dynamic_pointer_cast<ModelAPI_FiltersFeature>(anObject);
+ if (aFilter.get()) { // for filters attributes may be added/removed on undo/redo
+ std::dynamic_pointer_cast<Model_Data>(aFilter->data())->clearAttributes();
+ aFilter->initAttributes();
+ } else {
+ std::list<std::shared_ptr<ModelAPI_Attribute> > anAttrs =
+ anObject->data()->attributes("");
+ std::list<std::shared_ptr<ModelAPI_Attribute> >::iterator anAttr = anAttrs.begin();
+ for(; anAttr != anAttrs.end(); anAttr++)
+ (*anAttr)->reinit();
+ // if feature contains results, re-init them too
+ if (aFeature.get()) {
+ std::list<ResultPtr> aResults;
+ ModelAPI_Tools::allResults(aFeature, aResults);
+ std::list<ResultPtr>::iterator aResIter = aResults.begin();
+ for(; aResIter != aResults.end(); aResIter++) {
+ std::list<std::shared_ptr<ModelAPI_Attribute> > anAttrs =
+ (*aResIter)->data()->attributes("");
+ std::list<std::shared_ptr<ModelAPI_Attribute> >::iterator anAttr = anAttrs.begin();
+ for(; anAttr != anAttrs.end(); anAttr++)
+ (*anAttr)->reinit();
+ }
+ }
+ }
}
ModelAPI_EventCreator::get()->sendUpdated(anObject, anUpdateEvent);
if (aFeature && aFeature->getKind() == "Parameter") {
}
}
+ // 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<ResultPtr>::const_iterator aResIter = theFeature->results().cbegin();
while(aResIter != theFeature->results().cend()) {
}
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());