From d85a8762509791a7078d9ce45c531e8e1d4e99e7 Mon Sep 17 00:00:00 2001 From: ExPikaPaka Date: Wed, 23 Sep 2026 13:22:57 +0200 Subject: [PATCH] Wrap the budget warning, count triangles in thousands Unwrapped, it ran past the edge of the panel and pulled the layout with it. Counts under a million now read in thousands, so a 119 k budget is no longer shown as 0.1 M. --- .../GUI/Gizmos/GLGizmoTextureDisplacement.cpp | 28 +++++++++++++------ .../GUI/Jobs/TextureDisplacementBakeJob.cpp | 12 +++++--- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoTextureDisplacement.cpp b/src/slic3r/GUI/Gizmos/GLGizmoTextureDisplacement.cpp index 6459fc9fd7..f24a3125e7 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoTextureDisplacement.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoTextureDisplacement.cpp @@ -5974,8 +5974,11 @@ void GLGizmoTextureDisplacement::on_render_input_window(float x, float y, float "still push out - one image both embosses and engraves.\n\n" "What cuts in has to fit: inside a sharp corner or through a thin wall, a deep " "cut can pass through the other side.")); - if (layer.midlevel > 0.f && layer.depth_mm > 1.f) + if (layer.midlevel > 0.f && layer.depth_mm > 1.f) { + ImGui::PushTextWrapPos(content_rx - card_pad); m_imgui->warning_text(_L("Deep inward displacement may self-intersect.")); + ImGui::PopTextWrapPos(); + } m_preview_params_dirty |= float_row("##smoothing", _L("Smoothing"), &layer.smoothing, 0.f, 1.f, "%.2f", false, card_pad); hover_tip(_u8L("Blurs the image before it is used, which rounds off hard steps and removes " @@ -6823,11 +6826,18 @@ void GLGizmoTextureDisplacement::on_render_input_window(float x, float y, float // a third high at coarse resolutions, where the mesh's own triangles are already near the // target, and a warning about a bake that would have fitted is worse than none. if (budget > 0 && needed > budget * 5 / 4) { - const auto to_m = [](size_t n) { return double(n) / 1000000.; }; - m_imgui->warning_text(Slic3r::format(_u8L("This resolution needs about %1$.1f M triangles, " - "budget %2$.1f M - the bake will simplify back to " - "the budget and lose detail."), - to_m(needed), to_m(budget))); + // Thousands under a million: a 119 k budget shown as "0.1 M" says nothing. + const auto count = [](size_t n) { + return n >= 1000000 ? Slic3r::format("%1$.1f M", double(n) / 1000000.) : + Slic3r::format("%1% k", (n + 500) / 1000); + }; + // Wrapped to the panel, like the note under the buttons: unwrapped text runs past the + // panel's edge and takes the window's width with it. + ImGui::PushTextWrapPos(x0 + panel_w); + m_imgui->warning_text(Slic3r::format(_u8L("Needs about %1% triangles, budget %2% - the bake " + "will simplify back down and lose detail."), + count(needed), count(budget))); + ImGui::PopTextWrapPos(); } } else { m_imgui->text(_L("Triangles")); @@ -6898,8 +6908,10 @@ void GLGizmoTextureDisplacement::on_render_input_window(float x, float y, float // What Bake will produce, and which layers it will skip. if (mv != nullptr) { - std::string note = v2 ? Slic3r::format(_u8L("Model: %1% k triangles - the bake refines to the resolution above, up to its budget"), base_k) : - pro_mode() ? Slic3r::format(_u8L("Bake moves existing vertices - the model stays at %1% k triangles"), base_k) : + const std::string base_count = base_k > 0 ? Slic3r::format(_u8L("%1% k"), base_k) : + std::to_string(mv->mesh().facets_count()); + std::string note = v2 ? Slic3r::format(_u8L("Model: %1% triangles - the bake refines to the resolution above, up to its budget"), base_count) : + pro_mode() ? Slic3r::format(_u8L("Bake moves existing vertices - the model stays at %1% triangles"), base_count) : Slic3r::format(_u8L("Bake result up to ~%1% k triangles"), base_k + m_subdivide_budget_k); if (mv->is_texture_displacement_painted()) { std::vector skipped; diff --git a/src/slic3r/GUI/Jobs/TextureDisplacementBakeJob.cpp b/src/slic3r/GUI/Jobs/TextureDisplacementBakeJob.cpp index 0fb9cefefc..077b11cbc5 100644 --- a/src/slic3r/GUI/Jobs/TextureDisplacementBakeJob.cpp +++ b/src/slic3r/GUI/Jobs/TextureDisplacementBakeJob.cpp @@ -177,12 +177,16 @@ void TextureDisplacementBakeJob::finalize(bool canceled, std::exception_ptr &ept // here, with the numbers, because it is the only place that knows them - and not as an error // dialog: the result is a usable mesh, just not the one the settings described. if (m_stats.budget_limited) { - const auto millions = [](size_t n) { return double(n) / 1000000.; }; + // Thousands under a million, so a small budget is not reported as "0.1 M". + const auto count = [](size_t n) { + return n >= 1000000 ? Slic3r::format("%1$.1f M", double(n) / 1000000.) : + Slic3r::format("%1% k", (n + 500) / 1000); + }; wxGetApp().notification_manager()->push_notification( NotificationType::CustomNotification, NotificationManager::NotificationLevel::WarningNotificationLevel, - Slic3r::format(_u8L("The triangle budget limited the detail: this resolution needs %1$.1f M triangles, " - "the budget kept %2$.1f M. Raise Budget or use a coarser Resolution for the full detail."), - millions(m_stats.triangles_refined), millions(m_stats.triangles_out))); + Slic3r::format(_u8L("The triangle budget limited the detail: this resolution needs %1% triangles, " + "the budget kept %2%. Raise Budget or use a coarser Resolution for the full detail."), + count(m_stats.triangles_refined), count(m_stats.triangles_out))); } }