From f56cffe546d82ec045f998222db94078feb86112 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Wed, 5 Apr 2023 10:57:02 +0200 Subject: [PATCH] Follow-up of 439e9bc7e79abd473f04886045cf325c36c4ece5 - Added a button into Preview legend to quickly switch between showing/hiding custom gcode toolpaths for visualization which use different color ranges for the two cases --- src/slic3r/GUI/GCodeViewer.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index 7dd1db935..36ac85df9 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -3945,6 +3945,20 @@ void GCodeViewer::render_legend(float& legend_height) } } + if (m_view_type == EViewType::Width || m_view_type == EViewType::VolumetricRate) { + const auto custom_it = std::find(m_roles.begin(), m_roles.end(), GCodeExtrusionRole::Custom); + if (custom_it != m_roles.end()) { + const bool custom_visible = is_visible(GCodeExtrusionRole::Custom); + const wxString btn_text = custom_visible ? _u8L("Hide Custom GCode") : _u8L("Show Custom GCode"); + ImGui::Separator(); + if (imgui.button(btn_text, ImVec2(-1.0f, 0.0f), true)) { + m_extrusions.role_visibility_flags = custom_visible ? m_extrusions.role_visibility_flags & ~(1 << int(GCodeExtrusionRole::Custom)) : + m_extrusions.role_visibility_flags | (1 << int(GCodeExtrusionRole::Custom)); + wxGetApp().plater()->refresh_print(); + } + } + } + // total estimated printing time section if (show_estimated_time) { ImGui::Spacing();