Skip to content

Commit

Permalink
Fix per-object overhang slow down (#7976)
Browse files Browse the repository at this point in the history
* Make sure the `m_extrusion_quality_estimator.set_current_object()` is called after regional config has been applied (#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 (#7946)"

This reverts commit d13d4a4.

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

* Add a comment
  • Loading branch information
Noisyfox authored Jan 22, 2025
1 parent 2253ab3 commit ec591dc
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/libslic3r/GCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3823,10 +3823,16 @@ 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) {
m_extrusion_quality_estimator.prepare_for_new_layer(layer_to_print.original_object,
layer_to_print.object_layer);
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);
}
}
}

Expand Down Expand Up @@ -4190,8 +4196,11 @@ LayerResult GCode::process_layer(
}
}

if (m_config.enable_overhang_speed && !m_config.overhang_speed_classic)
m_extrusion_quality_estimator.set_current_object(&instance_to_print.print_object);
// 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.
const Point &offset = instance_to_print.print_object.instances()[instance_to_print.instance_id].shift;
Expand Down

0 comments on commit ec591dc

Please sign in to comment.