Fixed crash when moving horizontal slider thumb in preview with no toolpath active

This commit is contained in:
enricoturri1966 2020-10-07 13:38:21 +02:00
parent 9e0e597284
commit 2ecd78b0d5
5 changed files with 25 additions and 6 deletions
src/slic3r/GUI

View file

@ -1689,6 +1689,8 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool
break;
}
unsigned int render_paths_count = 0;
// second pass: filter paths by sequential data and collect them by color
for (const auto& [buffer, index_buffer_id, path_id] : paths) {
const Path& path = buffer->paths[path_id];
@ -1711,6 +1713,7 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool
it->color = color;
it->path_id = path_id;
it->index_buffer_id = index_buffer_id;
++render_paths_count;
}
unsigned int segments_count = std::min(m_sequential_view.current.last, path.last.s_id) - std::max(m_sequential_view.current.first, path.first.s_id) + 1;
@ -1733,6 +1736,8 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool
it->offsets.push_back(static_cast<size_t>((path.first.i_id + delta_1st) * sizeof(unsigned int)));
}
wxGetApp().plater()->enable_preview_moves_slider(render_paths_count > 0);
#if ENABLE_GCODE_VIEWER_STATISTICS
for (const TBuffer& buffer : m_buffers) {
m_statistics.render_paths_size += SLIC3R_STDVEC_MEMSIZE(buffer.render_paths, RenderPath);