DocumentPtr aDoc = aMessage->document();
std::list<FeaturePtr> aFeatures;
+ // the viewer update should be blocked in order to avoid the features blinking before they are
+ // hidden
+ std::shared_ptr<Events_Message> aMsg = std::shared_ptr<Events_Message>(
+ new Events_Message(Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED)));
+ Events_Loop::loop()->send(aMsg);
+
aFeatures.push_back(createPoint(aDoc));
aFeatures.push_back(createPlane(aDoc, 1., 0., 0.));
aFeatures.push_back(createPlane(aDoc, 0., 1., 0.));
}
Events_Loop::loop()->flush(HIDE_DISP);
+ // the viewer update should be unblocked in order to avoid the features blinking before they are
+ // hidden
+ aMsg = std::shared_ptr<Events_Message>(
+ new Events_Message(Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED)));
+
+ Events_Loop::loop()->send(aMsg);
+
} else if (theMessage.get()) {
Events_Error::send(
std::string("InitializationPlugin_Plugin::processEvent: unhandled message caught: ")
static const char * EVENT_FEATURE_STATE_REQUEST = "FeatureStateRequest";
static const char * EVENT_FEATURE_STATE_RESPONSE = "FeatureStateResponse";
+
+static const char * EVENT_UPDATE_VIEWER_BLOCKED = "UpdateViewerBlocked";
+static const char * EVENT_UPDATE_VIEWER_UNBLOCKED = "UpdateViewerUnblocked";
+
/// Message that feature was changed (used for Object Browser update): moved, updated and deleted
class MODELAPI_EXPORT ModelAPI_ObjectUpdatedMessage : public Events_MessageGroup
{
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TOHIDE));
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_SELFILTER_LOADED));
+ aLoop->registerListener(this, Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED));
+ aLoop->registerListener(this, Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED));
+
registerValidators();
// Calling of loadCustomProps before activating module is required
aMsg->parameters());
}
}
+ } else if (theMessage->eventID() == Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED)) {
+ // the viewer's update context will not happens until viewer updated is emitted
+ myDisplayer->enableUpdateViewer(false);
+ } else if (theMessage->eventID() == Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED)) {
+ // the viewer's update context is unblocked, the viewer's update works
+ myDisplayer->enableUpdateViewer(true);
} else {
//Show error dialog if error message received.
std::shared_ptr<Events_Error> anAppError = std::dynamic_pointer_cast<Events_Error>(theMessage);