Salome HOME
Fix for the problem that on undo/redo of feature creation (in this particular case...
authormpv <mpv@opencascade.com>
Thu, 12 Jan 2017 15:31:16 +0000 (18:31 +0300)
committermpv <mpv@opencascade.com>
Thu, 12 Jan 2017 15:31:31 +0000 (18:31 +0300)
src/Model/Model_Document.cpp
src/Model/Model_Objects.cpp
src/Model/Model_Objects.h
src/Model/Model_Session.cpp

index 2afecb39cd95f5bf52190e1406dbd35a83f3c6ce..d54b83130c5e2af0431b3f204618b608ad11436f 100755 (executable)
@@ -726,7 +726,7 @@ void Model_Document::abortOperation()
   for (; aSubIter != aSubs.end(); aSubIter++)
     subDoc(*aSubIter)->abortOperation();
   // references may be changed because they are set in attributes on the fly
-  myObjs->synchronizeFeatures(aDeltaLabels, true, false, isRoot());
+  myObjs->synchronizeFeatures(aDeltaLabels, true, false, false, isRoot());
 }
 
 bool Model_Document::isOperation() const
@@ -793,7 +793,7 @@ void Model_Document::undoInternal(const bool theWithSubs, const bool theSynchron
   }
   // after undo of all sub-documents to avoid updates on not-modified data (issue 370)
   if (theSynchronize) {
-    myObjs->synchronizeFeatures(aDeltaLabels, true, false, isRoot());
+    myObjs->synchronizeFeatures(aDeltaLabels, true, false, false, isRoot());
     // update the current features status
     setCurrentFeature(currentFeature(false), false);
   }
@@ -840,7 +840,7 @@ void Model_Document::redo()
     subDoc(*aSubIter)->redo();
 
   // after redo of all sub-documents to avoid updates on not-modified data (issue 370)
-  myObjs->synchronizeFeatures(aDeltaLabels, true, false, isRoot());
+  myObjs->synchronizeFeatures(aDeltaLabels, true, false, false, isRoot());
   // update the current features status
   setCurrentFeature(currentFeature(false), false);
 }
index 164b088207d493e5e0fbef70db6dc2017b05da16..f0ebc884c6dae7d99123843e29196f0f92374249 100644 (file)
@@ -55,7 +55,7 @@ void Model_Objects::setOwner(DocumentPtr theDoc)
   myDoc = theDoc;
   // update all fields and recreate features and result objects if needed
   TDF_LabelList aNoUpdated;
-  synchronizeFeatures(aNoUpdated, true, true, true);
+  synchronizeFeatures(aNoUpdated, true, true, true, true);
   myHistory.clear();
 }
 
@@ -612,7 +612,7 @@ std::shared_ptr<ModelAPI_Feature> Model_Objects::featureById(const int theId)
 
 void Model_Objects::synchronizeFeatures(
   const TDF_LabelList& theUpdated, const bool theUpdateReferences,
-  const bool theOpen, const bool theFlush)
+  const bool theExecuteFeatures, const bool theOpen, const bool theFlush)
 {
   Model_Document* anOwner = std::dynamic_pointer_cast<Model_Document>(myDoc).get();
   if (!anOwner) // this may happen on creation of document: nothing there, so nothing to synchronize
@@ -750,7 +750,7 @@ void Model_Objects::synchronizeFeatures(
     myHistory.clear();
   }
 
-  if (theOpen)
+  if (theExecuteFeatures)
     anOwner->executeFeatures() = false;
   aLoop->activateFlushes(isActive);
 
@@ -764,7 +764,7 @@ void Model_Objects::synchronizeFeatures(
     aLoop->flush(aRedispEvent);
     aLoop->flush(aToHideEvent);
   }
-  if (theOpen)
+  if (theExecuteFeatures)
     anOwner->executeFeatures() = true;
 }
 
index af366689b81557d544219a97d764fc0d39750002..9b7b6bda3026b45366e8c8d393826d30ccc26720 100644 (file)
@@ -148,10 +148,12 @@ class Model_Objects
   //! Synchronizes myFeatures list with the updated document
   //! \param theUpdated list of labels that are marked as modified, so featrues must be also
   //! \param theUpdateReferences causes the update of back-references
+  //! \param theExecuteFeatures requires re-execute modified persistent features
+  //!            (not needed on undo/redo/abort/open)
   //! \param theOpen - on open nothing must be reexecuted, except not persistent results
   //! \param theFlush makes flush all events in the end of all modifications of this method
   void synchronizeFeatures(const TDF_LabelList& theUpdated, const bool theUpdateReferences,
-    const bool theOpen, const bool theFlush);
+    const bool theOpen, const bool theExecuteFeatures, const bool theFlush);
   //! Synchronizes the BackReferences list in Data of Features and Results
   void synchronizeBackRefs();
 
index 9d13485f3d8a1fed152f50aef9875fab175c676a..7081ebd418b4cdbfb0dee22917dec9040c1f5d4d 100644 (file)
@@ -266,7 +266,7 @@ void Model_Session::setActiveDocument(
         bool aWasChecked = myCheckTransactions;
         setCheckTransactions(false);
         TDF_LabelList anEmptyUpdated;
-        aDoc->objects()->synchronizeFeatures(anEmptyUpdated, true, true, true);
+        aDoc->objects()->synchronizeFeatures(anEmptyUpdated, true, true, false, true);
         if (aWasChecked)
             setCheckTransactions(true);
       }
@@ -329,7 +329,7 @@ std::shared_ptr<ModelAPI_Document> Model_Session::copy(
   TDF_CopyTool::Copy(aDS, aRT);
 
   TDF_LabelList anEmptyUpdated;
-  aNew->objects()->synchronizeFeatures(anEmptyUpdated, true, true, true);
+  aNew->objects()->synchronizeFeatures(anEmptyUpdated, true, true, true, true);
   return aNew;
 }