Salome HOME
Porting to OCCT 7.5.0 and minor improvements/bugfixes.
authormpv <mpv@opencascade.com>
Tue, 24 Nov 2020 11:46:37 +0000 (14:46 +0300)
committermpv <mpv@opencascade.com>
Tue, 24 Nov 2020 11:46:50 +0000 (14:46 +0300)
src/FeaturesPlugin/doc/images/Split_panel.png [new file with mode: 0644]
src/FeaturesPlugin/doc/splitFeature.rst
src/Model/Model_AttributeRefList.cpp
src/Model/Model_Document.cpp
src/Model/Model_Update.cpp
src/XGUI/XGUI_ContextMenuMgr.cpp

diff --git a/src/FeaturesPlugin/doc/images/Split_panel.png b/src/FeaturesPlugin/doc/images/Split_panel.png
new file mode 100644 (file)
index 0000000..7673ef4
Binary files /dev/null and b/src/FeaturesPlugin/doc/images/Split_panel.png differ
index 61970dcd596df7e8c9e09443c7426ee6cdd67e27..d31bee857268e2334b31dacd185c88deb8d5d84e 100644 (file)
@@ -15,7 +15,7 @@ To perform Split in the active part:
 
 The following property panel will be opened:
 
-.. figure:: images/Split.png
+.. figure:: images/Split_panel.png
    :align: center
 
    **Split operation**
index 6fb763a0231065add44a49024a3486bd69736ecb..44f7e44ab01fa922d1923a40384c438f3a742e65 100644 (file)
@@ -182,7 +182,9 @@ ObjectPtr Model_AttributeRefList::iteratedObject(TDF_ListIteratorOfLabelList& th
       }
       theExtIter.Next();
     } else { // internal document object
-      anObj = theDoc->objects()->object(theLIter.Value());
+      TDF_Label aLab = theLIter.Value();
+      if (!aLab.IsNull())
+        anObj = theDoc->objects()->object(theLIter.Value());
     }
   }
   return anObj;
index 6046533abec17ecd956ea1e49f5269207f891782..03d5a423b26afd5d08b3d1132dfd454f10ab18cd 100644 (file)
@@ -317,6 +317,8 @@ bool Model_Document::load(const char* theDirName, const char* theFileName, Docum
   std::shared_ptr<Model_Session> aSession =
     std::dynamic_pointer_cast<Model_Session>(Model_Session::get());
   if (isOk) {
+    // keep handle to avoid destruction of the document until myObjs works on it
+    Handle(TDocStd_Document) anOldDoc = myDoc;
     myDoc = aLoaded;
     myDoc->SetUndoLimit(UNDO_LIMIT);
 
@@ -325,6 +327,7 @@ bool Model_Document::load(const char* theDirName, const char* theFileName, Docum
     aSession->setCheckTransactions(false);
     if (myObjs)
       delete myObjs;
+    anOldDoc.Nullify();
     myObjs = new Model_Objects(myDoc->Main()); // synchronization is inside
     myObjs->setOwner(theThis);
     // update the current features status
@@ -2309,6 +2312,8 @@ void Model_Document::appendTransactionToPrevious()
 {
   Transaction anAppended =  myTransactions.back();
   myTransactions.pop_back();
+  if (!myNestedNum.empty())
+    (*myNestedNum.rbegin())--;
   if (!myTransactions.empty()) { // if it is empty, just forget the appended
     myTransactions.back().myOCAFNum += anAppended.myOCAFNum;
   }
index 9127a9915cab6da6e7d1306a10cfc62007505ade..79751881ec6661568eb0fb4fb83bf94b6a12e0ad 100644 (file)
@@ -346,18 +346,6 @@ void Model_Update::processEvent(const std::shared_ptr<Events_Message>& theMessag
       if (anUpdated.get()) {
         if (addModified(anUpdated, FeaturePtr()))
           aSomeModified = true;
-        if (myUpdateBlocked) { // execute this feature anyway to show the current result
-          /*if (!anUpdated->isStable() && anUpdated->results().size() && (
-              anUpdated->firstResult()->groupName() == ModelAPI_ResultBody::group() ||
-              anUpdated->firstResult()->groupName() == ModelAPI_ResultPart::group())) {
-            if (aFactory->validate(anUpdated)) {
-              executeFeature(anUpdated);
-              redisplayWithResults(anUpdated, ModelAPI_StateNothing, false);
-              static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
-              aLoop->flush(EVENT_DISP);
-            }
-          }*/
-        }
       } else {
         // process the updated result as update of features that refers to this result
         const std::set<std::shared_ptr<ModelAPI_Attribute> >&
@@ -735,7 +723,8 @@ bool Model_Update::processFeature(FeaturePtr theFeature)
     if (!isPostponedMain) {
       bool aDoExecute = true;
       if (myUpdateBlocked) {
-        if (!theFeature->isStable()) {
+        if (!theFeature->isStable() || (theFeature->getKind().size() > 6 &&
+            theFeature->getKind().substr(0, 6) == "Sketch")) { // automatic update sketch elements
           aDoExecute = true;
         } else if (theFeature->results().size()) { // execute only not persistent results features
           aDoExecute = !theFeature->isPersistentResult();
index d5b9bf15a782ee514f2f9a709c650e6fd01d5e3b..03fc180a839ae7f93bd90abd6176514eb6ea39f0 100644 (file)
@@ -97,6 +97,7 @@ void XGUI_ContextMenuMgr::createActions()
   aAction->setShortcut(Qt::Key_F2);
   addAction("RENAME_CMD", aAction);
 
+#ifdef HAVE_SALOME
   aAction = ModuleBase_Tools::createAction(QIcon(":pictures/move_to_end.png"),
                                            XGUI_Workshop::MOVE_TO_END_COMMAND, this);
   addAction("MOVE_CMD", aAction);
@@ -104,6 +105,7 @@ void XGUI_ContextMenuMgr::createActions()
   aAction = ModuleBase_Tools::createAction(QIcon(":pictures/move_to_end_split.png"),
     XGUI_Workshop::MOVE_TO_END_SPLIT_COMMAND, this);
   addAction("MOVE_SPLIT_CMD", aAction);
+#endif
 
   aAction = ModuleBase_Tools::createAction(QIcon(":pictures/clean_history.png"),
                                            tr("Clean history"), aDesktop);
@@ -344,10 +346,12 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu()
           if (!(hasParameter || hasFeature))
             action("SHOW_ONLY_CMD")->setEnabled(true);
         }
+#ifdef HAVE_SALOME
         else if (hasFeature && myWorkshop->canMoveFeature()) {
           action("MOVE_CMD")->setEnabled(true);
           action("MOVE_SPLIT_CMD")->setEnabled(true);
         }
+#endif
 
         if( aMgr->activeDocument() == aObject->document() )
         {