update libslic3r

This commit is contained in:
QIDI TECH
2024-11-28 15:12:18 +08:00
parent 459e7822db
commit a26696f35e
115 changed files with 15117 additions and 4090 deletions

View File

@@ -495,11 +495,11 @@ void Preset::remove_files()
}
//QDS: add logic for only difference save
void Preset::save(DynamicPrintConfig* parent_config)
bool Preset::save(DynamicPrintConfig* parent_config)
{
//QDS: add project embedded preset logic
if (this->is_project_embedded)
return;
return false;
//QDS: change to json format
//this->config.save(this->file);
std::string from_str;
@@ -512,7 +512,11 @@ void Preset::save(DynamicPrintConfig* parent_config)
else
from_str = std::string("Default");
boost::filesystem::create_directories(fs::path(this->file).parent_path());
boost::system::error_code ec;
if (!boost::filesystem::exists(fs::path(this->file).parent_path()) && !boost::filesystem::create_directories(fs::path(this->file).parent_path(), ec)) {
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << " create directory failed: " << this->file << " " << ec.message();
return false;
}
//QDS: only save difference if it has parent
if (parent_config) {
@@ -538,6 +542,7 @@ void Preset::save(DynamicPrintConfig* parent_config)
fs::path idx_file(this->file);
idx_file.replace_extension(".info");
this->save_info(idx_file.string());
return true;
}
void Preset::reload(Preset const &parent)
@@ -802,7 +807,7 @@ static std::vector<std::string> s_Preset_print_options {
"seam_position", "wall_sequence", "is_infill_first", "sparse_infill_density", "sparse_infill_pattern", "sparse_infill_anchor", "sparse_infill_anchor_max",
"top_surface_pattern", "bottom_surface_pattern", "internal_solid_infill_pattern", "infill_direction", "bridge_angle",
"minimum_sparse_infill_area", "reduce_infill_retraction", "ironing_pattern", "ironing_type",
"ironing_flow", "ironing_speed", "ironing_spacing","ironing_direction",
"ironing_flow", "ironing_speed", "ironing_spacing","ironing_direction", "ironing_inset",
"max_travel_detour_distance",
"fuzzy_skin", "fuzzy_skin_thickness", "fuzzy_skin_point_distance",
#ifdef HAS_PRESSURE_EQUALIZER
@@ -833,9 +838,8 @@ static std::vector<std::string> s_Preset_print_options {
"wipe_tower_no_sparse_layers", "compatible_printers", "compatible_printers_condition", "inherits",
"flush_into_infill", "flush_into_objects", "flush_into_support","process_notes",
// QDS
"tree_support_branch_angle", "tree_support_wall_count", "tree_support_branch_distance",
//1.9.5
"tree_support_branch_diameter",
"tree_support_branch_angle", "tree_support_wall_count", "tree_support_branch_distance", "tree_support_branch_diameter",
"tree_support_branch_diameter_angle",
"detect_narrow_internal_solid_infill",
"gcode_add_line_number", "enable_arc_fitting", "precise_z_height", "infill_combination", /*"adaptive_layer_height",*/
//1.9.5
@@ -851,8 +855,8 @@ static std::vector<std::string> s_Preset_print_options {
// calib
"print_flow_ratio",
//Orca
"exclude_object", "seam_slope_type", "seam_slope_conditional", "scarf_angle_threshold", "seam_slope_start_height", "seam_slope_entire_loop", "seam_slope_min_length",
"seam_slope_steps", "seam_slope_inner_walls"
"exclude_object", /*"seam_slope_type",*/ "seam_slope_conditional", "scarf_angle_threshold", /*"seam_slope_start_height", */"seam_slope_entire_loop",/* "seam_slope_min_length",*/
"seam_slope_steps", "seam_slope_inner_walls", "role_base_wipe_speed"/*, "seam_slope_gap"*/
//w16
,"resonance_avoidance", "min_resonance_avoidance_speed", "max_resonance_avoidance_speed"
//w13
@@ -860,16 +864,17 @@ static std::vector<std::string> s_Preset_print_options {
};
static std::vector<std::string> s_Preset_filament_options {
/*"filament_colour", */ "default_filament_colour","required_nozzle_HRC","filament_diameter", "filament_type", "filament_soluble", "filament_is_support",
/*"filament_colour", */ "default_filament_colour","required_nozzle_HRC","filament_diameter", "filament_type", "filament_soluble", "filament_is_support","filament_scarf_seam_type", "filament_scarf_height", "filament_scarf_gap","filament_scarf_length",
"filament_max_volumetric_speed",
"filament_flow_ratio", "filament_density", "filament_cost", "filament_minimal_purge_on_wipe_tower",
"nozzle_temperature", "nozzle_temperature_initial_layer",
// QDS
"cool_plate_temp", "eng_plate_temp", "hot_plate_temp", "textured_plate_temp", "cool_plate_temp_initial_layer", "eng_plate_temp_initial_layer", "hot_plate_temp_initial_layer","textured_plate_temp_initial_layer",
"supertack_plate_temp_initial_layer", "supertack_plate_temp",
// "bed_type",
//QDS:temperature_vitrification
"temperature_vitrification", "reduce_fan_stop_start_freq", "slow_down_for_layer_cooling", "fan_min_speed",
"fan_max_speed", "enable_overhang_bridge_fan", "overhang_fan_speed", "overhang_fan_threshold", "close_fan_the_first_x_layers", "full_fan_speed_layer", "fan_cooling_layer_time", "slow_down_layer_time", "slow_down_min_speed",
"fan_max_speed", "enable_overhang_bridge_fan", "overhang_fan_speed", "overhang_fan_threshold", "overhang_threshold_participating_cooling","close_fan_the_first_x_layers", "full_fan_speed_layer", "fan_cooling_layer_time", "slow_down_layer_time", "slow_down_min_speed",
"filament_start_gcode", "filament_end_gcode",
//exhaust fan control
"activate_air_filtration","during_print_exhaust_fan_speed","complete_print_exhaust_fan_speed",
@@ -883,7 +888,7 @@ static std::vector<std::string> s_Preset_filament_options {
"nozzle_temperature_range_low", "nozzle_temperature_range_high",
//OrcaSlicer
"enable_pressure_advance", "pressure_advance", "chamber_temperatures","filament_notes",
"filament_long_retractions_when_cut","filament_retraction_distances_when_cut",
"filament_long_retractions_when_cut","filament_retraction_distances_when_cut","filament_shrink",
//w13
"additional_cooling_fan_speed_unseal"
//w14
@@ -902,7 +907,7 @@ static std::vector<std::string> s_Preset_printer_options {
"printer_technology",
"printable_area", "bed_exclude_area","bed_custom_texture", "bed_custom_model", "gcode_flavor",
"single_extruder_multi_material", "machine_start_gcode", "machine_end_gcode","printing_by_object_gcode","before_layer_change_gcode", "layer_change_gcode", "time_lapse_gcode", "change_filament_gcode",
"printer_model", "printer_variant", "printable_height", "extruder_clearance_radius", "extruder_clearance_max_radius","extruder_clearance_height_to_lid", "extruder_clearance_height_to_rod",
"printer_model", "printer_variant", "printable_height", "extruder_clearance_dist_to_rod", "extruder_clearance_max_radius","extruder_clearance_height_to_lid", "extruder_clearance_height_to_rod",
"nozzle_height",
"default_print_profile", "inherits",
"silent_mode",
@@ -1342,6 +1347,14 @@ int PresetCollection::get_differed_values_to_update(Preset& preset, std::map<std
<< " and base_id is: " << preset.base_id;
key_values[QDT_JSON_KEY_UPDATE_TIME] = std::to_string(preset.updated_time);
key_values[QDT_JSON_KEY_TYPE] = Preset::get_iot_type_string(preset.type);
int update_size = 0;
for (const auto &pair : key_values) {
update_size += pair.first.size();
update_size += pair.second.size();
}
if (update_size > 350 * 1024) return -2;
return 0;
}
@@ -1496,7 +1509,10 @@ void PresetCollection::set_sync_info_and_save(std::string name, std::string sett
preset->setting_id = setting_id;
if (update_time > 0)
preset->updated_time = update_time;
preset->sync_info == "update" ? preset->save(nullptr) : preset->save_info();
if (preset->sync_info == "update")
preset->save(nullptr);
else
preset->save_info();
break;
}
}
@@ -2254,7 +2270,7 @@ std::map<std::string, std::vector<Preset const *>> PresetCollection::get_filamen
}
//QDS: add project embedded preset logic
void PresetCollection::save_current_preset(const std::string &new_name, bool detach, bool save_to_project, Preset* _curr_preset)
void PresetCollection::save_current_preset(const std::string &new_name, bool detach, bool save_to_project, Preset *_curr_preset, std::map<std::string, std::string> *extra_map)
{
Preset curr_preset = _curr_preset ? *_curr_preset : m_edited_preset;
//QDS: add lock logic for sync preset in background
@@ -2293,8 +2309,14 @@ void PresetCollection::save_current_preset(const std::string &new_name, bool det
preset.config.option<ConfigOptionString>("print_settings_id", true)->value = new_name;
else if (m_type == Preset::TYPE_FILAMENT)
preset.config.option<ConfigOptionStrings>("filament_settings_id", true)->values[0] = new_name;
else if (m_type == Preset::TYPE_PRINTER)
else if (m_type == Preset::TYPE_PRINTER) {
preset.config.option<ConfigOptionString>("printer_settings_id", true)->value = new_name;
if (extra_map) {
for (auto iter : *extra_map) {
preset.config.option<ConfigOptionString>(iter.first, true)->value = iter.second;
}
}
}
final_inherits = preset.inherits();
unlock();
// TODO: apply change from custom root to devided presets.
@@ -2338,8 +2360,14 @@ void PresetCollection::save_current_preset(const std::string &new_name, bool det
preset.config.option<ConfigOptionString>("print_settings_id", true)->value = new_name;
else if (m_type == Preset::TYPE_FILAMENT)
preset.config.option<ConfigOptionStrings>("filament_settings_id", true)->values[0] = new_name;
else if (m_type == Preset::TYPE_PRINTER)
else if (m_type == Preset::TYPE_PRINTER) {
preset.config.option<ConfigOptionString>("printer_settings_id", true)->value = new_name;
if (extra_map) {
for (auto iter : *extra_map) {
preset.config.option<ConfigOptionString>(iter.first, true)->value = iter.second;
}
}
}
//QDS: add lock logic for sync preset in background
final_inherits = inherits;
unlock();
@@ -2688,6 +2716,7 @@ inline t_config_option_keys deep_diff(const ConfigBase &config_this, const Confi
case coFloats: add_correct_opts_to_diff<ConfigOptionFloats >(opt_key, diff, config_other, config_this); break;
case coStrings: add_correct_opts_to_diff<ConfigOptionStrings >(opt_key, diff, config_other, config_this); break;
case coPercents:add_correct_opts_to_diff<ConfigOptionPercents >(opt_key, diff, config_other, config_this); break;
case coFloatsOrPercents: add_correct_opts_to_diff<ConfigOptionFloatsOrPercents>(opt_key, diff, config_other, config_this); break;
case coPoints: add_correct_opts_to_diff<ConfigOptionPoints >(opt_key, diff, config_other, config_this); break;
// QDS
case coEnums: add_correct_opts_to_diff<ConfigOptionInts >(opt_key, diff, config_other, config_this); break;