// TDataStd_Name - name of the object
// TDataStd_Integer - state of the object execution
-Model_Data::Model_Data()
+Model_Data::Model_Data() : mySendAttributeUpdated(true)
{
}
if (theAttr->isArgument()) {
static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
ModelAPI_EventCreator::get()->sendUpdated(myObject, anEvent);
- if (myObject) {
+ if (mySendAttributeUpdated && myObject) {
myObject->attributeChanged(theAttr->id());
}
}
}
+void Model_Data::blockSendAttributeUpdated(const bool theBlock)
+{
+ mySendAttributeUpdated = !theBlock;
+}
+
void Model_Data::erase()
{
if (!myLab.IsNull())
/// List of attributes referenced to owner (updated only during the transaction change)
std::set<AttributePtr> myRefsToMe;
+ /// flag that may block the "attribute updated" sending
+ bool mySendAttributeUpdated;
Model_Data();
/// Useful method for "set" methods of the attributes: sends an UPDATE event and
/// makes attribute initialized
MODEL_EXPORT virtual void sendAttributeUpdated(ModelAPI_Attribute* theAttr);
+ /// Blocks sending "attribute updated" if theBlock is true
+ MODEL_EXPORT virtual void blockSendAttributeUpdated(const bool theBlock);
/// Puts feature to the document data sub-structure
MODEL_EXPORT void setLabel(TDF_Label theLab);
/// Useful method for "set" methods of the attributes: sends an UPDATE event and
/// makes attribute initialized
virtual void sendAttributeUpdated(ModelAPI_Attribute* theAttr) = 0;
+ /// Blocks sending "attribute updated" if theBlock is true
+ virtual void blockSendAttributeUpdated(const bool theBlock) = 0;
/// Erases all the data from the data model
virtual void erase() = 0;
{
AttributeSelectionPtr aAttr = data()->selection(EXTERNAL_ID());
if (aAttr)
- return aAttr->context().get();
+ return aAttr->context().get() == NULL;
return false;
}
// We should go through the attributes map, because only attributes have valued parameters
std::map<std::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::iterator anEntIter =
myEntityAttrMap.begin();
- for (; anEntIter != myEntityAttrMap.end(); anEntIter++)
+ for (; anEntIter != myEntityAttrMap.end(); anEntIter++) {
+ if (anEntIter->first->owner().get() && anEntIter->first->owner()->data().get())
+ anEntIter->first->owner()->data()->blockSendAttributeUpdated(true);
if (updateAttribute(anEntIter->first, anEntIter->second))
updateRelatedConstraints(anEntIter->first);
+ }
+ // unblock all features then
+ for (; anEntIter != myEntityAttrMap.end(); anEntIter++) {
+ if (anEntIter->first->owner().get() && anEntIter->first->owner()->data().get())
+ anEntIter->first->owner()->data()->blockSendAttributeUpdated(false);
+ }
} else if (!myConstraints.empty())
Events_Error::send(SketchSolver_Error::CONSTRAINTS(), this);