Fix per-object overhang slow down (#7976)

* Make sure the `m_extrusion_quality_estimator.set_current_object()` is called after regional config has been applied (SoftFever/OrcaSlicer#7946)

* Init `m_extrusion_quality_estimator` based on region config

* Revert "Make sure the `m_extrusion_quality_estimator.set_current_object()` is called after regional config has been applied (SoftFever/OrcaSlicer#7946)"

This reverts commit d13d4a47b78b6f80cdc4bff935ea8c3c52ff556b.

* Call `m_extrusion_quality_estimator.set_current_object` regardless, because that doesn't hurt

* Add a comment
This commit is contained in:
Noisyfox 2025-01-22 10:00:27 +08:00 committed by GitHub
parent 2253ab304a
commit ec591dcef1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3823,12 +3823,18 @@ LayerResult GCode::process_layer(
return next_extruder;
};
if (m_config.enable_overhang_speed && !m_config.overhang_speed_classic) {
for (const auto &layer_to_print : layers) {
if (layer_to_print.object_layer) {
const auto& regions = layer_to_print.object_layer->regions();
const bool enable_overhang_speed = std::any_of(regions.begin(), regions.end(), [](const LayerRegion* r) {
return r->has_extrusions() && r->region().config().enable_overhang_speed && !r->region().config().overhang_speed_classic;
});
if (enable_overhang_speed) {
m_extrusion_quality_estimator.prepare_for_new_layer(layer_to_print.original_object,
layer_to_print.object_layer);
}
}
}
// Group extrusions by an extruder, then by an object, an island and a region.
std::map<unsigned int, std::vector<ObjectByExtruder>> by_extruder;
@ -4190,7 +4196,10 @@ LayerResult GCode::process_layer(
}
}
if (m_config.enable_overhang_speed && !m_config.overhang_speed_classic)
// Orca(#7946): set current obj regardless of the `enable_overhang_speed` value, because
// `enable_overhang_speed` is a PrintRegionConfig and here we don't have a region yet.
// And no side effect doing this even if `enable_overhang_speed` is off, so don't bother
// checking anything here.
m_extrusion_quality_estimator.set_current_object(&instance_to_print.print_object);
// When starting a new object, use the external motion planner for the first travel move.