diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index 00fa066c9f..d06a88199c 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -661,13 +661,13 @@ void GCodeViewer::init() } #endif // ENABLE_SEAMS_USING_MODELS -void GCodeViewer::load(const GCodeProcessor::Result& gcode_result, const Print& print, bool initialized) +void GCodeViewer::load(const GCodeProcessor::Result& gcode_result, const Print& print, bool initialized, bool save_result_id/* = true*/) { // avoid processing if called with the same gcode_result if (m_last_result_id == gcode_result.id) return; - - m_last_result_id = gcode_result.id; + if (save_result_id) + m_last_result_id = gcode_result.id; // release gpu memory, if used reset(); diff --git a/src/slic3r/GUI/GCodeViewer.hpp b/src/slic3r/GUI/GCodeViewer.hpp index 66fcba2bcf..0ecc2268dc 100644 --- a/src/slic3r/GUI/GCodeViewer.hpp +++ b/src/slic3r/GUI/GCodeViewer.hpp @@ -820,7 +820,7 @@ public: #endif // ENABLE_SEAMS_USING_MODELS // extract rendering data from the given parameters - void load(const GCodeProcessor::Result& gcode_result, const Print& print, bool initialized); + void load(const GCodeProcessor::Result& gcode_result, const Print& print, bool initialized, bool save_result_id = true); // recalculate ranges in dependence of what is visible and sets tool/print colors void refresh(const GCodeProcessor::Result& gcode_result, const std::vector& str_tool_colors); void refresh_render_paths(); diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index bdad43ab5b..c192d93544 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -2116,6 +2116,17 @@ void GLCanvas3D::load_gcode_preview(const GCodeProcessor::Result& gcode_result, request_extra_frame(); } +void GLCanvas3D::check_toolpath(const GCodeProcessor::Result& gcode_result, const std::vector& str_tool_colors) +{ + m_gcode_viewer.load(gcode_result, *this->fff_print(), m_initialized, false); + + if (wxGetApp().is_editor()) { + //m_gcode_viewer.update_shells_color_by_extruder(m_config); + _set_warning_notification_if_needed(EWarning::ToolpathOutside); + } + +} + void GLCanvas3D::refresh_gcode_preview_render_paths() { m_gcode_viewer.refresh_render_paths(); diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index da75fd32fc..fd4c7907b3 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -738,6 +738,7 @@ public: void reload_scene(bool refresh_immediately, bool force_full_scene_refresh = false); void load_gcode_preview(const GCodeProcessor::Result& gcode_result, const std::vector& str_tool_colors); + void check_toolpath(const GCodeProcessor::Result& gcode_result, const std::vector& str_tool_colors); void refresh_gcode_preview_render_paths(); void set_gcode_view_preview_type(GCodeViewer::EViewType type) { return m_gcode_viewer.set_view_type(type); } GCodeViewer::EViewType get_gcode_view_preview_type() const { return m_gcode_viewer.get_view_type(); } diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index 8ca2a39c5d..c9a6e85491 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -974,6 +974,9 @@ void Preview::load_print_as_fff(bool keep_z_range) m_canvas_widget->Refresh(); } else update_layers_slider(zs, keep_z_range); + // if background processing is enabled, load gcode preview to check toolpath outside + } else if (wxGetApp().app_config->get("background_processing") == "1" && gcode_preview_data_valid && wxGetApp().is_editor()) { + m_canvas->check_toolpath(*m_gcode_result, colors); } }