From 5da2825f6f7b8a8fc43b12e6150e433d3412b20e Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Wed, 29 Jan 2020 10:07:59 +0100 Subject: [PATCH] REVERT LATER: TEMPORARILY MANGLED reload_scene FUNCTION This commit horribly cripples reload_scene function just to update volumes in scene so that Hollowing and SLASupport gizmos can be updated to the new logic It should be later reverted and the same be achieved in a better way --- src/slic3r/GUI/GLCanvas3D.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 8805dc92c84..32d359429b3 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1930,6 +1930,8 @@ void GLCanvas3D::mirror_selection(Axis axis) // 5) Out of bed collision status & message overlay (texture) void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_refresh) { + force_full_scene_refresh = true; + if ((m_canvas == nullptr) || (m_config == nullptr) || (m_model == nullptr)) return; @@ -2189,9 +2191,28 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re } // Shift-up all volumes of the object so that it has the right elevation with respect to the print bed - for (GLVolume* volume : m_volumes.volumes) + for (GLVolume* volume : m_volumes.volumes) { if (volume->object_idx() < (int)m_model->objects.size() && m_model->objects[volume->object_idx()]->instances[volume->instance_idx()]->is_printable()) volume->set_sla_shift_z(shift_zs[volume->object_idx()]); + + // Just an experiment for now - replace the mesh with a hollowed one. + for (size_t po_idx=0; po_idxobjects().size(); ++po_idx) { + const SLAPrintObject* po = sla_print->objects()[po_idx]; + if (po_idx != volume->composite_id.object_id || volume->composite_id.volume_id < 0) + continue; + if (po->is_step_done(slaposHollowing)) { + TriangleMesh mesh = po->get_mesh(slaposHollowing); + if (mesh.empty()) + continue; + Transform3d t = sla_print->sla_trafo(*m_model->objects[volume->object_idx()]); + mesh.transform(t.inverse()); + GLIndexedVertexArray iva; + iva.load_mesh(mesh); + volume->indexed_vertex_array = iva; + volume->finalize_geometry(true); + } + } + } } if (printer_technology == ptFFF && m_config->has("nozzle_diameter"))