From e585fd22218f4679d4ba86fbfbb0b63504854d58 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Thu, 23 Mar 2023 10:16:13 +0100 Subject: [PATCH] Fixed duplication of auxiliary volumes when GLCanvas3D::reload_scene() is called for SLA printers --- src/slic3r/GUI/3DScene.cpp | 32 ++++++++++++++++++-------------- src/slic3r/GUI/GLCanvas3D.cpp | 2 +- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/slic3r/GUI/3DScene.cpp b/src/slic3r/GUI/3DScene.cpp index 843aa6a337..f8b41da8a3 100644 --- a/src/slic3r/GUI/3DScene.cpp +++ b/src/slic3r/GUI/3DScene.cpp @@ -603,24 +603,28 @@ void GLVolumeCollection::load_object_auxiliary( }; // Get the support mesh. - TriangleMesh supports_mesh = print_object->support_mesh(); - if (!supports_mesh.empty()) { - supports_mesh.transform(mesh_trafo_inv); - TriangleMesh convex_hull = supports_mesh.convex_hull_3d(); - for (const std::pair& instance_idx : instances) { - const ModelInstance& model_instance = *print_object->model_object()->instances[instance_idx.first]; - add_volume(obj_idx, (int)instance_idx.first, model_instance, slaposSupportTree, supports_mesh, GLVolume::SLA_SUPPORT_COLOR, convex_hull); + if (milestone == SLAPrintObjectStep::slaposSupportTree) { + TriangleMesh supports_mesh = print_object->support_mesh(); + if (!supports_mesh.empty()) { + supports_mesh.transform(mesh_trafo_inv); + TriangleMesh convex_hull = supports_mesh.convex_hull_3d(); + for (const std::pair& instance_idx : instances) { + const ModelInstance& model_instance = *print_object->model_object()->instances[instance_idx.first]; + add_volume(obj_idx, (int)instance_idx.first, model_instance, slaposSupportTree, supports_mesh, GLVolume::SLA_SUPPORT_COLOR, convex_hull); + } } } // Get the pad mesh. - TriangleMesh pad_mesh = print_object->pad_mesh(); - if (!pad_mesh.empty()) { - pad_mesh.transform(mesh_trafo_inv); - TriangleMesh convex_hull = pad_mesh.convex_hull_3d(); - for (const std::pair& instance_idx : instances) { - const ModelInstance& model_instance = *print_object->model_object()->instances[instance_idx.first]; - add_volume(obj_idx, (int)instance_idx.first, model_instance, slaposPad, pad_mesh, GLVolume::SLA_PAD_COLOR, convex_hull); + if (milestone == SLAPrintObjectStep::slaposPad) { + TriangleMesh pad_mesh = print_object->pad_mesh(); + if (!pad_mesh.empty()) { + pad_mesh.transform(mesh_trafo_inv); + TriangleMesh convex_hull = pad_mesh.convex_hull_3d(); + for (const std::pair& instance_idx : instances) { + const ModelInstance& model_instance = *print_object->model_object()->instances[instance_idx.first]; + add_volume(obj_idx, (int)instance_idx.first, model_instance, slaposPad, pad_mesh, GLVolume::SLA_PAD_COLOR, convex_hull); + } } } } diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index e6b23c4b8f..ad1c8fe03b 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -2162,7 +2162,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re } update_volumes_colors_by_extruder(); - // Update selection indices based on the old/new GLVolumeCollection. + // Update selection indices based on the old/new GLVolumeCollection. if (m_selection.get_mode() == Selection::Instance) m_selection.instances_changed(instance_ids_selected); else