mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-11-25 06:47:48 -05:00
Fix Slice sometimes needing a second click (#15180)
The GUI re-applies the unchanged config after every slice. filament_map, filament_volume_map and filament_nozzle_map are adopted from the new config but were left in full_config_diff, because the erase was commented out. That invalidated psGCodeExport on every reapply, so the slice that had just finished was thrown away. Erase them from full_config_diff too, including filament_nozzle_map in manual map mode.
This commit is contained in:
1 parent
b6ca378b23
commit
7125a546b8
2 files changed
+31
-3
No files matched your search
@@ -1522,7 +1522,7 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
|
||||
if (is_auto_filament_map_mode(map_mode)) {
|
||||
if (print_diff_set.find("filament_map") != print_diff_set.end()) {
|
||||
print_diff_set.erase("filament_map");
|
||||
//full_config_diff.erase("filament_map");
|
||||
full_config_diff.erase(std::remove(full_config_diff.begin(), full_config_diff.end(), "filament_map"), full_config_diff.end());
|
||||
ConfigOptionInts* old_opt = m_full_print_config.option<ConfigOptionInts>("filament_map", true);
|
||||
ConfigOptionInts* new_opt = new_full_config.option<ConfigOptionInts>("filament_map", true);
|
||||
old_opt->set(new_opt);
|
||||
@@ -1530,7 +1530,7 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
|
||||
}
|
||||
if (print_diff_set.find("filament_volume_map") != print_diff_set.end()) {
|
||||
print_diff_set.erase("filament_volume_map");
|
||||
//full_config_diff.erase("filament_volume_map");
|
||||
full_config_diff.erase(std::remove(full_config_diff.begin(), full_config_diff.end(), "filament_volume_map"), full_config_diff.end());
|
||||
ConfigOptionInts* old_opt = m_full_print_config.option<ConfigOptionInts>("filament_volume_map", true);
|
||||
ConfigOptionInts* new_opt = new_full_config.option<ConfigOptionInts>("filament_volume_map", true);
|
||||
old_opt->set(new_opt);
|
||||
@@ -1538,7 +1538,7 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
|
||||
}
|
||||
if (print_diff_set.find("filament_nozzle_map") != print_diff_set.end()) {
|
||||
print_diff_set.erase("filament_nozzle_map");
|
||||
//full_config_diff.erase("filament_nozzle_map");
|
||||
full_config_diff.erase(std::remove(full_config_diff.begin(), full_config_diff.end(), "filament_nozzle_map"), full_config_diff.end());
|
||||
ConfigOptionInts* old_opt = m_full_print_config.option<ConfigOptionInts>("filament_nozzle_map", true);
|
||||
ConfigOptionInts* new_opt = new_full_config.option<ConfigOptionInts>("filament_nozzle_map", true);
|
||||
old_opt->set(new_opt);
|
||||
@@ -1550,6 +1550,7 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
|
||||
if (map_mode == fmmManual) {
|
||||
// filament_nozzle_map is an engine output, not a GUI input, in manual mode
|
||||
print_diff_set.erase("filament_nozzle_map");
|
||||
full_config_diff.erase(std::remove(full_config_diff.begin(), full_config_diff.end(), "filament_nozzle_map"), full_config_diff.end());
|
||||
}
|
||||
std::vector<int> old_filament_map = m_config.filament_map.values;
|
||||
std::vector<int> new_filament_map = new_full_config.option<ConfigOptionInts>("filament_map", true)->values;
|
||||
|
||||
@@ -2137,6 +2137,33 @@ TEST_CASE("Unused extruder turns off on non-IMEX three-tool print", "[MultiFilam
|
||||
CHECK_FALSE(premature_s0_t2);
|
||||
}
|
||||
|
||||
// The GUI re-applies the unchanged config after every slice; that must not invalidate it.
|
||||
TEST_CASE("Reapplying an unchanged config after slicing reports no change", "[MultiFilament]") {
|
||||
DynamicPrintConfig config = multifilament_config(2, {
|
||||
{ "wall_filament", "1" },
|
||||
{ "sparse_infill_filament", "2" },
|
||||
{ "solid_infill_filament", "2" },
|
||||
{ "enable_prime_tower", "1" },
|
||||
{ "independent_support_layer_height", "1" },
|
||||
{ "wipe_tower_x", "50" },
|
||||
{ "wipe_tower_y", "50" },
|
||||
// init_print sets it, so the reapply differs only in what apply() itself normalizes.
|
||||
{ "gcode_comments", "1" },
|
||||
});
|
||||
Model model;
|
||||
Print print;
|
||||
Slic3r::Test::init_print({ TestMesh::cube_with_hole }, print, model, config);
|
||||
print.process();
|
||||
const bool ept_before = print.config().enable_prime_tower.value;
|
||||
const bool islh_before = print.config().independent_support_layer_height.value;
|
||||
|
||||
const auto status = print.apply(model, config);
|
||||
|
||||
CHECK(print.config().enable_prime_tower.value == ept_before);
|
||||
CHECK(print.config().independent_support_layer_height.value == islh_before);
|
||||
CHECK(status == PrintBase::APPLY_STATUS_UNCHANGED);
|
||||
}
|
||||
|
||||
static DynamicPrintConfig short_change_length_config() {
|
||||
DynamicPrintConfig config = multifilament_config(2, {
|
||||
// One value for two filaments: the tower must not read past it.
|
||||
|
||||
Reference in new issue
Block a user