ENH: sync some code change from prusa

Sync some code change and fix from Prusa.
Thanks Prusa.

This also can fix github issue #317

Signed-off-by: salt.wei <salt.wei@bambulab.com>
Change-Id: If6993e0149733ccf85ed85f82553caa03df7ac60
This commit is contained in:
salt.wei 2022-10-12 20:20:27 +08:00 committed by Lane.Wei
parent afd5e241e6
commit 0f1a001fd6
15 changed files with 514 additions and 110 deletions

View file

@ -753,10 +753,19 @@ bool PrintObject::invalidate_state_by_config_options(
|| opt_key == "bottom_surface_pattern"
|| opt_key == "external_fill_link_max_length"
|| opt_key == "infill_direction"
|| opt_key == "sparse_infill_pattern"
|| opt_key == "top_surface_line_width"
|| opt_key == "initial_layer_line_width") {
steps.emplace_back(posInfill);
} else if (opt_key == "sparse_infill_pattern") {
steps.emplace_back(posInfill);
const auto *old_fill_pattern = old_config.option<ConfigOptionEnum<InfillPattern>>(opt_key);
const auto *new_fill_pattern = new_config.option<ConfigOptionEnum<InfillPattern>>(opt_key);
assert(old_infill && new_infill);
// We need to recalculate infill surfaces when infill_only_where_needed is enabled, and we are switching from
// the Lightning infill to another infill or vice versa.
if (PrintObject::infill_only_where_needed && (new_fill_pattern->value == ipLightning || old_fill_pattern->value == ipLightning))
steps.emplace_back(posPrepareInfill);
} else if (opt_key == "sparse_infill_density") {
// One likely wants to reslice only when switching between zero infill to simulate boolean difference (subtracting volumes),
// normal infill and 100% (solid) infill.