FIX: FillBed crashes when accessing unset print config option

1. When the option is not set, print.full_print_config() is empty, so we
can't access opt_bool("scan_first_layer") or opt_bool("enable_support").
Should use wxGetApp().preset_bundle->full_config() instead.
Jira: STUDIO-3264
2. Allow different object having different brim_width to encode support's brim width.
In this way the arranging logic is simpler and more objects can be arranged in a plate.

Change-Id: Ic7178652147b0519d50b2eb9ceb214b4ef4c0251
(cherry picked from commit 0f163d59b40009cd29b8b1e32f730258ad0786dc)
This commit is contained in:
Arthur
2023-06-19 18:25:24 +08:00
committed by Lane.Wei
parent 9ad9ba213a
commit 4e5f4ee366
3 changed files with 15 additions and 15 deletions

View File

@@ -45,6 +45,7 @@ void FillBedJob::prepare()
ModelObject *model_object = m_plater->model().objects[m_object_idx];
if (model_object->instances.empty()) return;
const Slic3r::DynamicPrintConfig& global_config = wxGetApp().preset_bundle->full_config();
m_selected.reserve(model_object->instances.size());
for (size_t oidx = 0; oidx < model.objects.size(); ++oidx)
{
@@ -53,7 +54,7 @@ void FillBedJob::prepare()
{
bool selected = (oidx == m_object_idx);
ArrangePolygon ap = get_arrange_poly(mo->instances[inst_idx]);
ArrangePolygon ap = get_instance_arrange_poly(mo->instances[inst_idx], global_config);
BoundingBox ap_bb = ap.transformed_poly().contour.bounding_box();
ap.height = 1;
ap.name = mo->name;
@@ -167,7 +168,7 @@ void FillBedJob::prepare()
// if the selection is not a single instance, choose the first as template
//sel_id = std::max(sel_id, 0);
ModelInstance *mi = model_object->instances[sel_id];
ArrangePolygon template_ap = get_arrange_poly(mi);
ArrangePolygon template_ap = get_instance_arrange_poly(mi, global_config);
for (int i = 0; i < needed_items; ++i) {
ArrangePolygon ap = template_ap;
@@ -209,7 +210,8 @@ void FillBedJob::process()
auto &partplate_list = m_plater->get_partplate_list();
auto &print = wxGetApp().plater()->get_partplate_list().get_current_fff_print();
if (params.avoid_extrusion_cali_region && print.full_print_config().opt_bool("scan_first_layer"))
const Slic3r::DynamicPrintConfig& global_config = wxGetApp().preset_bundle->full_config();
if (params.avoid_extrusion_cali_region && global_config.opt_bool("scan_first_layer"))
partplate_list.preprocess_nonprefered_areas(m_unselected, MAX_NUM_PLATES);
update_selected_items_inflation(m_selected, *m_plater, params);