Hopefully a fix of
"Layer editing does not trigger reslicing with Background Processing enabled" https://github.com/prusa3d/Slic3r/issues/293
This commit is contained in:
parent
6ce832e439
commit
958c6553e7
@ -319,6 +319,7 @@ sub _variable_layer_thickness_action {
|
|||||||
if ($self->{layer_height_edit_last_object_id} != -1) {
|
if ($self->{layer_height_edit_last_object_id} != -1) {
|
||||||
# Mark the volume as modified, so Print will pick its layer height profile? Where to mark it?
|
# Mark the volume as modified, so Print will pick its layer height profile? Where to mark it?
|
||||||
# Start a timer to refresh the print? schedule_background_process() ?
|
# Start a timer to refresh the print? schedule_background_process() ?
|
||||||
|
# The PrintObject::adjust_layer_height_profile() call adjusts the profile of its associated ModelObject, it does not modify the profile of the PrintObject itself.
|
||||||
$self->{print}->get_object($self->{layer_height_edit_last_object_id})->adjust_layer_height_profile(
|
$self->{print}->get_object($self->{layer_height_edit_last_object_id})->adjust_layer_height_profile(
|
||||||
$self->{layer_height_edit_last_z},
|
$self->{layer_height_edit_last_z},
|
||||||
$self->{layer_height_edit_strength},
|
$self->{layer_height_edit_strength},
|
||||||
|
@ -116,8 +116,7 @@ sub new {
|
|||||||
});
|
});
|
||||||
$self->{canvas3D}->set_on_model_update(sub {
|
$self->{canvas3D}->set_on_model_update(sub {
|
||||||
if ($Slic3r::GUI::Settings->{_}{background_processing}) {
|
if ($Slic3r::GUI::Settings->{_}{background_processing}) {
|
||||||
$self->{apply_config_timer}->Stop if defined $self->{apply_config_timer};
|
$self->schedule_background_process;
|
||||||
$self->async_apply_config();
|
|
||||||
} else {
|
} else {
|
||||||
# Hide the print info box, it is no more valid.
|
# Hide the print info box, it is no more valid.
|
||||||
$self->{"print_info_box_show"}->(0);
|
$self->{"print_info_box_show"}->(0);
|
||||||
|
@ -214,8 +214,11 @@ if (@ARGV) { # slicing from command line
|
|||||||
output_file => $opt{output},
|
output_file => $opt{output},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# This is delegated to C++ PrintObject::apply_config().
|
||||||
$sprint->apply_config($config);
|
$sprint->apply_config($config);
|
||||||
$sprint->set_model($model);
|
$sprint->set_model($model);
|
||||||
|
# Do the apply_config once again to validate the layer height profiles at all the newly added PrintObjects.
|
||||||
|
$sprint->apply_config($config);
|
||||||
|
|
||||||
if ($opt{export_svg}) {
|
if ($opt{export_svg}) {
|
||||||
$sprint->export_svg;
|
$sprint->export_svg;
|
||||||
|
@ -397,6 +397,16 @@ bool Print::apply_config(DynamicPrintConfig config)
|
|||||||
PrintObjectConfig new_config = this->default_object_config;
|
PrintObjectConfig new_config = this->default_object_config;
|
||||||
// we override the new config with object-specific options
|
// we override the new config with object-specific options
|
||||||
normalize_and_apply_config(new_config, object->model_object()->config);
|
normalize_and_apply_config(new_config, object->model_object()->config);
|
||||||
|
// Force a refresh of a variable layer height profile at the PrintObject if it is not valid.
|
||||||
|
if (! object->layer_height_profile_valid) {
|
||||||
|
// The layer_height_profile is not valid for some reason (updated by the user or invalidated due to some option change).
|
||||||
|
// Invalidate the slicing step, which in turn invalidates everything.
|
||||||
|
object->invalidate_step(posSlice);
|
||||||
|
// Following line sets the layer_height_profile_valid flag.
|
||||||
|
object->update_layer_height_profile();
|
||||||
|
// Trigger recalculation.
|
||||||
|
invalidated = true;
|
||||||
|
}
|
||||||
// check whether the new config is different from the current one
|
// check whether the new config is different from the current one
|
||||||
t_config_option_keys diff = object->config.diff(new_config);
|
t_config_option_keys diff = object->config.diff(new_config);
|
||||||
object->config.apply(new_config, diff, true);
|
object->config.apply(new_config, diff, true);
|
||||||
@ -475,22 +485,6 @@ exit_for_rearrange_regions:
|
|||||||
this->objects.back()->update_layer_height_profile();
|
this->objects.back()->update_layer_height_profile();
|
||||||
}
|
}
|
||||||
invalidated = true;
|
invalidated = true;
|
||||||
} else {
|
|
||||||
// Check validity of the layer height profiles.
|
|
||||||
for (PrintObject *object : this->objects) {
|
|
||||||
if (! object->layer_height_profile_valid) {
|
|
||||||
// The layer_height_profile is not valid for some reason (updated by the user or invalidated due to some option change).
|
|
||||||
// Start slicing of this object from scratch.
|
|
||||||
object->invalidate_all_steps();
|
|
||||||
// Following line sets the layer_height_profile_valid flag.
|
|
||||||
object->update_layer_height_profile();
|
|
||||||
invalidated = true;
|
|
||||||
} else if (! step_done(posSlice)) {
|
|
||||||
// Update layer_height_profile from the main thread as it may pull the data from the associated ModelObject.
|
|
||||||
// Only update if the slicing was not finished yet.
|
|
||||||
object->update_layer_height_profile();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return invalidated;
|
return invalidated;
|
||||||
@ -585,7 +579,9 @@ std::string Print::validate() const
|
|||||||
return "The Wipe Tower is only supported for multiple objects if they are printed with the same support_material_contact_distance";
|
return "The Wipe Tower is only supported for multiple objects if they are printed with the same support_material_contact_distance";
|
||||||
if (! equal_layering(slicing_params, slicing_params0))
|
if (! equal_layering(slicing_params, slicing_params0))
|
||||||
return "The Wipe Tower is only supported for multiple objects if they are sliced equally.";
|
return "The Wipe Tower is only supported for multiple objects if they are sliced equally.";
|
||||||
|
bool was_layer_height_profile_valid = object->layer_height_profile_valid;
|
||||||
object->update_layer_height_profile();
|
object->update_layer_height_profile();
|
||||||
|
object->layer_height_profile_valid = was_layer_height_profile_valid;
|
||||||
for (size_t i = 1; i < object->layer_height_profile.size(); i += 2)
|
for (size_t i = 1; i < object->layer_height_profile.size(); i += 2)
|
||||||
if (object->layer_height_profile[i-1] > slicing_params.object_print_z_min + EPSILON &&
|
if (object->layer_height_profile[i-1] > slicing_params.object_print_z_min + EPSILON &&
|
||||||
std::abs(object->layer_height_profile[i] - object->config.layer_height) > EPSILON)
|
std::abs(object->layer_height_profile[i] - object->config.layer_height) > EPSILON)
|
||||||
|
@ -263,6 +263,7 @@ bool PrintObject::invalidate_step(PrintObjectStep step)
|
|||||||
} else if (step == posSlice) {
|
} else if (step == posSlice) {
|
||||||
invalidated |= this->invalidate_step(posPerimeters);
|
invalidated |= this->invalidate_step(posPerimeters);
|
||||||
invalidated |= this->invalidate_step(posSupportMaterial);
|
invalidated |= this->invalidate_step(posSupportMaterial);
|
||||||
|
invalidated |= this->_print->invalidate_step(psWipeTower);
|
||||||
} else if (step == posSupportMaterial) {
|
} else if (step == posSupportMaterial) {
|
||||||
invalidated |= this->_print->invalidate_step(psSkirt);
|
invalidated |= this->_print->invalidate_step(psSkirt);
|
||||||
invalidated |= this->_print->invalidate_step(psBrim);
|
invalidated |= this->_print->invalidate_step(psBrim);
|
||||||
@ -1079,7 +1080,6 @@ void PrintObject::_slice()
|
|||||||
{
|
{
|
||||||
this->clear_layers();
|
this->clear_layers();
|
||||||
// Object layers (pairs of bottom/top Z coordinate), without the raft.
|
// Object layers (pairs of bottom/top Z coordinate), without the raft.
|
||||||
this->update_layer_height_profile();
|
|
||||||
std::vector<coordf_t> object_layers = generate_object_layers(slicing_params, this->layer_height_profile);
|
std::vector<coordf_t> object_layers = generate_object_layers(slicing_params, this->layer_height_profile);
|
||||||
// Reserve object layers for the raft. Last layer of the raft is the contact layer.
|
// Reserve object layers for the raft. Last layer of the raft is the contact layer.
|
||||||
int id = int(slicing_params.raft_layers());
|
int id = int(slicing_params.raft_layers());
|
||||||
|
Loading…
Reference in New Issue
Block a user