From c79af29ad4e96024f6bf9be82932ec430c0719a5 Mon Sep 17 00:00:00 2001 From: "lane.wei" Date: Fri, 28 Oct 2022 10:18:17 +0800 Subject: [PATCH] ENH: refine the label logic of seq_print use the arrange_order computed by Print turn on label by default when switch to sequent print Change-Id: I7063bcc9494bbfc14a3cee85eaf30a9eb52c99d2 --- src/slic3r/GUI/GLCanvas3D.cpp | 17 ++++++++++++++--- src/slic3r/GUI/Plater.cpp | 2 ++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 145b0a9f1..ecb49861d 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -248,7 +248,8 @@ void GLCanvas3D::Labels::render(const std::vector& sorted_ return owner.model_instance_id == id; }); if (it != owners.end()) - it->print_order = std::string((_(L("Sequence"))).ToUTF8()) + "#: " + std::to_string(i + 1); + //it->print_order = std::string((_(L("Sequence"))).ToUTF8()) + "#: " + std::to_string(i + 1); + it->print_order = std::string((_(L("Sequence"))).ToUTF8()) + "#: " + std::to_string(sorted_instances[i]->arrange_order); } } @@ -6037,10 +6038,20 @@ void GLCanvas3D::_render_overlays() bool sequential_print = opt != nullptr && (opt->value == PrintSequence::ByObject); std::vector sorted_instances; if (sequential_print) { - for (ModelObject* model_object : m_model->objects) + const Print* print = fff_print(); + if (print) { + for (const PrintObject *print_object : print->objects()) + { + for (const PrintInstance &instance : print_object->instances()) + { + sorted_instances.emplace_back(instance.model_instance); + } + } + } + /*for (ModelObject* model_object : m_model->objects) for (ModelInstance* model_instance : model_object->instances) { sorted_instances.emplace_back(model_instance); - } + }*/ } m_labels.render(sorted_instances); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 665a31e1e..5ad47eaaa 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -9370,6 +9370,8 @@ void Plater::on_config_change(const DynamicPrintConfig &config) if (seq_print->value == PrintSequence::ByObject) { std::string info_text = L("Print By Object: \nSuggest to use auto-arrange to avoid collisions when printing."); notify_manager->bbl_show_seqprintinfo_notification(info_text); + //always show label when switch to sequence print + this->show_view3D_labels(true); } else notify_manager->bbl_close_seqprintinfo_notification();