From 1a4827ba33dfba5e6567d4e942fa91f662dc040d Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Wed, 25 Apr 2018 14:38:44 +0200 Subject: [PATCH] Fixed incorrect z values set into GCode Preview sliders --- xs/src/slic3r/GUI/3DScene.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/xs/src/slic3r/GUI/3DScene.cpp b/xs/src/slic3r/GUI/3DScene.cpp index 7f5e632bb..a016ab5aa 100644 --- a/xs/src/slic3r/GUI/3DScene.cpp +++ b/xs/src/slic3r/GUI/3DScene.cpp @@ -751,7 +751,10 @@ std::vector GLVolumeCollection::get_current_print_zs() const // Collect layer top positions of all volumes. std::vector print_zs; for (GLVolume *vol : this->volumes) - append(print_zs, vol->print_zs); + { + if (vol->is_active) + append(print_zs, vol->print_zs); + } std::sort(print_zs.begin(), print_zs.end()); // Replace intervals of layers with similar top positions with their average value. @@ -1757,6 +1760,11 @@ void _3DScene::load_gcode_preview(const Print* print, const GCodePreviewData* pr { _generate_legend_texture(*preview_data, tool_colors); _load_shells(*print, *volumes, use_VBOs); + + // removes empty volumes + volumes->volumes.erase(std::remove_if(volumes->volumes.begin(), volumes->volumes.end(), + [](const GLVolume *volume) { return volume->print_zs.empty(); }), + volumes->volumes.end()); } }