mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 11:45:56 +08:00
Fix UI glitches when "fill bed" fails to add any additional instances
This commit is contained in:
parent
38cd7fea65
commit
a918314aab
@ -147,6 +147,11 @@ void FillBedJob::finalize()
|
|||||||
|
|
||||||
size_t inst_cnt = model_object->instances.size();
|
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) {
|
for (ArrangePolygon &ap : m_selected) {
|
||||||
if (ap.bed_idx != arrangement::UNARRANGED && (ap.priority != 0 || ap.bed_idx == 0))
|
if (ap.bed_idx != arrangement::UNARRANGED && (ap.priority != 0 || ap.bed_idx == 0))
|
||||||
ap.apply();
|
ap.apply();
|
||||||
@ -156,17 +161,14 @@ void FillBedJob::finalize()
|
|||||||
|
|
||||||
m_plater->update();
|
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
|
// FIXME: somebody explain why this is needed for increase_object_instances
|
||||||
if (inst_cnt == 1) added_cnt++;
|
if (inst_cnt == 1) added_cnt++;
|
||||||
|
|
||||||
if (added_cnt > 0)
|
|
||||||
m_plater->sidebar()
|
m_plater->sidebar()
|
||||||
.obj_list()->increase_object_instances(m_object_idx, size_t(added_cnt));
|
.obj_list()->increase_object_instances(m_object_idx, size_t(added_cnt));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Job::finalize();
|
||||||
|
}
|
||||||
|
|
||||||
}} // namespace Slic3r::GUI
|
}} // namespace Slic3r::GUI
|
||||||
|
Loading…
x
Reference in New Issue
Block a user