ENH: render mesh_errors notification in red

Change-Id: Ie13524dc27436b9e1c075e5e9e0363cfa1504147
This commit is contained in:
tao.jin 2022-12-16 18:28:55 +08:00 committed by Lane.Wei
parent 88ecb2aa2e
commit c75ca06f01
3 changed files with 30 additions and 3 deletions

View File

@ -357,6 +357,19 @@ void NotificationManager::PopNotification::count_lines()
if (text.empty())
return;
// handle with marks
if (pos_start == string::npos && pos_end == string::npos) {
pos_start = text.find(error_start);
if (pos_start != string::npos) {
text.erase(pos_start, error_start.length());
pos_end = text.find(error_end);
if (pos_end != string::npos) {
text.erase(pos_end, error_end.length());
}
}
m_text1 = text;
}
m_endlines.clear();
while (last_end < text.length() - 1)
{
@ -481,7 +494,14 @@ void NotificationManager::PopNotification::render_text(ImGuiWrapper& imgui, cons
if (m_text1.size() > m_endlines[i])
last_end += (m_text1[m_endlines[i]] == '\n' || m_text1[m_endlines[i]] == ' ' ? 1 : 0);
if (pos_start != string::npos && pos_end != string::npos&& m_endlines[i] - line.length() >= pos_start && m_endlines[i] <= pos_end) {
push_style_color(ImGuiCol_Text, m_ErrorColor, m_state == EState::FadingOut, m_current_fade_opacity);
imgui.text(line.c_str());
ImGui::PopStyleColor();
}
else {
imgui.text(line.c_str());
}
}
}
//hyperlink text

View File

@ -488,6 +488,11 @@ private:
std::string m_hypertext;
// Aditional text after hypertext - currently not used
std::string m_text2;
// mark for render operation
size_t pos_start = string::npos;
size_t pos_end = string::npos;
std::string error_start = "<Error>";
std::string error_end = "</Error>";
// inner variables to position notification window, texts and buttons correctly

View File

@ -11109,13 +11109,15 @@ void Plater::show_object_info()
wxString info_manifold;
int non_manifold_edges = 0;
auto mesh_errors = p->sidebar->obj_list()->get_mesh_errors_info(&info_manifold, &non_manifold_edges);
info_text += into_u8(info_manifold);
#ifndef __WINDOWS__
if (non_manifold_edges > 0) {
info_text += 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 repair the model on Bambu Studio(windows) or CAD softwares."));
}
#endif //APPLE & LINUX
info_manifold = "<Error>" + info_manifold + "</Error>";
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));
}