Adaptive layers - respect layer height range modifiers. (#5941)

* Adaptive layers - respect layer height range modifiers.

* Remove #pragma optimize
This commit is contained in:
Vovodroid 2024-11-21 15:40:51 +02:00 committed by GitHub
parent 31be67926e
commit b3b0961d91
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 1 deletions

View file

@ -319,6 +319,13 @@ std::vector<double> layer_height_profile_adaptive(const SlicingParameters& slici
else if (layer_height_profile.back() > height && layer_height_profile.back() - height > LAYER_HEIGHT_CHANGE_STEP)
height = layer_height_profile.back() - LAYER_HEIGHT_CHANGE_STEP;
for (auto const& [range,options] : object.layer_config_ranges) {
if ( print_z >= range.first && print_z <= range.second) {
height = options.opt_float("layer_height");
break;
};
};
layer_height_profile.push_back(print_z);
layer_height_profile.push_back(height);
print_z += height;
@ -444,6 +451,7 @@ std::vector<double> smooth_height_profile(const std::vector<double>& profile, co
}
void adjust_layer_height_profile(
const ModelObject &model_object,
const SlicingParameters &slicing_params,
std::vector<coordf_t> &layer_height_profile,
coordf_t z,
@ -478,6 +486,11 @@ void adjust_layer_height_profile(
}
}
for (auto const& [range,options] : model_object.layer_config_ranges) {
if (z >= range.first - current_layer_height && z <= range.second + current_layer_height)
return;
};
// 2) Is it possible to apply the delta?
switch (action) {
case LAYER_HEIGHT_EDIT_ACTION_DECREASE:

View file

@ -176,6 +176,7 @@ enum LayerHeightEditActionType : unsigned int {
};
void adjust_layer_height_profile(
const ModelObject &model_object,
const SlicingParameters &slicing_params,
std::vector<coordf_t> &layer_height_profile,
coordf_t z,

View file

@ -590,7 +590,7 @@ void GLCanvas3D::LayersEditing::adjust_layer_height_profile()
{
this->update_slicing_parameters();
PrintObject::update_layer_height_profile(*m_model_object, *m_slicing_parameters, m_layer_height_profile);
Slic3r::adjust_layer_height_profile(*m_slicing_parameters, m_layer_height_profile, this->last_z, this->strength, this->band_width, this->last_action);
Slic3r::adjust_layer_height_profile(*m_model_object, *m_slicing_parameters, m_layer_height_profile, this->last_z, this->strength, this->band_width, this->last_action);
m_layers_texture.valid = false;
}