FIX: there is no object can be jumped to in notification
jira: new Change-Id: Ib81bf49236952ede24a2de126051572d63916e01
This commit is contained in:
parent
eaddf2c64b
commit
0dae851dc6
|
@ -9082,13 +9082,13 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state)
|
||||||
break;
|
break;
|
||||||
case SLICING_SERIOUS_WARNING:
|
case SLICING_SERIOUS_WARNING:
|
||||||
if (state)
|
if (state)
|
||||||
notification_manager.push_slicing_serious_warning_notification(text, {conflictObj});
|
notification_manager.push_slicing_serious_warning_notification(text, conflictObj ? std::vector<ModelObject const*>{conflictObj} : std::vector<ModelObject const*>{});
|
||||||
else
|
else
|
||||||
notification_manager.close_slicing_serious_warning_notification(text);
|
notification_manager.close_slicing_serious_warning_notification(text);
|
||||||
break;
|
break;
|
||||||
case SLICING_ERROR:
|
case SLICING_ERROR:
|
||||||
if (state)
|
if (state)
|
||||||
notification_manager.push_slicing_error_notification(text, {conflictObj});
|
notification_manager.push_slicing_error_notification(text, conflictObj ? std::vector<ModelObject const*>{conflictObj} : std::vector<ModelObject const*>{});
|
||||||
else
|
else
|
||||||
notification_manager.close_slicing_error_notification(text);
|
notification_manager.close_slicing_error_notification(text);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1579,7 +1579,10 @@ void NotificationManager::push_validate_error_notification(StringObjectException
|
||||||
{
|
{
|
||||||
auto po = dynamic_cast<PrintObjectBase const *>(error.object);
|
auto po = dynamic_cast<PrintObjectBase const *>(error.object);
|
||||||
auto mo = po ? po->model_object() : dynamic_cast<ModelObject const *>(error.object);
|
auto mo = po ? po->model_object() : dynamic_cast<ModelObject const *>(error.object);
|
||||||
auto callback = (mo || !error.opt_key.empty()) ? [id = mo ? mo->id() : 0, opt = error.opt_key](wxEvtHandler *) {
|
std::function<bool(wxEvtHandler*)> callback;
|
||||||
|
if (mo || !error.opt_key.empty()) {
|
||||||
|
callback =
|
||||||
|
[id = mo ? mo->id() : 0, opt = error.opt_key](wxEvtHandler*) {
|
||||||
auto& objects = wxGetApp().model().objects;
|
auto& objects = wxGetApp().model().objects;
|
||||||
auto iter = id.id ? std::find_if(objects.begin(), objects.end(), [id](auto o) { return o->id() == id; }) : objects.end();
|
auto iter = id.id ? std::find_if(objects.begin(), objects.end(), [id](auto o) { return o->id() == id; }) : objects.end();
|
||||||
if (iter != objects.end())
|
if (iter != objects.end())
|
||||||
|
@ -1588,11 +1591,13 @@ void NotificationManager::push_validate_error_notification(StringObjectException
|
||||||
if (iter != objects.end())
|
if (iter != objects.end())
|
||||||
wxGetApp().params_panel()->switch_to_object();
|
wxGetApp().params_panel()->switch_to_object();
|
||||||
wxGetApp().sidebar().jump_to_option(opt, Preset::TYPE_PRINT, L"");
|
wxGetApp().sidebar().jump_to_option(opt, Preset::TYPE_PRINT, L"");
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
wxGetApp().mainframe->select_tab(MainFrame::tp3DEditor);
|
wxGetApp().mainframe->select_tab(MainFrame::tp3DEditor);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} : std::function<bool(wxEvtHandler *)>();
|
};
|
||||||
|
}
|
||||||
auto link = (mo || !error.opt_key.empty()) ? _u8L("Jump to") : "";
|
auto link = (mo || !error.opt_key.empty()) ? _u8L("Jump to") : "";
|
||||||
if (mo) link += std::string(" [") + mo->name + "]";
|
if (mo) link += std::string(" [") + mo->name + "]";
|
||||||
if (!error.opt_key.empty()) link += std::string(" (") + error.opt_key + ")";
|
if (!error.opt_key.empty()) link += std::string(" (") + error.opt_key + ")";
|
||||||
|
@ -1607,7 +1612,9 @@ void NotificationManager::push_slicing_error_notification(const std::string &tex
|
||||||
if (optr)
|
if (optr)
|
||||||
ids.push_back(optr->id());
|
ids.push_back(optr->id());
|
||||||
}
|
}
|
||||||
auto callback = !objs.empty() ? [ids](wxEvtHandler *) {
|
std::function<bool(wxEvtHandler*)> callback;
|
||||||
|
if (!objs.empty()) {
|
||||||
|
callback = [ids](wxEvtHandler*) {
|
||||||
auto& objects = wxGetApp().model().objects;
|
auto& objects = wxGetApp().model().objects;
|
||||||
std::vector<ObjectVolumeID> ovs;
|
std::vector<ObjectVolumeID> ovs;
|
||||||
for (auto id : ids) {
|
for (auto id : ids) {
|
||||||
|
@ -1619,7 +1626,8 @@ void NotificationManager::push_slicing_error_notification(const std::string &tex
|
||||||
wxGetApp().obj_list()->select_items(ovs);
|
wxGetApp().obj_list()->select_items(ovs);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} : std::function<bool(wxEvtHandler *)>();
|
};
|
||||||
|
}
|
||||||
auto link = callback ? _u8L("Jump to") : "";
|
auto link = callback ? _u8L("Jump to") : "";
|
||||||
if (!objs.empty()) {
|
if (!objs.empty()) {
|
||||||
link += " [";
|
link += " [";
|
||||||
|
@ -1639,7 +1647,9 @@ void NotificationManager::push_slicing_error_notification(const std::string &tex
|
||||||
}
|
}
|
||||||
void NotificationManager::push_slicing_warning_notification(const std::string& text, bool gray, ModelObject const * obj, ObjectID oid, int warning_step, int warning_msg_id, NotificationLevel level/* = NotificationLevel::WarningNotificationLevel*/)
|
void NotificationManager::push_slicing_warning_notification(const std::string& text, bool gray, ModelObject const * obj, ObjectID oid, int warning_step, int warning_msg_id, NotificationLevel level/* = NotificationLevel::WarningNotificationLevel*/)
|
||||||
{
|
{
|
||||||
auto callback = obj ? [id = obj->id()](wxEvtHandler *) {
|
std::function<bool(wxEvtHandler*)> callback;
|
||||||
|
if (obj) {
|
||||||
|
callback = [id = obj->id()](wxEvtHandler*) {
|
||||||
auto& objects = wxGetApp().model().objects;
|
auto& objects = wxGetApp().model().objects;
|
||||||
auto iter = std::find_if(objects.begin(), objects.end(), [id](auto o) { return o->id() == id; });
|
auto iter = std::find_if(objects.begin(), objects.end(), [id](auto o) { return o->id() == id; });
|
||||||
if (iter != objects.end()) {
|
if (iter != objects.end()) {
|
||||||
|
@ -1647,7 +1657,8 @@ void NotificationManager::push_slicing_warning_notification(const std::string& t
|
||||||
wxGetApp().obj_list()->select_items({ {*iter, nullptr} });
|
wxGetApp().obj_list()->select_items({ {*iter, nullptr} });
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} : std::function<bool(wxEvtHandler *)>();
|
};
|
||||||
|
}
|
||||||
auto link = callback ? _u8L("Jump to") : "";
|
auto link = callback ? _u8L("Jump to") : "";
|
||||||
if (obj) link += std::string(" [") + obj->name + "]";
|
if (obj) link += std::string(" [") + obj->name + "]";
|
||||||
NotificationData data { NotificationType::SlicingWarning, level, 0, _u8L("Warning:") + "\n" + text, link, callback };
|
NotificationData data { NotificationType::SlicingWarning, level, 0, _u8L("Warning:") + "\n" + text, link, callback };
|
||||||
|
@ -1873,8 +1884,9 @@ void NotificationManager::push_slicing_serious_warning_notification(const std::s
|
||||||
for (auto optr : objs) {
|
for (auto optr : objs) {
|
||||||
if (optr) ids.push_back(optr->id());
|
if (optr) ids.push_back(optr->id());
|
||||||
}
|
}
|
||||||
auto callback = !objs.empty() ?
|
std::function<bool(wxEvtHandler*)> callback;
|
||||||
[ids](wxEvtHandler *) {
|
if (!objs.empty()) {
|
||||||
|
callback = [ids](wxEvtHandler*) {
|
||||||
auto& objects = wxGetApp().model().objects;
|
auto& objects = wxGetApp().model().objects;
|
||||||
std::vector<ObjectVolumeID> ovs;
|
std::vector<ObjectVolumeID> ovs;
|
||||||
for (auto id : ids) {
|
for (auto id : ids) {
|
||||||
|
@ -1886,8 +1898,8 @@ void NotificationManager::push_slicing_serious_warning_notification(const std::s
|
||||||
wxGetApp().obj_list()->select_items(ovs);
|
wxGetApp().obj_list()->select_items(ovs);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} :
|
};
|
||||||
std::function<bool(wxEvtHandler *)>();
|
}
|
||||||
auto link = callback ? _u8L("Jump to") : "";
|
auto link = callback ? _u8L("Jump to") : "";
|
||||||
if (!objs.empty()) {
|
if (!objs.empty()) {
|
||||||
link += " [";
|
link += " [";
|
||||||
|
|
Loading…
Reference in New Issue