From 0eca8f14cc68e596e597539d78a3ee8035a3edcd Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Tue, 18 Dec 2018 09:08:32 +0100 Subject: [PATCH] Fixed update of gcode preview view type when changing printer --- src/slic3r/GUI/GUI_Preview.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index 4e14aefe8..71c92f2d1 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -385,17 +385,13 @@ void Preview::set_number_extruders(unsigned int number_extruders) if (m_number_extruders != number_extruders) { m_number_extruders = number_extruders; - int type = 0; // color by a feature type - if (number_extruders > 1) - { - int tool_idx = m_choice_view_type->FindString(_(L("Tool"))); - int type = (number_extruders > 1) ? tool_idx /* color by a tool number */ : 0; // color by a feature type - m_choice_view_type->SetSelection(type); - if ((0 <= type) && (type < (int)GCodePreviewData::Extrusion::Num_View_Types)) - m_gcode_preview_data->extrusion.view_type = (GCodePreviewData::Extrusion::EViewType)type; + int tool_idx = m_choice_view_type->FindString(_(L("Tool"))); + int type = (number_extruders > 1) ? tool_idx /* color by a tool number */ : 0; // color by a feature type + m_choice_view_type->SetSelection(type); + if ((0 <= type) && (type < (int)GCodePreviewData::Extrusion::Num_View_Types)) + m_gcode_preview_data->extrusion.view_type = (GCodePreviewData::Extrusion::EViewType)type; - m_preferred_color_mode = (type == tool_idx) ? "tool_or_feature" : "feature"; - } + m_preferred_color_mode = (type == tool_idx) ? "tool_or_feature" : "feature"; } }