Faster toolpaths refresh when changing options selection in preview
This commit is contained in:
parent
aaaa85c1f8
commit
5a7e4ff47c
@ -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_
|
||||
|
@ -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;
|
||||
|
@ -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<std::string>& 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;
|
||||
|
@ -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();
|
||||
|
@ -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<std::string>& 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();
|
||||
|
@ -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<unsigned int>(OptionType::Shells)) ||
|
||||
xored(curr_flags, new_flags, static_cast<unsigned int>(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
|
||||
|
Loading…
Reference in New Issue
Block a user