- if (aType == EVENT_FEATURE_UPDATED ||
- aType == EVENT_FEATURE_CREATED)
- {
- const Model_FeatureUpdatedMessage* aUpdMsg = dynamic_cast<const Model_FeatureUpdatedMessage*>(theMessage);
- boost::shared_ptr<ModelAPI_Feature> aFeature = aUpdMsg->feature();
- if (myModule->workshop()->displayer()->IsVisible(aFeature) ||
- aType == EVENT_FEATURE_CREATED) {
- myModule->visualizePreview(aFeature, true, false);
- myModule->activateFeature(aFeature, true);
- myModule->workshop()->displayer()->UpdateViewer();
+ if (aType == EVENT_OBJECT_CREATED) {
+ boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
+ boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
+ std::set<ObjectPtr> aFeatures = aUpdMsg->objects();
+
+ PartSet_OperationSketch* aSketchOp =
+ dynamic_cast<PartSet_OperationSketch*>(myModule->workshop()->operationMgr()->currentOperation());
+
+ std::set<ObjectPtr>::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
+ for (; anIt != aLast; anIt++) {
+ ObjectPtr aObj = (*anIt);
+ aDisplayer->deactivate(aObj);
+ boost::shared_ptr<ModelAPI_Feature> aFeature =
+ boost::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
+ if (aFeature && (aFeature->getKind() == "Sketch")) // Activate sketcher for planes selection
+ myModule->activateFeature(aFeature, false);
+ // If current operation is Sketch then there is no active sketching operation
+ // and possible the object was created by Redo operatgion
+ else if (aSketchOp) {
+ XGUI_Displayer* aDisplayer = myModule->workshop()->displayer();
+ // Very possible it is not displayed
+ aDisplayer->display(aObj, false);
+ std::list<int> aModes = aSketchOp->getSelectionModes(aObj);
+ aDisplayer->activateInLocalContext(aObj, aModes, false);
+ }