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
This commit is contained in:
lane.wei 2022-10-28 10:18:17 +08:00 committed by Lane.Wei
parent 301b85f5c0
commit c79af29ad4
2 changed files with 16 additions and 3 deletions

View File

@ -248,7 +248,8 @@ void GLCanvas3D::Labels::render(const std::vector<const ModelInstance*>& 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<const ModelInstance*> 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);

View File

@ -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();