Fixed incorrect z values set into GCode Preview sliders

This commit is contained in:
Enrico Turri 2018-04-25 14:38:44 +02:00
parent bbc3c890ea
commit 1a4827ba33

View File

@ -751,7 +751,10 @@ std::vector<double> GLVolumeCollection::get_current_print_zs() const
// Collect layer top positions of all volumes. // Collect layer top positions of all volumes.
std::vector<double> print_zs; std::vector<double> print_zs;
for (GLVolume *vol : this->volumes) for (GLVolume *vol : this->volumes)
{
if (vol->is_active)
append(print_zs, vol->print_zs); append(print_zs, vol->print_zs);
}
std::sort(print_zs.begin(), print_zs.end()); std::sort(print_zs.begin(), print_zs.end());
// Replace intervals of layers with similar top positions with their average value. // 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); _generate_legend_texture(*preview_data, tool_colors);
_load_shells(*print, *volumes, use_VBOs); _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());
} }
} }