Fixed color of layer containing pause prints in non-gcode preview

This commit is contained in:
enricoturri1966 2020-10-22 12:55:13 +02:00
parent 844ec8447d
commit 8d59abfdf8

View file

@ -1242,17 +1242,13 @@ void Preview::load_print_as_fff(bool keep_z_range)
} }
#if ENABLE_GCODE_VIEWER #if ENABLE_GCODE_VIEWER
if (wxGetApp().is_editor() && !has_layers) if (wxGetApp().is_editor() && !has_layers) {
#else
if (! has_layers)
#endif // ENABLE_GCODE_VIEWER
{
#if ENABLE_GCODE_VIEWER
hide_layers_slider(); hide_layers_slider();
m_left_sizer->Hide(m_bottom_toolbar_panel); m_left_sizer->Hide(m_bottom_toolbar_panel);
m_left_sizer->Layout(); m_left_sizer->Layout();
Refresh(); Refresh();
#else #else
if (! has_layers) {
reset_sliders(true); reset_sliders(true);
m_canvas->reset_legend_texture(); m_canvas->reset_legend_texture();
#endif // ENABLE_GCODE_VIEWER #endif // ENABLE_GCODE_VIEWER
@ -1260,8 +1256,7 @@ void Preview::load_print_as_fff(bool keep_z_range)
return; return;
} }
if (m_preferred_color_mode == "tool_or_feature") if (m_preferred_color_mode == "tool_or_feature") {
{
// It is left to Slic3r to decide whether the print shall be colored by the tool or by the feature. // It is left to Slic3r to decide whether the print shall be colored by the tool or by the feature.
// Color by feature if it is a single extruder print. // Color by feature if it is a single extruder print.
unsigned int number_extruders = (unsigned int)print->extruders().size(); unsigned int number_extruders = (unsigned int)print->extruders().size();
@ -1290,31 +1285,32 @@ void Preview::load_print_as_fff(bool keep_z_range)
std::vector<CustomGCode::Item> color_print_values = {}; std::vector<CustomGCode::Item> color_print_values = {};
// set color print values, if it si selected "ColorPrint" view type // set color print values, if it si selected "ColorPrint" view type
#if ENABLE_GCODE_VIEWER #if ENABLE_GCODE_VIEWER
if (gcode_view_type == GCodeViewer::EViewType::ColorPrint) if (gcode_view_type == GCodeViewer::EViewType::ColorPrint) {
#else #else
if (m_gcode_preview_data->extrusion.view_type == GCodePreviewData::Extrusion::ColorPrint) if (m_gcode_preview_data->extrusion.view_type == GCodePreviewData::Extrusion::ColorPrint) {
#endif // ENABLE_GCODE_VIEWER #endif // ENABLE_GCODE_VIEWER
{
colors = wxGetApp().plater()->get_colors_for_color_print(); colors = wxGetApp().plater()->get_colors_for_color_print();
#if !ENABLE_GCODE_VIEWER #if !ENABLE_GCODE_VIEWER
colors.push_back("#808080"); // gray color for pause print or custom G-code colors.push_back("#808080"); // gray color for pause print or custom G-code
#endif // !ENABLE_GCODE_VIEWER #endif // !ENABLE_GCODE_VIEWER
if (!gcode_preview_data_valid) if (!gcode_preview_data_valid) {
color_print_values = wxGetApp().plater()->model().custom_gcode_per_print_z.gcodes; color_print_values = wxGetApp().plater()->model().custom_gcode_per_print_z.gcodes;
#if ENABLE_GCODE_VIEWER
colors.push_back("#808080"); // gray color for pause print or custom G-code
#endif // ENABLE_GCODE_VIEWER
}
} }
#if ENABLE_GCODE_VIEWER #if ENABLE_GCODE_VIEWER
else if (gcode_preview_data_valid || gcode_view_type == GCodeViewer::EViewType::Tool) else if (gcode_preview_data_valid || gcode_view_type == GCodeViewer::EViewType::Tool) {
#else #else
else if (gcode_preview_data_valid || (m_gcode_preview_data->extrusion.view_type == GCodePreviewData::Extrusion::Tool) ) else if (gcode_preview_data_valid || (m_gcode_preview_data->extrusion.view_type == GCodePreviewData::Extrusion::Tool) ) {
#endif // ENABLE_GCODE_VIEWER #endif // ENABLE_GCODE_VIEWER
{
colors = wxGetApp().plater()->get_extruder_colors_from_plater_config(); colors = wxGetApp().plater()->get_extruder_colors_from_plater_config();
color_print_values.clear(); color_print_values.clear();
} }
if (IsShown()) if (IsShown()) {
{
#if ENABLE_GCODE_VIEWER #if ENABLE_GCODE_VIEWER
std::vector<double> zs; std::vector<double> zs;
#endif // ENABLE_GCODE_VIEWER #endif // ENABLE_GCODE_VIEWER