From 2fae23a51294e5ba3d5970ad8c97a60b4db81ebe Mon Sep 17 00:00:00 2001 From: remi durand Date: Wed, 23 Jun 2021 18:40:11 +0200 Subject: [PATCH] fix Seam Travel Cost not saved/loaded supermerill/SuperSlicer#1352 --- src/libslic3r/GCode/SeamPlacer.cpp | 4 ++++ src/libslic3r/PrintConfig.cpp | 9 +++++---- src/libslic3r/PrintConfig.hpp | 5 ++--- src/slic3r/GUI/ConfigManipulation.cpp | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/libslic3r/GCode/SeamPlacer.cpp b/src/libslic3r/GCode/SeamPlacer.cpp index d6fb9edca..07c4b04e8 100644 --- a/src/libslic3r/GCode/SeamPlacer.cpp +++ b/src/libslic3r/GCode/SeamPlacer.cpp @@ -394,6 +394,10 @@ Point SeamPlacer::get_seam(const Layer& layer, SeamPosition seam_position, last_pos_weight = 5.f; travel_cost = 0; }else if (seam_position == spNearest) { + last_pos_weight = 25.f; + travel_cost = 0; + angle_weight = 0; + }else if (seam_position == spCost) { // last_pos already contains current nozzle position // set base last_pos_weight to the same value as penaltyFlatSurface last_pos_weight = 5.f; diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index a223505cf..3a7d48b78 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -3177,7 +3177,7 @@ void PrintConfigDef::init_fff_params() def->tooltip = L("Position of perimeters' starting points." "\n "); def->enum_keys_map = &ConfigOptionEnum::get_enum_values(); - def->enum_values.push_back("near"); + def->enum_values.push_back("cost"); def->enum_values.push_back("random"); def->enum_values.push_back("aligned"); def->enum_values.push_back("rear"); @@ -3186,7 +3186,7 @@ void PrintConfigDef::init_fff_params() def->enum_labels.push_back(L("Aligned")); def->enum_labels.push_back(L("Rear")); def->mode = comSimple; - def->set_default_value(new ConfigOptionEnum(spNearest)); + def->set_default_value(new ConfigOptionEnum(spCost)); def = this->add("seam_angle_cost", coPercent); def->label = L("Angle cost"); @@ -5296,7 +5296,8 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va if (value == "hidden") { opt_key = "seam_travel_cost"; value = "20%"; - } + }else if ("near" == value || "nearest" == value ) + value = "cost"; } else if (opt_key == "overhangs") { opt_key = "overhangs_width_speed"; if (value == "1") @@ -5521,7 +5522,7 @@ void PrintConfigDef::to_prusa(t_config_option_key& opt_key, std::string& value, value = "concentric"; } } else if ("seam_position" == opt_key) { - if ("seam_travel_cost" == value || "near" == value || "hidden" == value) { + if ("cost" == value) { value = "nearest"; } } else if ("first_layer_size_compensation" == opt_key) { diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 45a1f4f81..0bccab020 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -109,7 +109,7 @@ enum SupportMaterialPattern { }; enum SeamPosition { - spRandom, spNearest, spAligned, spRear, spCustom + spRandom, spNearest, spAligned, spRear, spCustom, spCost }; enum SLAMaterial { @@ -293,10 +293,9 @@ template<> inline const t_config_enum_values& ConfigOptionEnum::ge static t_config_enum_values keys_map{ {"random", spRandom}, {"nearest", spNearest}, - {"near", spNearest}, + {"cost", spCost}, {"aligned", spAligned}, {"rear", spRear}, - {"hidden", spNearest}, {"custom", spCustom}, }; return keys_map; diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index 51f59cc47..ef6df2ada 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -373,7 +373,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config) toggle_field(el, have_perimeters && config->opt_bool("thin_walls")); for (auto el : { "seam_angle_cost", "seam_travel_cost" }) - toggle_field(el, have_perimeters && config->option>("seam_position")->value == SeamPosition::spNearest); + toggle_field(el, have_perimeters && config->option>("seam_position")->value == SeamPosition::spCost); toggle_field("perimeter_loop_seam", config->opt_bool("perimeter_loop"));