#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_Tools.h>
#include <ModelAPI_ResultBody.h>
-
#include <Events_Loop.h>
#include <Events_InfoMessage.h>
#include <TDF_ChildIDIterator.hxx>
#include <TDF_LabelMapHasher.hxx>
#include <TDF_Delta.hxx>
-#include <OSD_File.hxx>
-#include <OSD_Path.hxx>
#include <TDF_AttributeDelta.hxx>
#include <TDF_AttributeDeltaList.hxx>
#include <TDF_ListIteratorOfAttributeDeltaList.hxx>
#include <TDF_ListIteratorOfLabelList.hxx>
-#include <TopoDS_Shape.hxx>
+#include <TDF_LabelMap.hxx>
#include <TNaming_SameShapeIterator.hxx>
#include <TNaming_Iterator.hxx>
#include <TNaming_NamedShape.hxx>
#include <TNaming_Tool.hxx>
+
#include <TopExp_Explorer.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include <OSD_File.hxx>
+#include <OSD_Path.hxx>
#include <climits>
#ifndef WIN32
}
}
-/// Compares the content ofthe given attributes, returns true if equal.
+/// Compares the content of the given attributes, returns true if equal.
/// This method is used to avoid empty transactions when only "current" is changed
/// to some value and then comes back in this transaction, so, it compares only
/// references and Boolean and Integer Arrays for the current moment.
}
// add also label of the modified attributes
const TDF_AttributeDeltaList& anAttrs = aDelta->AttributeDeltas();
+ TDF_LabelMap anExcludedInt; /// named shape evolution also modifies integer on this label: exclude it
for (TDF_ListIteratorOfAttributeDeltaList anAttr(anAttrs); anAttr.More(); anAttr.Next()) {
- theDelta.Append(anAttr.Value()->Label());
+ if (anAttr.Value()->Attribute()->ID() == TDataStd_BooleanArray::GetID()) {
+ continue; // Boolean array is used for feature auxiliary attributes only, feature args are not modified
+ }
+ if (anAttr.Value()->Attribute()->ID() == TNaming_NamedShape::GetID()) {
+ anExcludedInt.Add(anAttr.Value()->Label());
+ continue; // named shape evolution is changed in history update => skip them, they are not the features arguents
+ }
+ if (anAttr.Value()->Attribute()->ID() == TDataStd_Integer::GetID()) {
+ if (anExcludedInt.Contains(anAttr.Value()->Label()))
+ continue;
+ }
+ theDelta.Append(anAttr.Value()->Label());
+ }
+ TDF_ListIteratorOfLabelList aDeltaIter(theDelta);
+ for(; aDeltaIter.More(); aDeltaIter.Next()) {
+ if (anExcludedInt.Contains(aDeltaIter.Value())) {
+ theDelta.Remove(aDeltaIter);
+ if (!aDeltaIter.More())
+ break;
+ }
}
}
}
if (anIter->setDisabled(aDisabledFlag)) {
- // state of feature is changed => so feature become updated
static Events_ID anUpdateEvent = aLoop->eventByName(EVENT_OBJECT_UPDATED);
- ModelAPI_EventCreator::get()->sendUpdated(anIter, anUpdateEvent);
+ // state of feature is changed => so inform that it must be updated if it has such state
+ if (!aDisabledFlag && anIter->data()->execState() == ModelAPI_StateMustBeUpdated)
+ ModelAPI_EventCreator::get()->sendUpdated(anIter, anUpdateEvent);
// flush is in the end of this method
ModelAPI_EventCreator::get()->sendUpdated(anIter, aRedispEvent /*, false*/);
aWasChanged = true;
static const Events_ID kPreviewBlockedEvent = aLoop->eventByName(EVENT_PREVIEW_BLOCKED);
static const Events_ID kPreviewRequestedEvent = aLoop->eventByName(EVENT_PREVIEW_REQUESTED);
static const Events_ID kReorderEvent = aLoop->eventByName(EVENT_ORDER_UPDATED);
+ static const Events_ID kRedisplayEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
#ifdef DEB_UPDATE
std::cout<<"****** Event "<<theMessage->eventID().eventText()<<std::endl;
const std::set<ObjectPtr>& anObjs = aMsg->objects();
std::set<ObjectPtr>::const_iterator anObjIter = anObjs.cbegin();
for(; anObjIter != anObjs.cend(); anObjIter++) {
- if (std::dynamic_pointer_cast<Model_Document>((*anObjIter)->document())->executeFeatures())
- ModelAPI_EventCreator::get()->sendUpdated(*anObjIter, kUpdatedEvent);
+ if (std::dynamic_pointer_cast<Model_Document>((*anObjIter)->document())->executeFeatures()) {
+ if ((*anObjIter)->groupName() == ModelAPI_Feature::group()) { // results creation means enabling, not update
+ ModelAPI_EventCreator::get()->sendUpdated(*anObjIter, kUpdatedEvent);
+ } else {
+ ModelAPI_EventCreator::get()->sendUpdated(*anObjIter, kRedisplayEvent);
+ }
+ }
}
return;
}
// the redisplay signal should be flushed in order to erase the feature presentation in the viewer
// if should be done after removeFeature() of document,
// by this reason, upper processFeatures() do not perform this flush
- Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
+ Events_Loop::loop()->flush(kRedisplayEvent);
// in the end of transaction everything is updated, so clear the old objects
myIsParamUpdated = false;