From 4a9602b073be609a5539e48a55c25abe51b83a7f Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Mon, 26 Jul 2021 13:59:36 +0200 Subject: [PATCH] Another follow-up of 8ebb2e2a290ea2bbbcd4d1bd119059a6211f4cd9 -> GCodeViewer: Ensure that the view is properly updated after automatic selection of view type introduced with 06e2835f8344cbcae88c6534fa7156689376d511 --- src/slic3r/GUI/GUI_Preview.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index 5eeee546e9..91964b648e 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -910,6 +910,7 @@ void Preview::load_print_as_fff(bool keep_z_range) GCodeViewer::EViewType gcode_view_type = m_canvas->get_gcode_view_preview_type(); bool gcode_preview_data_valid = !m_gcode_result->moves.empty(); + // Collect colors per extruder. std::vector colors; std::vector color_print_values = {}; @@ -963,9 +964,8 @@ void Preview::load_print_as_fff(bool keep_z_range) update_layers_slider(zs, keep_z_range); } - unsigned int number_extruders = (unsigned int)print->extruders().size(); - if (!m_keep_current_preview_type) { + unsigned int number_extruders = (unsigned int)print->extruders().size(); #if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER std::vector gcodes = wxGetApp().is_editor() ? wxGetApp().plater()->model().custom_gcode_per_print_z.gcodes : @@ -984,6 +984,12 @@ void Preview::load_print_as_fff(bool keep_z_range) if (0 <= type && type < static_cast(GCodeViewer::EViewType::Count)) { m_choice_view_type->SetSelection(type); m_canvas->set_gcode_view_preview_type(static_cast(type)); +#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER + if (wxGetApp().is_gcode_viewer()) { + m_keep_current_preview_type = true; + refresh_print(); + } +#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER } } }