diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index 75b228155..15098b1b2 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -97,5 +97,6 @@ #define ENABLE_2_3_0_BETA3 1 #define ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE (1 && ENABLE_2_3_0_BETA3) +#define ENABLE_RENDER_PATH_REFRESH_AFTER_OPTIONS_CHANGE (1 && ENABLE_2_3_0_BETA3) #endif // _prusaslicer_technologies_h_ diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index 3bcfa2de6..c3c627a23 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -429,11 +429,22 @@ void GCodeViewer::refresh(const GCodeProcessor::Result& gcode_result, const std: #endif // ENABLE_GCODE_VIEWER_STATISTICS // update buffers' render paths +#if ENABLE_RENDER_PATH_REFRESH_AFTER_OPTIONS_CHANGE + refresh_render_paths(); +#else refresh_render_paths(false, false); +#endif // ENABLE_RENDER_PATH_REFRESH_AFTER_OPTIONS_CHANGE log_memory_used("Refreshed G-code extrusion paths, "); } +#if ENABLE_RENDER_PATH_REFRESH_AFTER_OPTIONS_CHANGE +void GCodeViewer::refresh_render_paths() +{ + refresh_render_paths(false, false); +} +#endif // ENABLE_RENDER_PATH_REFRESH_AFTER_OPTIONS_CHANGE + void GCodeViewer::reset() { m_initialized = false; diff --git a/src/slic3r/GUI/GCodeViewer.hpp b/src/slic3r/GUI/GCodeViewer.hpp index 165f0933f..2c769b2c8 100644 --- a/src/slic3r/GUI/GCodeViewer.hpp +++ b/src/slic3r/GUI/GCodeViewer.hpp @@ -469,6 +469,9 @@ public: void load(const GCodeProcessor::Result& gcode_result, const Print& print, bool initialized); // 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); +#if ENABLE_RENDER_PATH_REFRESH_AFTER_OPTIONS_CHANGE + void refresh_render_paths(); +#endif // ENABLE_RENDER_PATH_REFRESH_AFTER_OPTIONS_CHANGE void reset(); void render() const; diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 368405b46..8f1c8074c 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -2287,6 +2287,15 @@ void GLCanvas3D::refresh_gcode_preview(const GCodeProcessor::Result& gcode_resul request_extra_frame(); } +#if ENABLE_RENDER_PATH_REFRESH_AFTER_OPTIONS_CHANGE +void GLCanvas3D::refresh_gcode_preview_render_paths() +{ + m_gcode_viewer.refresh_render_paths(); + set_as_dirty(); + request_extra_frame(); +} +#endif // ENABLE_RENDER_PATH_REFRESH_AFTER_OPTIONS_CHANGE + void GLCanvas3D::load_sla_preview() { const SLAPrint* print = this->sla_print(); diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index e45ea1188..9c80aa236 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -633,6 +633,9 @@ public: void load_gcode_preview(const GCodeProcessor::Result& gcode_result); void refresh_gcode_preview(const GCodeProcessor::Result& gcode_result, const std::vector& str_tool_colors); +#if ENABLE_RENDER_PATH_REFRESH_AFTER_OPTIONS_CHANGE + void refresh_gcode_preview_render_paths(); +#endif // ENABLE_RENDER_PATH_REFRESH_AFTER_OPTIONS_CHANGE 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(); } void load_sla_preview(); diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index 17c5032db..e729eedd4 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -507,6 +507,9 @@ void Preview::on_combochecklist_options(wxCommandEvent& evt) m_canvas->set_gcode_options_visibility_from_flags(new_flags); +#if ENABLE_RENDER_PATH_REFRESH_AFTER_OPTIONS_CHANGE + m_canvas->refresh_gcode_preview_render_paths(); +#else bool skip_refresh = xored(curr_flags, new_flags, static_cast(OptionType::Shells)) || xored(curr_flags, new_flags, static_cast(OptionType::ToolMarker)); @@ -514,6 +517,7 @@ void Preview::on_combochecklist_options(wxCommandEvent& evt) refresh_print(); else m_canvas->set_as_dirty(); +#endif // ENABLE_RENDER_PATH_REFRESH_AFTER_OPTIONS_CHANGE } #if !ENABLE_PREVIEW_TYPE_CHANGE