mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-19 19:33:47 +00:00
Remap paint after smooth
This commit is contained in:
@@ -6210,6 +6210,7 @@ void GUI::ObjectList::smooth_mesh()
|
|||||||
WarningDialog dlg(static_cast<wxWindow *>(wxGetApp().mainframe), content, wxEmptyString, wxOK);
|
WarningDialog dlg(static_cast<wxWindow *>(wxGetApp().mainframe), content, wxEmptyString, wxOK);
|
||||||
dlg.ShowModal();
|
dlg.ShowModal();
|
||||||
};
|
};
|
||||||
|
const bool keep_painting = GUI::wxGetApp().app_config->get_bool("keep_painting");
|
||||||
bool has_show_smooth_mesh_error_dlg = false;
|
bool has_show_smooth_mesh_error_dlg = false;
|
||||||
if (vol_idxs.empty()) {
|
if (vol_idxs.empty()) {
|
||||||
obj = object(object_idx);
|
obj = object(object_idx);
|
||||||
@@ -6221,8 +6222,11 @@ void GUI::ObjectList::smooth_mesh()
|
|||||||
bool ok;
|
bool ok;
|
||||||
auto result_mesh = TriangleMeshDeal::smooth_triangle_mesh(mv->mesh(), ok);
|
auto result_mesh = TriangleMeshDeal::smooth_triangle_mesh(mv->mesh(), ok);
|
||||||
if (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->set_mesh(result_mesh);
|
||||||
mv->reset_extra_facets(); // reset paint color
|
mv->restore_painting(saved_painting);
|
||||||
mv->calculate_convex_hull();
|
mv->calculate_convex_hull();
|
||||||
mv->invalidate_convex_hull_2d();
|
mv->invalidate_convex_hull_2d();
|
||||||
mv->set_new_unique_id();
|
mv->set_new_unique_id();
|
||||||
@@ -6247,8 +6251,11 @@ void GUI::ObjectList::smooth_mesh()
|
|||||||
bool ok;
|
bool ok;
|
||||||
auto result_mesh = TriangleMeshDeal::smooth_triangle_mesh(mv->mesh(),ok);
|
auto result_mesh = TriangleMeshDeal::smooth_triangle_mesh(mv->mesh(),ok);
|
||||||
if (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->set_mesh(result_mesh);
|
||||||
mv->reset_extra_facets(); // reset paint color
|
mv->restore_painting(saved_painting);
|
||||||
mv->calculate_convex_hull();
|
mv->calculate_convex_hull();
|
||||||
mv->invalidate_convex_hull_2d();
|
mv->invalidate_convex_hull_2d();
|
||||||
mv->set_new_unique_id();
|
mv->set_new_unique_id();
|
||||||
|
|||||||
Reference in New Issue
Block a user