From 564e154b4d199d9ca64e3accf73918d9708b94a8 Mon Sep 17 00:00:00 2001 From: mpv Date: Thu, 12 Jan 2017 18:31:16 +0300 Subject: [PATCH] Fix for the problem that on undo/redo of feature creation (in this particular case it is Partition of wires), some attributes are appeared in the OCAF tree. It may lead problem of already existing name (and as a consequence, bad name of sub-results generation). --- src/Model/Model_Document.cpp | 6 +++--- src/Model/Model_Objects.cpp | 8 ++++---- src/Model/Model_Objects.h | 4 +++- src/Model/Model_Session.cpp | 4 ++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index 2afecb39c..d54b83130 100755 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -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); } diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index 164b08820..f0ebc884c 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -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 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(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; } diff --git a/src/Model/Model_Objects.h b/src/Model/Model_Objects.h index af366689b..9b7b6bda3 100644 --- a/src/Model/Model_Objects.h +++ b/src/Model/Model_Objects.h @@ -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(); diff --git a/src/Model/Model_Session.cpp b/src/Model/Model_Session.cpp index 9d13485f3..7081ebd41 100644 --- a/src/Model/Model_Session.cpp +++ b/src/Model/Model_Session.cpp @@ -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 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; } -- 2.39.2