Remap paint after smooth

This commit is contained in:
Noisyfox
2026-05-11 17:16:36 +08:00
parent b4b2982106
commit 5b1766b1d5

View File

@@ -6210,6 +6210,7 @@ void GUI::ObjectList::smooth_mesh()
WarningDialog dlg(static_cast<wxWindow *>(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<TriangleSelector::SavedPainting> saved_painting = keep_painting ?
mv->save_painting() :
std::optional<TriangleSelector::SavedPainting>{};
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<TriangleSelector::SavedPainting> saved_painting = keep_painting ?
mv->save_painting() :
std::optional<TriangleSelector::SavedPainting>{};
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();