From 088b92917c00e4b1abbd9b517705125f107201a6 Mon Sep 17 00:00:00 2001 From: supermerill Date: Sun, 26 Sep 2021 13:50:49 +0200 Subject: Add filament_max_overlap, to control the line spacing via filament setting It allows to control the spacing vs width (10%% fill vs a bit less) The 'enforce 100% fill volume' is also adjusted to take that into account Note that if you're using multiple extruders/filament everywhere (and spacing setting for width setting), the result may be a bit unexpected, as the gui can't display all the interactions, also some features (like support) may revert to default overlap value, if printed with multiple filaments. supermerill/SuperSlicer#1590 --- src/slic3r/GUI/ConfigManipulation.cpp | 2 +- src/slic3r/GUI/GCodeViewer.cpp | 2 +- src/slic3r/GUI/GLCanvas3D.cpp | 2 +- src/slic3r/GUI/GUI_ObjectList.cpp | 8 ++-- src/slic3r/GUI/GUI_ObjectSettings.cpp | 4 +- src/slic3r/GUI/GUI_Preview.cpp | 4 +- src/slic3r/GUI/Gizmos/GLGizmosManager.cpp | 2 +- src/slic3r/GUI/Plater.cpp | 8 ++-- src/slic3r/GUI/PresetComboBoxes.cpp | 2 +- src/slic3r/GUI/PresetHints.cpp | 63 +++++++++++++++++++++---------- src/slic3r/GUI/Tab.cpp | 51 +++++++++++++++++++------ src/slic3r/Utils/PresetUpdater.cpp | 8 ++-- 12 files changed, 102 insertions(+), 54 deletions(-) (limited to 'src/slic3r') diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index 532c5d29b..c115a5e2e 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -339,7 +339,7 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con new_conf.set_key_value("fill_pattern", new ConfigOptionEnum(ipRectilinear)); fill_density = 100; } else - fill_density = wxGetApp().preset_bundle->prints.get_selected_preset().config.option("fill_density")->value; + fill_density = wxGetApp().preset_bundle->fff_prints.get_selected_preset().config.option("fill_density")->value; new_conf.set_key_value("fill_density", new ConfigOptionPercent(fill_density)); apply(config, &new_conf); if (cb_value_change) diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index 2fc92f503..f020e739a 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -2778,7 +2778,7 @@ void GCodeViewer::load_shells(const Print& print, bool initialized) const PrintConfig& config = print.config(); size_t extruders_count = config.nozzle_diameter.size(); if ((extruders_count > 1) && config.wipe_tower && !config.complete_objects) { - const DynamicPrintConfig& print_config = wxGetApp().preset_bundle->prints.get_edited_preset().config; + const DynamicPrintConfig& print_config = wxGetApp().preset_bundle->fff_prints.get_edited_preset().config; double layer_height = print_config.opt_float("layer_height"); double first_layer_height = print_config.get_abs_value("first_layer_height", layer_height); double nozzle_diameter = print.config().nozzle_diameter.values[0]; diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 2157709e9..9abb4915e 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -2245,7 +2245,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re const Print *print = m_process->fff_print(); - const DynamicPrintConfig &print_config = wxGetApp().preset_bundle->prints.get_edited_preset().config; + const DynamicPrintConfig &print_config = wxGetApp().preset_bundle->fff_prints.get_edited_preset().config; double layer_height = print_config.opt_float("layer_height"); double first_layer_height = print_config.get_abs_value("first_layer_height", layer_height); double nozzle_diameter = print->config().nozzle_diameter.values[0]; diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 670d88661..a06231ef5 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -1495,9 +1495,7 @@ void ObjectList::get_settings_choice(const wxString& category_name) for (auto sel : selections) selected_options.push_back((*settings_list)[sel].first); - const DynamicPrintConfig& from_config = printer_technology() == ptFFF ? - wxGetApp().preset_bundle->prints.get_edited_preset().config : - wxGetApp().preset_bundle->sla_prints.get_edited_preset().config; + const DynamicPrintConfig& from_config = wxGetApp().preset_bundle->prints(printer_technology()).get_edited_preset().config; for (auto& setting : (*settings_list)) { @@ -1562,7 +1560,7 @@ void ObjectList::get_freq_settings_choice(const wxString& bundle_name) _(L("Add Settings Bundle for Object")); take_snapshot(snapshot_text); - const DynamicPrintConfig& from_config = wxGetApp().preset_bundle->prints.get_edited_preset().config; + const DynamicPrintConfig& from_config = wxGetApp().preset_bundle->prints(printer_technology()).get_edited_preset().config; for (auto& opt_key : options) { if (find(opt_keys.begin(), opt_keys.end(), opt_key) == opt_keys.end()) { @@ -2830,7 +2828,7 @@ DynamicPrintConfig ObjectList::get_default_layer_config(const int obj_idx) DynamicPrintConfig config; coordf_t layer_height = object(obj_idx)->config.has("layer_height") ? object(obj_idx)->config.opt_float("layer_height") : - wxGetApp().preset_bundle->prints.get_edited_preset().config.opt_float("layer_height"); + wxGetApp().preset_bundle->prints(printer_technology()).get_edited_preset().config.opt_float("layer_height"); config.set_key_value("layer_height",new ConfigOptionFloat(layer_height)); config.set_key_value("extruder", new ConfigOptionInt(0)); diff --git a/src/slic3r/GUI/GUI_ObjectSettings.cpp b/src/slic3r/GUI/GUI_ObjectSettings.cpp index dbd3bc4a9..d2217f2ab 100644 --- a/src/slic3r/GUI/GUI_ObjectSettings.cpp +++ b/src/slic3r/GUI/GUI_ObjectSettings.cpp @@ -212,9 +212,7 @@ void ObjectSettings::update_config_values(ModelConfig* config) return; // update config values according to configuration hierarchy - DynamicPrintConfig main_config = printer_technology == ptFFF ? - wxGetApp().preset_bundle->prints.get_edited_preset().config : - wxGetApp().preset_bundle->sla_prints.get_edited_preset().config; + DynamicPrintConfig main_config = wxGetApp().preset_bundle->prints(printer_technology).get_edited_preset().config; auto load_config = [this, config, &main_config]() { diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index 207b8f597..6a711f7f6 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -644,7 +644,7 @@ wxBoxSizer* Preview::create_layers_slider_sizer() m_layers_slider = new DoubleSlider::Control(this, wxID_ANY, 0, 0, 0, 100); m_layers_slider->SetDrawMode(wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA, - wxGetApp().preset_bundle->prints.get_edited_preset().config.opt_bool("complete_objects")); + wxGetApp().preset_bundle->fff_prints.get_edited_preset().config.opt_bool("complete_objects")); m_layers_slider->enable_action_icon(wxGetApp().is_editor()); sizer->Add(m_layers_slider, 0, wxEXPAND, 0); @@ -783,7 +783,7 @@ void Preview::update_layers_slider(const std::vector& layers_z, bool kee m_layers_slider->SetTicksValues(ticks_info_from_model); bool sla_print_technology = plater->printer_technology() == ptSLA; - bool sequential_print = wxGetApp().preset_bundle->prints.get_edited_preset().config.opt_bool("complete_objects"); + bool sequential_print = wxGetApp().preset_bundle->fff_prints.get_edited_preset().config.opt_bool("complete_objects"); m_layers_slider->SetDrawMode(sla_print_technology, sequential_print); m_layers_slider->SetExtruderColors(plater->get_extruder_colors_from_plater_config()); if (sla_print_technology) diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp index 266212877..a3b8af809 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp @@ -236,7 +236,7 @@ void GLGizmosManager::update_data() } else if (is_wipe_tower) { - DynamicPrintConfig& config = wxGetApp().preset_bundle->prints.get_edited_preset().config; + DynamicPrintConfig& config = wxGetApp().preset_bundle->fff_prints.get_edited_preset().config; set_scale(Vec3d::Ones()); set_rotation(Vec3d(0., 0., (M_PI/180.) * dynamic_cast(config.option("wipe_tower_rotation_angle"))->value)); set_flattening_data(nullptr); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index fcd568603..a3e099e5a 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -292,7 +292,7 @@ void FreqChangedParams::msw_rescale() FreqChangedParams::FreqChangedParams(wxWindow* parent) : OG_Settings(parent, false) { - DynamicPrintConfig* config = &wxGetApp().preset_bundle->prints.get_edited_preset().config; + DynamicPrintConfig* config = &wxGetApp().preset_bundle->fff_prints.get_edited_preset().config; // Frequently changed parameters for FFF_technology m_og->set_config(config); @@ -4660,7 +4660,7 @@ void Plater::priv::take_snapshot(const std::string& snapshot_name) //FIXME updating the Wipe tower config values at the ModelWipeTower from the Print config. // This is a workaround until we refactor the Wipe Tower position / orientation to live solely inside the Model, not in the Print config. if (this->printer_technology == ptFFF) { - const DynamicPrintConfig &config = wxGetApp().preset_bundle->prints.get_edited_preset().config; + const DynamicPrintConfig &config = wxGetApp().preset_bundle->fff_prints.get_edited_preset().config; model.wipe_tower.position = Vec2d(config.opt_float("wipe_tower_x"), config.opt_float("wipe_tower_y")); model.wipe_tower.rotation = config.opt_float("wipe_tower_rotation_angle"); } @@ -4716,7 +4716,7 @@ void Plater::priv::undo_redo_to(std::vector::const_iterator //FIXME updating the Wipe tower config values at the ModelWipeTower from the Print config. // This is a workaround until we refactor the Wipe Tower position / orientation to live solely inside the Model, not in the Print config. if (this->printer_technology == ptFFF) { - const DynamicPrintConfig &config = wxGetApp().preset_bundle->prints.get_edited_preset().config; + const DynamicPrintConfig &config = wxGetApp().preset_bundle->fff_prints.get_edited_preset().config; model.wipe_tower.position = Vec2d(config.opt_float("wipe_tower_x"), config.opt_float("wipe_tower_y")); model.wipe_tower.rotation = config.opt_float("wipe_tower_rotation_angle"); } @@ -4772,7 +4772,7 @@ void Plater::priv::undo_redo_to(std::vector::const_iterator //FIXME updating the Print config from the Wipe tower config values at the ModelWipeTower. // This is a workaround until we refactor the Wipe Tower position / orientation to live solely inside the Model, not in the Print config. if (this->printer_technology == ptFFF) { - const DynamicPrintConfig ¤t_config = wxGetApp().preset_bundle->prints.get_edited_preset().config; + const DynamicPrintConfig ¤t_config = wxGetApp().preset_bundle->fff_prints.get_edited_preset().config; Vec2d current_position(current_config.opt_float("wipe_tower_x"), current_config.opt_float("wipe_tower_y")); double current_rotation = current_config.opt_float("wipe_tower_rotation_angle"); if (current_position != model.wipe_tower.position || current_rotation != model.wipe_tower.rotation) { diff --git a/src/slic3r/GUI/PresetComboBoxes.cpp b/src/slic3r/GUI/PresetComboBoxes.cpp index d5ac676a9..e85b468c3 100644 --- a/src/slic3r/GUI/PresetComboBoxes.cpp +++ b/src/slic3r/GUI/PresetComboBoxes.cpp @@ -79,7 +79,7 @@ PresetComboBox::PresetComboBox(wxWindow* parent, Preset::Type preset_type, const switch (m_type) { case Preset::TYPE_FFF_PRINT: { - m_collection = &m_preset_bundle->prints; + m_collection = &m_preset_bundle->fff_prints; m_main_bitmap_name = "cog"; break; } diff --git a/src/slic3r/GUI/PresetHints.cpp b/src/slic3r/GUI/PresetHints.cpp index 0955bbcd9..74cab20a0 100644 --- a/src/slic3r/GUI/PresetHints.cpp +++ b/src/slic3r/GUI/PresetHints.cpp @@ -161,9 +161,9 @@ std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle // The current filament preset is not active for any extruder. idx_extruder = -1; - const DynamicPrintConfig &print_config = preset_bundle.prints .get_edited_preset().config; - const DynamicPrintConfig &filament_config = preset_bundle.filaments.get_edited_preset().config; - const DynamicPrintConfig &printer_config = preset_bundle.printers .get_edited_preset().config; + const DynamicPrintConfig &print_config = preset_bundle.fff_prints.get_edited_preset().config; + const DynamicPrintConfig &filament_config = preset_bundle.filaments .get_edited_preset().config; + const DynamicPrintConfig &printer_config = preset_bundle.printers .get_edited_preset().config; // Current printer values. float nozzle_diameter = (float)printer_config.opt_float("nozzle_diameter", idx_extruder); @@ -249,13 +249,15 @@ std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle } return (speed_normal > 0.) ? speed_normal : speed_max; }; + float filament_max_overlap = filament_config.get_computed_value("filament_max_overlap", std::max(0, idx_extruder)); if (perimeter_extruder_active) { Flow external_flow = Flow::new_from_config_width(frExternalPerimeter, first_positive(first_layer_extrusion_width_ptr, external_perimeter_extrusion_width, extrusion_width), - nozzle_diameter, lh, bfr); + nozzle_diameter, lh, + std::min(filament_max_overlap, (float)print_config.opt("external_perimeter_overlap")->get_abs_value(1)), + bfr); if (external_flow.height > external_flow.width) external_flow.height = external_flow.width; - external_flow.spacing_ratio = print_config.opt("external_perimeter_overlap")->get_abs_value(1); double external_perimeter_rate = external_flow.mm3_per_mm() * (bridging ? bridge_speed : limit_by_first_layer_speed(std::max(external_perimeter_speed, small_perimeter_speed), max_print_speed)); @@ -265,10 +267,11 @@ std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle } Flow perimeter_flow = Flow::new_from_config_width(frPerimeter, first_positive(first_layer_extrusion_width_ptr, perimeter_extrusion_width, extrusion_width), - nozzle_diameter, lh, bfr); + nozzle_diameter, lh, + std::min(filament_max_overlap, (float)print_config.opt("perimeter_overlap")->get_abs_value(1)), + bfr); if (perimeter_flow.height > perimeter_flow.width) perimeter_flow.height = perimeter_flow.width; - perimeter_flow.spacing_ratio = print_config.opt("perimeter_overlap")->get_abs_value(1); double perimeter_rate = perimeter_flow.mm3_per_mm() * (bridging ? bridge_speed : limit_by_first_layer_speed(std::max(perimeter_speed, small_perimeter_speed), max_print_speed)); @@ -280,7 +283,9 @@ std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle if (! bridging && infill_extruder_active) { Flow infill_flow = Flow::new_from_config_width(frInfill, first_positive(first_layer_extrusion_width_ptr, infill_extrusion_width, extrusion_width), - nozzle_diameter, lh, bfr); + nozzle_diameter, lh, + filament_max_overlap, + bfr); if (infill_flow.height > infill_flow.width) infill_flow.height = infill_flow.width; double infill_rate = infill_flow.mm3_per_mm() * limit_infill_by_first_layer_speed(infill_speed, max_print_speed); @@ -292,7 +297,9 @@ std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle if (solid_infill_extruder_active) { Flow solid_infill_flow = Flow::new_from_config_width(frInfill, first_positive(first_layer_extrusion_width_ptr, solid_infill_extrusion_width, extrusion_width), - nozzle_diameter, lh, 0); + nozzle_diameter, lh, + filament_max_overlap, + 0); if (solid_infill_flow.height > solid_infill_flow.width) solid_infill_flow.height = solid_infill_flow.width; double solid_infill_rate = solid_infill_flow.mm3_per_mm() * @@ -304,7 +311,9 @@ std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle if (! bridging) { Flow top_solid_infill_flow = Flow::new_from_config_width(frInfill, first_positive(first_layer_extrusion_width_ptr, top_infill_extrusion_width, extrusion_width), - nozzle_diameter, lh, bfr); + nozzle_diameter, lh, + filament_max_overlap, + bfr); if (top_solid_infill_flow.height > top_solid_infill_flow.width) top_solid_infill_flow.height = top_solid_infill_flow.width; double top_solid_infill_rate = top_solid_infill_flow.mm3_per_mm() * limit_infill_by_first_layer_speed(top_solid_infill_speed, max_print_speed); @@ -317,7 +326,9 @@ std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle if (support_material_extruder_active) { Flow support_material_flow = Flow::new_from_config_width(frSupportMaterial, first_positive(first_layer_extrusion_width_ptr, support_material_extrusion_width, extrusion_width), - nozzle_diameter, lh, bfr); + nozzle_diameter, lh, + filament_max_overlap, + bfr); if (support_material_flow.height > support_material_flow.width) support_material_flow.height = support_material_flow.width; double support_material_rate = support_material_flow.mm3_per_mm() * @@ -330,7 +341,9 @@ std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle if (support_material_interface_extruder_active) { Flow support_material_interface_flow = Flow::new_from_config_width(frSupportMaterialInterface, first_positive(first_layer_extrusion_width_ptr, support_material_extrusion_width, extrusion_width), - nozzle_diameter, lh, bfr); + nozzle_diameter, lh, + filament_max_overlap, + bfr); if (support_material_interface_flow.height > support_material_interface_flow.width) support_material_interface_flow.height = support_material_interface_flow.width; double support_material_interface_rate = support_material_interface_flow.mm3_per_mm() * @@ -363,7 +376,7 @@ std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle std::string PresetHints::recommended_thin_wall_thickness(const PresetBundle& preset_bundle) { - const DynamicPrintConfig& print_config = preset_bundle.prints.get_edited_preset().config; + const DynamicPrintConfig& print_config = preset_bundle.fff_prints.get_edited_preset().config; const DynamicPrintConfig& printer_config = preset_bundle.printers.get_edited_preset().config; float layer_height = float(print_config.opt_float("layer_height")); @@ -377,14 +390,22 @@ std::string PresetHints::recommended_thin_wall_thickness(const PresetBundle& pre return out; } + const DynamicPrintConfig& filament_config = preset_bundle.filaments.get_edited_preset().config; + float filament_max_overlap = filament_config.get_computed_value("filament_max_overlap", 0); Flow external_perimeter_flow = Flow::new_from_config_width( frExternalPerimeter, *print_config.opt("external_perimeter_extrusion_width"), - nozzle_diameter, layer_height, false); + nozzle_diameter, + layer_height, + filament_max_overlap, + false); Flow perimeter_flow = Flow::new_from_config_width( frPerimeter, *print_config.opt("perimeter_extrusion_width"), - nozzle_diameter, layer_height, false); + nozzle_diameter, + layer_height, + filament_max_overlap, + false); // failsafe for too big height if (external_perimeter_flow.height > external_perimeter_flow.width) @@ -421,7 +442,7 @@ std::string PresetHints::recommended_thin_wall_thickness(const PresetBundle& pre std::string PresetHints::recommended_extrusion_width(const PresetBundle& preset_bundle) { - const DynamicPrintConfig& print_config = preset_bundle.prints.get_edited_preset().config; + const DynamicPrintConfig& print_config = preset_bundle.fff_prints.get_edited_preset().config; const DynamicPrintConfig& printer_config = preset_bundle.printers.get_edited_preset().config; int nb_nozzles = printer_config.option("nozzle_diameter")->values.size(); @@ -434,8 +455,10 @@ std::string PresetHints::recommended_extrusion_width(const PresetBundle& preset_ std::string out; - Flow first_layer_flow = Flow::new_from_spacing(nozzle_diameter, nozzle_diameter, first_layer_height, false); - Flow layer_flow = Flow::new_from_spacing(nozzle_diameter, nozzle_diameter, layer_height, false); + const DynamicPrintConfig& filament_config = preset_bundle.filaments.get_edited_preset().config; + float filament_max_overlap = filament_config.get_computed_value("filament_max_overlap", 0); + Flow first_layer_flow = Flow::new_from_spacing(nozzle_diameter, nozzle_diameter, first_layer_height, filament_max_overlap, false); + Flow layer_flow = Flow::new_from_spacing(nozzle_diameter, nozzle_diameter, layer_height, filament_max_overlap, false); out += _utf8(L("Ideally, the spacing between two extrusions shouldn't be lower than the nozzle diameter. Below are the extrusion widths for a spacing equal to the nozzle diameter.\n")); out += (boost::format(_utf8(L("Recommended min extrusion width for the first layer (with a first layer height of %1%) is %2$.3f mm (or %3%%%)\n"))) @@ -452,8 +475,8 @@ std::string PresetHints::recommended_extrusion_width(const PresetBundle& preset_ // on the active layer height. std::string PresetHints::top_bottom_shell_thickness_explanation(const PresetBundle &preset_bundle) { - const DynamicPrintConfig &print_config = preset_bundle.prints .get_edited_preset().config; - const DynamicPrintConfig &printer_config = preset_bundle.printers .get_edited_preset().config; + const DynamicPrintConfig &print_config = preset_bundle.fff_prints.get_edited_preset().config; + const DynamicPrintConfig &printer_config = preset_bundle.printers .get_edited_preset().config; std::string out; diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 5ea82a7dd..bb451140e 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1187,20 +1187,47 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value) //wxGetApp().preset_bundle->value_changed(opt_key); // update phony fields - if (m_config->value_changed(opt_key, { wxGetApp().plater()->config() })) { + + //auto thing = wxGetApp().plater()-> + std::set changed = m_config->value_changed(opt_key, { + &wxGetApp().preset_bundle->prints(wxGetApp().plater()->printer_technology()).get_edited_preset().config, + &wxGetApp().preset_bundle->materials(wxGetApp().plater()->printer_technology()).get_edited_preset().config, + &wxGetApp().preset_bundle->printers.get_edited_preset().config, + /*&wxGetApp().preset_bundle->full_config()*/ }); + if (changed.find(m_config) != changed.end()) { update_dirty(); //# Initialize UI components with the config values. reload_config(); } + if (changed.find(&wxGetApp().preset_bundle->fff_prints.get_edited_preset().config) != changed.end()) { + wxGetApp().get_tab(Preset::Type::TYPE_FFF_PRINT)->update_dirty(); + wxGetApp().get_tab(Preset::Type::TYPE_FFF_PRINT)->reload_config(); + } + if (changed.find(&wxGetApp().preset_bundle->sla_prints.get_edited_preset().config) != changed.end()) { + wxGetApp().get_tab(Preset::Type::TYPE_SLA_PRINT)->update_dirty(); + wxGetApp().get_tab(Preset::Type::TYPE_SLA_PRINT)->reload_config(); + } + if (changed.find(&wxGetApp().preset_bundle->filaments.get_edited_preset().config) != changed.end()) { + wxGetApp().get_tab(Preset::Type::TYPE_FFF_FILAMENT)->update_dirty(); + wxGetApp().get_tab(Preset::Type::TYPE_FFF_FILAMENT)->reload_config(); + } + if (changed.find(&wxGetApp().preset_bundle->sla_materials.get_edited_preset().config) != changed.end()) { + wxGetApp().get_tab(Preset::Type::TYPE_SLA_MATERIAL)->update_dirty(); + wxGetApp().get_tab(Preset::Type::TYPE_SLA_MATERIAL)->reload_config(); + } + if (changed.find(&wxGetApp().preset_bundle->printers.get_edited_preset().config) != changed.end()) { + wxGetApp().get_tab(Preset::Type::TYPE_PRINTER)->update_dirty(); + wxGetApp().get_tab(Preset::Type::TYPE_PRINTER)->reload_config(); + } update(); } // Show/hide the 'purging volumes' button void Tab::update_wiping_button_visibility() { - if (m_preset_bundle->printers.get_selected_preset().printer_technology() == ptSLA) + if (m_preset_bundle->printers.get_selected_preset().printer_technology() != ptFFF) return; // ys_FIXME - bool wipe_tower_enabled = dynamic_cast( (m_preset_bundle->prints.get_edited_preset().config ).option("wipe_tower"))->value; + bool wipe_tower_enabled = dynamic_cast( (m_preset_bundle->fff_prints.get_edited_preset().config ).option("wipe_tower"))->value; bool multiple_extruders = dynamic_cast((m_preset_bundle->printers.get_edited_preset().config).option("nozzle_diameter"))->values.size() > 1; auto wiping_dialog_button = wxGetApp().sidebar().get_wiping_dialog_button(); @@ -2129,7 +2156,7 @@ bool Tab::create_pages(std::string setting_type_name, int idx_page) void TabPrint::build() { - m_presets = &m_preset_bundle->prints; + m_presets = &m_preset_bundle->fff_prints; load_initial_data(); if (create_pages("print.ui")) return; @@ -3128,7 +3155,11 @@ void Tab::load_current_preset() //update width/spacing links if (m_type == Preset::TYPE_FFF_PRINT) { //verify that spacings are set - if (m_config && m_config->update_phony({ wxGetApp().plater()->config() })) { + if (m_config && !m_config->update_phony({ + &wxGetApp().preset_bundle->prints(wxGetApp().plater()->printer_technology()).get_edited_preset().config, + &wxGetApp().preset_bundle->materials(wxGetApp().plater()->printer_technology()).get_edited_preset().config, + &wxGetApp().preset_bundle->printers.get_edited_preset().config + }).empty()) { update_dirty(); reload_config(); } @@ -3273,9 +3304,9 @@ void Tab::select_preset(std::string preset_name, bool delete_current /*=false*/, bool new_preset_compatible; }; std::vector updates = { - { Preset::Type::TYPE_FFF_PRINT, &m_preset_bundle->prints, ptFFF }, + { Preset::Type::TYPE_FFF_PRINT, &m_preset_bundle->fff_prints, ptFFF }, { Preset::Type::TYPE_SLA_PRINT, &m_preset_bundle->sla_prints, ptSLA }, - { Preset::Type::TYPE_FFF_FILAMENT, &m_preset_bundle->filaments, ptFFF }, + { Preset::Type::TYPE_FFF_FILAMENT, &m_preset_bundle->filaments, ptFFF }, { Preset::Type::TYPE_SLA_MATERIAL, &m_preset_bundle->sla_materials,ptSLA } }; for (PresetUpdate &pu : updates) { @@ -3382,8 +3413,7 @@ void Tab::select_preset(std::string preset_name, bool delete_current /*=false*/, wxGetApp().mainframe->plater()->canvas3D()->set_arrange_settings(m_presets->get_edited_preset().config, m_presets->get_edited_preset().printer_technology()); } if (m_type == Preset::TYPE_PRINTER) { - wxGetApp().mainframe->plater()->canvas3D()->set_arrange_settings(m_preset_bundle->prints.get_edited_preset().config, m_presets->get_edited_preset().printer_technology()); - + wxGetApp().mainframe->plater()->canvas3D()->set_arrange_settings(m_preset_bundle->prints(m_presets->get_edited_preset().printer_technology()).get_edited_preset().config, m_presets->get_edited_preset().printer_technology()); } } @@ -3805,8 +3835,7 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep { // Collect names of non-default non-external profiles. PrinterTechnology printer_technology = m_preset_bundle->printers.get_edited_preset().printer_technology(); - PresetCollection &depending_presets = (deps.type == Preset::TYPE_PRINTER) ? m_preset_bundle->printers : - (printer_technology == ptFFF) ? m_preset_bundle->prints : m_preset_bundle->sla_prints; + PresetCollection &depending_presets = (deps.type == Preset::TYPE_PRINTER) ? m_preset_bundle->printers : m_preset_bundle->prints(printer_technology); wxArrayString presets; for (size_t idx = 0; idx < depending_presets.size(); ++ idx) { diff --git a/src/slic3r/Utils/PresetUpdater.cpp b/src/slic3r/Utils/PresetUpdater.cpp index 076504243..bf952bb8c 100644 --- a/src/slic3r/Utils/PresetUpdater.cpp +++ b/src/slic3r/Utils/PresetUpdater.cpp @@ -677,21 +677,21 @@ bool PresetUpdater::priv::perform_updates(Updates &&updates, bool snapshot) cons // Throw when parsing invalid configuration. Only valid configuration is supposed to be provided over the air. bundle.load_configbundle(update.source.string(), PresetBundle::LoadConfigBundleAttribute::LoadSystem, ForwardCompatibilitySubstitutionRule::Disable); - BOOST_LOG_TRIVIAL(info) << format("Deleting %1% conflicting presets", bundle.prints.size() + bundle.filaments.size() + bundle.printers.size()); + BOOST_LOG_TRIVIAL(info) << format("Deleting %1% conflicting presets", bundle.fff_prints.size() + bundle.filaments.size() + bundle.printers.size()); auto preset_remover = [](const Preset &preset) { BOOST_LOG_TRIVIAL(info) << '\t' << preset.file; fs::remove(preset.file); }; - for (const auto &preset : bundle.prints) { preset_remover(preset); } + for (const auto &preset : bundle.fff_prints){ preset_remover(preset); } for (const auto &preset : bundle.filaments) { preset_remover(preset); } for (const auto &preset : bundle.printers) { preset_remover(preset); } // Also apply the `obsolete_presets` property, removing obsolete ini files BOOST_LOG_TRIVIAL(info) << format("Deleting %1% obsolete presets", - bundle.obsolete_presets.prints.size() + bundle.obsolete_presets.filaments.size() + bundle.obsolete_presets.printers.size()); + bundle.obsolete_presets.fff_prints.size() + bundle.obsolete_presets.filaments.size() + bundle.obsolete_presets.printers.size()); auto obsolete_remover = [](const char *subdir, const std::string &preset) { auto path = fs::path(Slic3r::data_dir()) / subdir / preset; @@ -700,7 +700,7 @@ bool PresetUpdater::priv::perform_updates(Updates &&updates, bool snapshot) cons fs::remove(path); }; - for (const auto &name : bundle.obsolete_presets.prints) { obsolete_remover("print", name); } + for (const auto &name : bundle.obsolete_presets.fff_prints) { obsolete_remover("print", name); } for (const auto &name : bundle.obsolete_presets.filaments) { obsolete_remover("filament", name); } for (const auto &name : bundle.obsolete_presets.sla_prints) { obsolete_remover("sla_print", name); } for (const auto &name : bundle.obsolete_presets.sla_materials/*filaments*/) { obsolete_remover("sla_material", name); } -- cgit v1.2.3