From 5b1766b1d59e93e532c70dad901239191c8a664b Mon Sep 17 00:00:00 2001 From: Noisyfox Date: Mon, 11 May 2026 17:16:36 +0800 Subject: [PATCH] Remap paint after smooth --- src/slic3r/GUI/GUI_ObjectList.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 93e5c94432..3cee3d2058 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -6210,6 +6210,7 @@ void GUI::ObjectList::smooth_mesh() WarningDialog dlg(static_cast(wxGetApp().mainframe), content, wxEmptyString, wxOK); dlg.ShowModal(); }; + const bool keep_painting = GUI::wxGetApp().app_config->get_bool("keep_painting"); bool has_show_smooth_mesh_error_dlg = false; if (vol_idxs.empty()) { obj = object(object_idx); @@ -6221,8 +6222,11 @@ void GUI::ObjectList::smooth_mesh() bool ok; auto result_mesh = TriangleMeshDeal::smooth_triangle_mesh(mv->mesh(), ok); if (ok) { + const std::optional saved_painting = keep_painting ? + mv->save_painting() : + std::optional{}; mv->set_mesh(result_mesh); - mv->reset_extra_facets(); // reset paint color + mv->restore_painting(saved_painting); mv->calculate_convex_hull(); mv->invalidate_convex_hull_2d(); mv->set_new_unique_id(); @@ -6247,8 +6251,11 @@ void GUI::ObjectList::smooth_mesh() bool ok; auto result_mesh = TriangleMeshDeal::smooth_triangle_mesh(mv->mesh(),ok); if (ok) { + const std::optional saved_painting = keep_painting ? + mv->save_painting() : + std::optional{}; mv->set_mesh(result_mesh); - mv->reset_extra_facets(); // reset paint color + mv->restore_painting(saved_painting); mv->calculate_convex_hull(); mv->invalidate_convex_hull_2d(); mv->set_new_unique_id();