Fix UI glitches when "fill bed" fails to add any additional instances

This commit is contained in:
tamasmeszaros 2021-08-25 13:01:08 +02:00
parent 38cd7fea65
commit a918314aab

View File

@ -147,6 +147,11 @@ void FillBedJob::finalize()
size_t inst_cnt = model_object->instances.size();
int added_cnt = std::accumulate(m_selected.begin(), m_selected.end(), 0, [](int s, auto &ap) {
return s + int(ap.priority == 0 && ap.bed_idx == 0);
});
if (added_cnt > 0) {
for (ArrangePolygon &ap : m_selected) {
if (ap.bed_idx != arrangement::UNARRANGED && (ap.priority != 0 || ap.bed_idx == 0))
ap.apply();
@ -156,17 +161,14 @@ void FillBedJob::finalize()
m_plater->update();
int added_cnt = std::accumulate(m_selected.begin(), m_selected.end(), 0,
[](int s, auto &ap) {
return s + int(ap.priority == 0 && ap.bed_idx == 0);
});
// FIXME: somebody explain why this is needed for increase_object_instances
if (inst_cnt == 1) added_cnt++;
if (added_cnt > 0)
m_plater->sidebar()
.obj_list()->increase_object_instances(m_object_idx, size_t(added_cnt));
}
Job::finalize();
}
}} // namespace Slic3r::GUI