From: vsv Date: Wed, 6 Nov 2019 07:40:33 +0000 (+0300) Subject: Issue #3058: Avoid recursive call of object redisplay X-Git-Tag: V9_5_0a1~167^2~79 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a894060cf7f5ead6fa92d2f151e9f60712dc7a2f;p=modules%2Fshaper.git Issue #3058: Avoid recursive call of object redisplay --- diff --git a/src/Model/Model_AttributeIntArray.cpp b/src/Model/Model_AttributeIntArray.cpp index b8da16945..f933ad261 100644 --- a/src/Model/Model_AttributeIntArray.cpp +++ b/src/Model/Model_AttributeIntArray.cpp @@ -43,25 +43,28 @@ int Model_AttributeIntArray::size() return (myArray.IsNull() || !myArray->IsValid()) ? 0 : myArray->Length(); } -void Model_AttributeIntArray::setSize(const int theSize) +void Model_AttributeIntArray::setSize(const int theSize, bool sendUpdated) { if (myArray.IsNull() || !myArray->IsValid()) { // create array if it is not done yet if (theSize != 0) { // if size is zero, nothing to do (null array means there is no array) myArray = TDataStd_IntegerArray::Set(myLab, 0, theSize - 1); - owner()->data()->sendAttributeUpdated(this); + if (sendUpdated) + owner()->data()->sendAttributeUpdated(this); } } else { // reset the old array if (theSize) { if (theSize != myArray->Length()) { // old data is not kept, a new array is created Handle(TColStd_HArray1OfInteger) aNewArray = new TColStd_HArray1OfInteger(0, theSize - 1); myArray->ChangeArray(aNewArray); - owner()->data()->sendAttributeUpdated(this); + if (sendUpdated) + owner()->data()->sendAttributeUpdated(this); } } else { // size is zero => array must be erased if (!myArray.IsNull()) { myArray.Nullify(); myLab.ForgetAttribute(TDataStd_IntegerArray::GetID()); - owner()->data()->sendAttributeUpdated(this); + if (sendUpdated) + owner()->data()->sendAttributeUpdated(this); } } } diff --git a/src/Model/Model_AttributeIntArray.h b/src/Model/Model_AttributeIntArray.h index 1c7d10166..98040141e 100644 --- a/src/Model/Model_AttributeIntArray.h +++ b/src/Model/Model_AttributeIntArray.h @@ -47,7 +47,8 @@ class Model_AttributeIntArray : public ModelAPI_AttributeIntArray MODEL_EXPORT virtual int size(); /// Sets the new size of the array. The previous data is erased. - MODEL_EXPORT virtual void setSize(const int theSize); + MODEL_EXPORT virtual void setSize(const int theSize, + bool sendUpdated = true); /// Defines the value of the array by index [0; size-1] MODEL_EXPORT virtual void setValue(const int theIndex, diff --git a/src/ModelAPI/ModelAPI_AttributeIntArray.h b/src/ModelAPI/ModelAPI_AttributeIntArray.h index b8b146ff2..e77841875 100644 --- a/src/ModelAPI/ModelAPI_AttributeIntArray.h +++ b/src/ModelAPI/ModelAPI_AttributeIntArray.h @@ -40,7 +40,8 @@ class ModelAPI_AttributeIntArray : public ModelAPI_Attribute MODELAPI_EXPORT virtual int size() = 0; /// Sets the new size of the array. The previous data is erased. - MODELAPI_EXPORT virtual void setSize(const int theSize) = 0; + MODELAPI_EXPORT virtual void setSize(const int theSize, + bool sendUpdated = true) = 0; /// Defines the value of the array by index [0; size-1] MODELAPI_EXPORT virtual void setValue(const int theIndex, diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index ea764c531..6bdb4a92b 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -2237,7 +2237,7 @@ void PartSet_SketcherMgr::customizeSketchPresentation(const ObjectPtr& theObject if (ModelAPI_Session::get()->isOperation()) { AttributeIntArrayPtr aColorAttr = theObject->data()->intArray(ModelAPI_Result::COLOR_ID()); if (aColorAttr.get()) { - aColorAttr->setSize(3); + aColorAttr->setSize(3, false); // Set the color attribute in order do not use default colors in the presentation object for (int i = 0; i < 3; i++) aColorAttr->setValue(i, aColor[i], false);