From fb6ef1d20fdfaecef3f3b4792386acd6a31f58b5 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Thu, 31 Jan 2019 14:25:11 +0100 Subject: [PATCH] Keeps modifier transparent while layer editing tool is enabled --- src/slic3r/GUI/3DScene.cpp | 4 ++++ src/slic3r/GUI/3DScene.hpp | 2 ++ src/slic3r/GUI/GLCanvas3D.cpp | 7 +++++++ 3 files changed, 13 insertions(+) diff --git a/src/slic3r/GUI/3DScene.cpp b/src/slic3r/GUI/3DScene.cpp index fd1645c9e..6b1df6ab3 100644 --- a/src/slic3r/GUI/3DScene.cpp +++ b/src/slic3r/GUI/3DScene.cpp @@ -252,6 +252,7 @@ GLVolume::GLVolume(float r, float g, float b, float a) , is_modifier(false) , is_wipe_tower(false) , is_extrusion_path(false) + , force_transparent(false) , tverts_range(0, size_t(-1)) , qverts_range(0, size_t(-1)) { @@ -293,6 +294,9 @@ void GLVolume::set_render_color() set_render_color(OUTSIDE_COLOR, 4); else set_render_color(color, 4); + + if (force_transparent) + render_color[3] = color[3]; } void GLVolume::set_color_from_model_volume(const ModelVolume *model_volume) diff --git a/src/slic3r/GUI/3DScene.hpp b/src/slic3r/GUI/3DScene.hpp index 7430ff4aa..2732b5a13 100644 --- a/src/slic3r/GUI/3DScene.hpp +++ b/src/slic3r/GUI/3DScene.hpp @@ -295,6 +295,8 @@ public: bool is_wipe_tower; // Wheter or not this volume has been generated from an extrusion path bool is_extrusion_path; + // Wheter or not to always render this volume using its own alpha + bool force_transparent; // Interleaved triangles & normals with indexed triangles & quads. GLIndexedVertexArray indexed_vertex_array; diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 72dfe52bd..33f62f205 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -4286,6 +4286,13 @@ bool GLCanvas3D::is_reload_delayed() const void GLCanvas3D::enable_layers_editing(bool enable) { m_layers_editing.set_enabled(enable); + const Selection::IndicesList& idxs = m_selection.get_volume_idxs(); + for (unsigned int idx : idxs) + { + GLVolume* v = m_volumes.volumes[idx]; + if (v->is_modifier) + v->force_transparent = enable; + } } void GLCanvas3D::enable_warning_texture(bool enable)