// invalid data
const static std::shared_ptr<ModelAPI_Data> kInvalid(new Model_Data());
-Model_Data::Model_Data() : mySendAttributeUpdated(true)
+Model_Data::Model_Data() : mySendAttributeUpdated(true), myWasChangedButBlocked(false)
{
}
{
theAttr->setInitialized();
if (theAttr->isArgument()) {
- static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
- ModelAPI_EventCreator::get()->sendUpdated(myObject, anEvent);
- if (mySendAttributeUpdated && myObject) {
- myObject->attributeChanged(theAttr->id());
+ if (mySendAttributeUpdated) {
+ if (myObject) {
+ myObject->attributeChanged(theAttr->id());
+ static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
+ ModelAPI_EventCreator::get()->sendUpdated(myObject, anEvent);
+ }
+ } else {
+ myWasChangedButBlocked = true;
}
}
}
void Model_Data::blockSendAttributeUpdated(const bool theBlock)
{
- mySendAttributeUpdated = !theBlock;
+ if (mySendAttributeUpdated == theBlock) {
+ mySendAttributeUpdated = !theBlock;
+ if (mySendAttributeUpdated && myWasChangedButBlocked) { // so, now it is ok to send the update signal
+ static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
+ ModelAPI_EventCreator::get()->sendUpdated(myObject, anEvent);
+ myWasChangedButBlocked = false;
+ }
+ }
}
void Model_Data::erase()
std::set<AttributePtr> myRefsToMe;
/// flag that may block the "attribute updated" sending
bool mySendAttributeUpdated;
+ /// if some attribute was changed, but mySendAttributeUpdated was false, this flag stores this
+ bool myWasChangedButBlocked;
/// Returns label of this feature
TDF_Label label()