ENH: add a repair model url for Mac bbs

jira: new

Change-Id: I6230588700d01e5b9599cb408713e63bf01a144a
(cherry picked from commit d67a977969bb5731de8c0f7fb47d60211183e243)
This commit is contained in:
liz.li 2024-08-28 15:27:24 +08:00 committed by Lane.Wei
parent 6edf07e2a1
commit 253b47edc6
3 changed files with 25 additions and 15 deletions

View File

@ -2512,19 +2512,9 @@ void NotificationManager::bbl_close_preview_only_notification()
} }
} }
void NotificationManager::bbl_show_objectsinfo_notification(const std::string &text, bool is_warning, bool is_hidden) void NotificationManager::bbl_show_objectsinfo_notification(const std::string &text, bool is_warning, bool is_hidden, const std::string hypertext, std::function<bool(wxEvtHandler*)> callback)
{ {
std::string hyper_text; NotificationData data{NotificationType::BBLObjectInfo, NotificationLevel::PrintInfoNotificationLevel, BBL_NOTICE_MAX_INTERVAL, text, hypertext, callback};
auto callback = std::function<bool(wxEvtHandler *)>();
if (is_warning) {
callback =[](wxEvtHandler *) {
wxCommandEvent *evt = new wxCommandEvent(EVT_REPAIR_MODEL);
wxQueueEvent(wxGetApp().plater(), evt);
return false;
};
hyper_text = _u8L(" (Repair)");
}
NotificationData data{NotificationType::BBLObjectInfo, NotificationLevel::PrintInfoNotificationLevel, BBL_NOTICE_MAX_INTERVAL, text, hyper_text, callback};
if (is_warning) if (is_warning)
data.use_warn_color = true; data.use_warn_color = true;

View File

@ -309,7 +309,8 @@ public:
void bbl_close_plugin_install_notification(); void bbl_close_plugin_install_notification();
//BBS--Objects Info //BBS--Objects Info
void bbl_show_objectsinfo_notification(const std::string &text, bool is_warning, bool is_hidden); void bbl_show_objectsinfo_notification(const std::string &text, bool is_warning, bool is_hidden,
const std::string hypertext = "", std::function<bool(wxEvtHandler*)> callback = std::function<bool(wxEvtHandler*)>());
void bbl_close_objectsinfo_notification(); void bbl_close_objectsinfo_notification();
void bbl_show_seqprintinfo_notification(const std::string &text); void bbl_show_seqprintinfo_notification(const std::string &text);

View File

@ -13629,16 +13629,35 @@ void Plater::show_object_info()
wxString info_manifold; wxString info_manifold;
int non_manifold_edges = 0; int non_manifold_edges = 0;
auto mesh_errors = p->sidebar->obj_list()->get_mesh_errors_info(&info_manifold, &non_manifold_edges); auto mesh_errors = p->sidebar->obj_list()->get_mesh_errors_info(&info_manifold, &non_manifold_edges);
bool warning = non_manifold_edges > 0;
wxString hyper_text;
std::function<bool(wxEvtHandler*)> callback;
if (warning) {
hyper_text = _L(" (Repair)");
callback = [](wxEvtHandler*) {
wxCommandEvent* evt = new wxCommandEvent(EVT_REPAIR_MODEL);
wxQueueEvent(wxGetApp().plater(), evt);
return false;
};
}
#ifndef __WINDOWS__ #ifndef __WINDOWS__
if (non_manifold_edges > 0) { if (non_manifold_edges > 0) {
info_manifold += into_u8("\n" + _L("Tips:") + "\n" +_L("\"Fix Model\" feature is currently only on Windows. Please repair the model on Bambu Studio(windows) or CAD softwares.")); info_manifold += into_u8("\n" + _L("Tips:") + "\n" +_L("\"Fix Model\" feature is currently only on Windows. Please use a third-party tool to repair the model before importing it into Bambu Studio, such as "));
}
if (warning) {
std::string repair_url = "https://www.formware.co/onlinestlrepair";
hyper_text = repair_url + ".";
callback = [repair_url](wxEvtHandler*) {
wxGetApp().open_browser_with_warning_dialog(repair_url);
return false;
};
} }
#endif //APPLE & LINUX #endif //APPLE & LINUX
info_manifold = "<Error>" + info_manifold + "</Error>"; info_manifold = "<Error>" + info_manifold + "</Error>";
info_text += into_u8(info_manifold); info_text += into_u8(info_manifold);
notify_manager->bbl_show_objectsinfo_notification(info_text, is_windows10()&&(non_manifold_edges > 0), !(p->current_panel == p->view3D)); notify_manager->bbl_show_objectsinfo_notification(info_text, warning, !(p->current_panel == p->view3D), into_u8(hyper_text), callback);
} }
bool Plater::show_publish_dialog(bool show) bool Plater::show_publish_dialog(bool show)