]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #971: Update OB on duplicate part: send event on creation of a new document...
authorvsv <vitaly.smetannikov@opencascade.com>
Thu, 12 Nov 2015 10:48:17 +0000 (13:48 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Thu, 12 Nov 2015 10:48:29 +0000 (13:48 +0300)
src/Model/Model_Objects.cpp

index 0d1021820f9583d3c53bba163ee6ea46e52ea953..87848db8410b9d1cf6944865403f915a564819ad 100644 (file)
@@ -137,13 +137,15 @@ void Model_Objects::addFeature(FeaturePtr theFeature, const FeaturePtr theAfterT
     // keep the feature ID to restore document later correctly
     TDataStd_Comment::Set(aFeatureLab, theFeature->getKind().c_str());
     myFeatures.Bind(aFeatureLab, theFeature);
+    // must be before the event sending: for OB the feature is already added
+    updateHistory(ModelAPI_Feature::group());
+    // event: feature is added, mist be before "initData" to update OB correctly on Duplicate:
+    // first new part, then the content
+    static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED);
+    ModelAPI_EventCreator::get()->sendUpdated(theFeature, anEvent);
     // must be after binding to the map because of "Box" macro feature that 
     // creates other features in "initData"
     initData(theFeature, aFeatureLab, TAG_FEATURE_ARGUMENTS);
-    // event: feature is added
-    static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED);
-    ModelAPI_EventCreator::get()->sendUpdated(theFeature, anEvent);
-    updateHistory(ModelAPI_Feature::group());
   } else { // make feature has not-null data anyway
     theFeature->setData(Model_Data::invalidData());
     theFeature->setDoc(myDoc);