From c7d9e55808f45b30491477a8f8c3e2317a0df151 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Mon, 25 Nov 2024 16:50:14 +0100 Subject: [PATCH] SPE-2587: Hotfix of slow loading of binary gcodes in gcodeviewer: caused by calling render way too often directly from the update function the fix is nothing nice, but it will have to do for now --- src/slic3r/GUI/Plater.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index cb45ef0488..404098efc2 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -4331,7 +4331,13 @@ void Plater::load_gcode(const wxString& filename) p->notification_manager->push_download_progress_notification("Loading...", []() { return false; }); processor.process_file(filename.ToUTF8().data(), [this](float value) { p->notification_manager->set_download_progress_percentage(value); - p->get_current_canvas3D()->render(); + static auto clock = std::chrono::steady_clock(); + static auto old_t = clock.now(); + auto t = clock.now(); + if (std::chrono::duration_cast(t - old_t).count() > 200) { + p->get_current_canvas3D()->render(); + old_t = t; + } }); } catch (const std::exception& ex)