Don't change to color print view when no color change gcodes are set
When changing custom gcodes the view type is always changed to color view when any custom gcode is set. This fix only changes to color view when the custom gcodes contain at least one color change. Fixes #8413 and #5837
This commit is contained in:
parent
8fbc0b8633
commit
559173c2a1
@ -1011,8 +1011,10 @@ void Preview::load_print_as_fff(bool keep_z_range)
|
||||
std::vector<Item> gcodes = wxGetApp().is_editor() ?
|
||||
wxGetApp().plater()->model().custom_gcode_per_print_z.gcodes :
|
||||
m_canvas->get_custom_gcode_per_print_z();
|
||||
const bool contains_color_gcodes = std::any_of(std::begin(gcodes), std::end(gcodes),
|
||||
[] (auto const& item) { return item.type == CustomGCode::Type::ColorChange; });
|
||||
#if ENABLE_PREVIEW_LAYOUT
|
||||
const GCodeViewer::EViewType choice = !gcodes.empty() ?
|
||||
const GCodeViewer::EViewType choice = contains_color_gcodes ?
|
||||
GCodeViewer::EViewType::ColorPrint :
|
||||
(number_extruders > 1) ? GCodeViewer::EViewType::Tool : GCodeViewer::EViewType::FeatureType;
|
||||
if (choice != gcode_view_type) {
|
||||
@ -1022,7 +1024,7 @@ void Preview::load_print_as_fff(bool keep_z_range)
|
||||
refresh_print();
|
||||
}
|
||||
#else
|
||||
const wxString choice = !gcodes.empty() ?
|
||||
const wxString choice = contains_color_gcodes ?
|
||||
_L("Color Print") :
|
||||
(number_extruders > 1) ? _L("Tool") : _L("Feature type");
|
||||
int type = m_choice_view_type->FindString(choice);
|
||||
|
Loading…
Reference in New Issue
Block a user