From 919f5906e563b892bf20e00b883ba28dfcc4a8e3 Mon Sep 17 00:00:00 2001 From: cjw Date: Mon, 30 Jun 2025 17:23:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=85=8D=E7=BD=AE=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E4=B8=8B=E6=8B=89=E6=A1=86=E4=B8=8D=E6=AD=A3=E5=B8=B8?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82=E5=96=B7=E5=A4=B4=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E8=80=97=E6=9D=90=E5=88=A4=E6=96=AD=EF=BC=88=E6=9A=82?= =?UTF-8?q?=E5=AE=9A=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libslic3r/Fill/Fill.cpp | 11 +- libslic3r/PresetBundle.cpp | 37 +++-- slic3r/GUI/CreatePresetsDialog.cpp | 3 +- slic3r/GUI/FilamentMapPanel.cpp | 4 + slic3r/GUI/Plater.cpp | 14 +- slic3r/GUI/PresetComboBoxes.cpp | 211 ++++++++++++++++++++--------- slic3r/GUI/Tab.cpp | 41 +++--- slic3r/GUI/Tab.hpp | 2 +- 8 files changed, 222 insertions(+), 101 deletions(-) diff --git a/libslic3r/Fill/Fill.cpp b/libslic3r/Fill/Fill.cpp index e7c5384..a28ee6e 100644 --- a/libslic3r/Fill/Fill.cpp +++ b/libslic3r/Fill/Fill.cpp @@ -17,7 +17,7 @@ #include "FillFloatingConcentric.hpp" #define NARROW_INFILL_AREA_THRESHOLD 3 -//#define SLIC3R_DEBUG_SLICE_PROCESSING +#define SLIC3R_DEBUG_SLICE_PROCESSING namespace Slic3r { @@ -581,6 +581,15 @@ void Layer::make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive: export_group_fills_to_svg(filename.c_str(), surface_fills); } #endif /* SLIC3R_DEBUG_SLICE_PROCESSING */ + /* if (surface_fills[0].params.pattern == ipFiberSpiral) { + int fill_size = surface_fills.size(); + for (int i = 1; i < fill_size; i++) { + SurfaceFill& surface_fill = surface_fills[i]; + for (ExPolygon& expoly : surface_fill.expolygons) { + + } + } + }*/ for (SurfaceFill& surface_fill : surface_fills) { // Create the filler object. diff --git a/libslic3r/PresetBundle.cpp b/libslic3r/PresetBundle.cpp index 6588415..6ce1140 100644 --- a/libslic3r/PresetBundle.cpp +++ b/libslic3r/PresetBundle.cpp @@ -159,7 +159,7 @@ void PresetBundle::reset(bool delete_files) this->filaments .reset(delete_files); this->sla_materials.reset(delete_files); this->printers .reset(delete_files); - this->configs.reset(delete_files); + this->configs .reset(delete_files); // BBS: filament_presets is load from project config, not handled here //this->filament_presets.clear(); if (this->filament_presets.empty()) @@ -399,8 +399,7 @@ PresetsConfigSubstitutions PresetBundle::load_project_embedded_presets(std::vect } try { this->configs.load_project_embedded_presets(project_presets, PRESET_CONFIG_NAME, substitutions, substitution_rule); - } - catch (const std::runtime_error& err) { + } catch (const std::runtime_error& err) { errors_cummulative += err.what(); } @@ -618,8 +617,7 @@ PresetsConfigSubstitutions PresetBundle::load_user_presets(std::string user, For std::string config_selected_preset_name = configs.get_selected_preset().name; this->configs.load_presets(dir_user_presets, PRESET_CONFIG_NAME, substitutions, substitution_rule); configs.select_preset_by_name(config_selected_preset_name, false); - } - catch (const std::runtime_error& err) { + } catch (const std::runtime_error& err) { errors_cummulative += err.what(); } if (!errors_cummulative.empty()) throw Slic3r::RuntimeError(errors_cummulative); @@ -1437,18 +1435,18 @@ std::vector PresetBundle::merge_presets(PresetBundle &&other) std::vector duplicate_filaments = this->filaments .merge_presets(std::move(other.filaments), this->vendors); std::vector duplicate_sla_materials = this->sla_materials.merge_presets(std::move(other.sla_materials), this->vendors); std::vector duplicate_printers = this->printers .merge_presets(std::move(other.printers), this->vendors); - std::vector duplicate_configs = this->configs .merge_presets(std::move(other.configs), this->vendors); + //std::vector duplicate_configs = this->configs .merge_presets(std::move(other.configs), this->vendors); append(this->obsolete_presets.prints, std::move(other.obsolete_presets.prints)); append(this->obsolete_presets.sla_prints, std::move(other.obsolete_presets.sla_prints)); append(this->obsolete_presets.filaments, std::move(other.obsolete_presets.filaments)); append(this->obsolete_presets.sla_materials, std::move(other.obsolete_presets.sla_materials)); append(this->obsolete_presets.printers, std::move(other.obsolete_presets.printers)); - append(this->obsolete_presets.configs, std::move(other.obsolete_presets.configs)); + //append(this->obsolete_presets.configs, std::move(other.obsolete_presets.configs)); append(duplicate_prints, std::move(duplicate_sla_prints)); append(duplicate_prints, std::move(duplicate_filaments)); append(duplicate_prints, std::move(duplicate_sla_materials)); append(duplicate_prints, std::move(duplicate_printers)); - append(duplicate_configs, std::move(duplicate_configs)); + //append(duplicate_configs, std::move(duplicate_configs)); return duplicate_prints; } @@ -1644,38 +1642,48 @@ void PresetBundle::load_installed_sla_materials(AppConfig &config) // Load selections (current print, current filaments, current printer) from config.ini // This is done on application start up or after updates are applied. +//从config.ini加载选择(当前打印、当前灯丝、当前打印机) +//这是在应用程序启动时或应用更新后完成的。 void PresetBundle::load_selections(AppConfig &config, const PresetPreferences& preferred_selection/* = PresetPreferences()*/) { BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": enter, preferred printer_model_id %1%")%preferred_selection.printer_model_id; // Update visibility of presets based on application vendor / model / variant configuration. + //根据应用程序供应商/型号/变体配置更新预设的可见性。 this->load_installed_printers(config); // Update visibility of filament and sla material presets + //更新灯丝和sla材料预设的可见性 this->load_installed_filaments(config); this->load_installed_sla_materials(config); this->load_installed_configs(config); // Parse the initial print / filament / printer profile names. + //解析初始打印/灯丝/打印机配置文件名称。 std::string initial_print_profile_name = remove_ini_suffix(config.get("presets", PRESET_PRINT_NAME)); std::string initial_sla_print_profile_name = remove_ini_suffix(config.get("presets", PRESET_SLA_PRINT_NAME)); std::string initial_filament_profile_name = remove_ini_suffix(config.get("presets", PRESET_FILAMENT_NAME)); std::string initial_sla_material_profile_name = remove_ini_suffix(config.get("presets", PRESET_SLA_MATERIALS_NAME)); std::string initial_printer_profile_name = remove_ini_suffix(config.get("presets", PRESET_PRINTER_NAME)); - std::string initial_config_profile_name = remove_ini_suffix(config.get("presets", PRESET_CONFIG_NAME)); + std::string initial_config_profile_name = remove_ini_suffix(config.get("presets", PRESET_CONFIG_NAME)); // Activate print / filament / printer profiles from either the config, // or from the preferred_model_id suggestion passed in by ConfigWizard. // If the printer profile enumerated by the config are not visible, select an alternate preset. // Do not select alternate profiles for the print / filament profiles as those presets // will be selected by the following call of this->update_compatible(PresetSelectCompatibleType::Always). + //从配置或ConfigWizard传递的首选_model_id建议中激活打印/灯丝/打印机配置文件。 + //如果配置枚举的打印机配置文件不可见,请选择一个备用预设。 + //不要为打印/灯丝配置文件选择替代配置文件,因为这些预设文件将通过以下调用来选择->update_compatible(PresetSelectCompatibleType::Always)。 const Preset *initial_printer = printers.find_preset(initial_printer_profile_name); // If executed due to a Config Wizard update, preferred_printer contains the first newly installed printer, otherwise nullptr. + //如果由于配置向导更新而执行,则preferred_pinter包含第一个新安装的打印机,否则为nullptr。 const Preset *preferred_printer = printers.find_system_preset_by_model_and_variant(preferred_selection.printer_model_id, preferred_selection.printer_variant); printers.select_preset_by_name(preferred_printer ? preferred_printer->name : initial_printer_profile_name, true); CNumericLocalesSetter locales_setter; //BBS: set default print/filament profiles to BBL's default setting + //BBS:将默认打印/灯丝配置文件设置为BBL的默认设置 if (preferred_printer) { const std::string& prefered_print_profile = preferred_printer->config.opt_string("default_print_profile"); @@ -1688,6 +1696,7 @@ void PresetBundle::load_selections(AppConfig &config, const PresetPreferences& p } // Selects the profile, leaves it to -1 if the initial profile name is empty or if it was not found. + //选择配置文件,如果初始配置文件名称为空或找不到,则将其保留为-1。 prints.select_preset_by_name_strict(initial_print_profile_name); filaments.select_preset_by_name_strict(initial_filament_profile_name); sla_prints.select_preset_by_name_strict(initial_sla_print_profile_name); @@ -1698,6 +1707,9 @@ void PresetBundle::load_selections(AppConfig &config, const PresetPreferences& p // Load it even if the current printer technology is SLA. // The possibly excessive filament names will be later removed with this->update_multi_material_filament_presets() // once the FFF technology gets selected. + //加载为多材料打印机选择的其他灯丝轮廓的名称。 + //即使当前的打印机技术是SLA,也要加载它。 + //一旦选择了FFF技术,稍后将使用此->update_multi_material_filament_presets()删除可能过多的灯丝名称。 this->filament_presets = { filaments.get_selected_preset_name() }; for (unsigned int i = 1; i < 1000; ++ i) { char name[64]; @@ -1743,12 +1755,16 @@ void PresetBundle::load_selections(AppConfig &config, const PresetPreferences& p // Always try to select a compatible print and filament preset to the current printer preset, // as the application may have been closed with an active "external" preset, which does not // exist. + //根据预设与活动打印机的兼容性更新预设的可见性。 + //始终尝试选择与当前打印机预设兼容的打印和灯丝预设,因为应用程序可能已被不存在的活动“外部”预设关闭。 this->update_compatible(PresetSelectCompatibleType::Always); this->update_multi_material_filament_presets(); if (initial_printer != nullptr && (preferred_printer == nullptr || initial_printer == preferred_printer)) { // Don't run the following code, as we want to activate default filament / SLA material profiles when installing and selecting a new printer. // Only run this code if just a filament / SLA material was installed by Config Wizard for an active Printer. + //不要运行以下代码,因为我们想在安装和选择新打印机时激活默认的长丝/SLA材料配置文件。 + //仅当配置向导为活动打印机安装了灯丝/SLA材料时,才运行此代码。 auto printer_technology = printers.get_selected_preset().printer_technology(); if (printer_technology == ptFFF && ! preferred_selection.filament.empty()) { std::string preferred_preset_name = get_preset_name_by_alias(Preset::Type::TYPE_FILAMENT, preferred_selection.filament); @@ -1792,9 +1808,11 @@ void PresetBundle::load_selections(AppConfig &config, const PresetPreferences& p } // Parse the initial physical printer name. + //解析初始物理打印机名称。 std::string initial_physical_printer_name = remove_ini_suffix(config.get("presets", "physical_printer")); // Activate physical printer from the config + //从配置中激活物理打印机 if (!initial_physical_printer_name.empty()) physical_printers.select_printer(initial_physical_printer_name); @@ -1830,6 +1848,7 @@ void PresetBundle::export_selections(AppConfig &config) config.set("presets", "flush_volumes_vector", flush_volumes_vector); config.set("presets", PRESET_PRINTER_NAME, printers.get_selected_preset_name()); + config.set("presets", PRESET_CONFIG_NAME, configs.get_selected_preset_name()); std::string flush_multiplier_str = boost::algorithm::join(project_config.option("flush_multiplier")->values | boost::adaptors::transformed(static_cast(std::to_string)), diff --git a/slic3r/GUI/CreatePresetsDialog.cpp b/slic3r/GUI/CreatePresetsDialog.cpp index 9988c86..a73d498 100644 --- a/slic3r/GUI/CreatePresetsDialog.cpp +++ b/slic3r/GUI/CreatePresetsDialog.cpp @@ -41,7 +41,7 @@ static const std::vector filament_vendors = {"Polymaker", "OVERTURE "Anycubic", "Basf", "ELEGOO", "INLAND", "FLASHFORGE", "FusRock", "AMOLEN", "MIKA3D", "3DXTECH", "Duramic", "Priline", "Eryone", "3Dgunius", "Novamaker", "Justmaker", "Giantarm", "iProspect", "LDO"}; -static const std::vector filament_types = {"PLA", "PLA+", "PLA Tough", "PETG", "ABS", "ASA", "FLEX", "HIPS", "PA", "PACF", +static const std::vector filament_types = {"CFC","PLA", "PLA+", "PLA Tough", "PETG", "ABS", "ASA", "FLEX", "HIPS", "PA", "PACF", "NYLON", "PVA", "PC", "PCABS", "PCTG", "PCCF", "PP", "PEI", "PET", "PETG", "PETGCF", "PTBA", "PTBA90A", "PEEK", "TPU93A", "TPU75D", "TPU","TPU-AMS", "TPU92A", "TPU98A", "Misc", "TPE", "GLAZE", "Nylon", "CPE", "METAL", "ABST", "Carbon Fiber"}; @@ -1344,6 +1344,7 @@ void CreateFilamentPresetDialog::get_all_filament_presets() m_all_presets_map[filament_preset_name] = filament_preset; BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " loaded preset name is: " << filament_preset->name; } + m_system_filament_types_set.insert("CFC"); } void CreateFilamentPresetDialog::get_all_visible_printer_name() diff --git a/slic3r/GUI/FilamentMapPanel.cpp b/slic3r/GUI/FilamentMapPanel.cpp index b44ce53..1005f5a 100644 --- a/slic3r/GUI/FilamentMapPanel.cpp +++ b/slic3r/GUI/FilamentMapPanel.cpp @@ -83,6 +83,10 @@ void FilamentMapManualPanel::OnSwitchFilament(wxCommandEvent &) auto right_blocks = m_right_panel->get_filament_blocks(); for (auto &block : left_blocks) { + std::string type = block->GetType(); + /*if (type.find("CFC") != std::string::npos) { + show_error(this, _L("test1212121212121212121212")); + }*/ m_right_panel->AddColorBlock(block->GetColor(), block->GetType(), block->GetFilamentId(), false); m_left_panel->RemoveColorBlock(block, false); } diff --git a/slic3r/GUI/Plater.cpp b/slic3r/GUI/Plater.cpp index 60c02f9..13f62f6 100644 --- a/slic3r/GUI/Plater.cpp +++ b/slic3r/GUI/Plater.cpp @@ -13699,16 +13699,20 @@ void Plater::export_gcode(bool prefer_removable) } //std::this_thread::sleep_for(std::chrono::seconds(5)); //output_path = "E:\\Downloads\\Download\\123.gcode"; - /* std::string temp_file = output_path.string(); + std::string temp_file = output_path.string(); size_t pos = temp_file.find(".gcode"); if (pos != std::string::npos) { temp_file.replace(pos, 5, "-process"); } - temp_file = temp_file + ".gcode";*/ + + temp_file = temp_file + ".gcode"; + wxString abc = wxString::FromUTF8(temp_file); std::string copy_file = output_path.parent_path().string() + "\\copyFile.gcode"; - std::string temp_file = output_path.parent_path().string() + "\\tempFile.gcode"; - + //std::string temp_file = output_path.parent_path().string() + "\\tempFile.gcode"; + temp_file = abc.c_str(); + std::this_thread::sleep_for(std::chrono::seconds(3)); fs::copy(output_path, copy_file); + //std::this_thread::sleep_for(std::chrono::seconds(3)); std::ifstream inFile(copy_file); std::ofstream tempFile(temp_file); double total_length = 50 * 1000; @@ -13839,7 +13843,7 @@ void Plater::export_gcode(bool prefer_removable) //fs::remove(output_path); //std::rename("temp.txt", "original.txt"); //std::this_thread::sleep_for(std::chrono::seconds(4)); - fs::rename(temp_file, output_path); + //fs::rename(temp_file, output_path); } Point Plater::interpolate(const Point& p1, const Point& p2, double t) { diff --git a/slic3r/GUI/PresetComboBoxes.cpp b/slic3r/GUI/PresetComboBoxes.cpp index 78b8887..cbcf653 100644 --- a/slic3r/GUI/PresetComboBoxes.cpp +++ b/slic3r/GUI/PresetComboBoxes.cpp @@ -1217,12 +1217,36 @@ void PlaterPresetComboBox::update() tooltip = get_tooltip(preset); } } + + //BBS: move system to the end //if (i + 1 == m_collection->num_default_presets()) // set_label_marker(Append(separator(L("System presets")), wxNullBitmap)); } - //if (m_type == Preset::TYPE_PRINTER) - // add_connected_printers("", true); + wxString lian_xu = _L("Lian xu"); + bool m_fold = false; + if (m_type == Preset::TYPE_CONFIG) { + for (auto& f : m_preset_bundle->filament_presets) { + wxString abc = wxString::FromUTF8(f); + if (m_fold = abc.Contains(lian_xu)) { + break; + } + } + if (m_fold) { + temp_presets.clear(); + for (const auto& pair : nonsys_presets) { + wxString key = pair.first; + if (key.Contains(lian_xu)) { + temp_presets.emplace(pair); + } + } + nonsys_presets.clear(); + //nonsys_presets.emplace(temp_presets); + nonsys_presets.insert(temp_presets.begin(), temp_presets.end()); + } + } + if (m_type == Preset::TYPE_PRINTER) + add_connected_printers("", true); bool selected_in_ams = false; if (m_type == Preset::TYPE_FILAMENT) { set_replace_text("Bambu", "BambuStudioBlack"); @@ -1280,42 +1304,55 @@ void PlaterPresetComboBox::update() } } }; + //if (m_type == Preset::TYPE_CONFIG) { + // wxString lian_xu = _L("Lian xu"); + // bool m_fold = false; + // for (auto& f : m_preset_bundle->filament_presets) { + // wxString abc = wxString::FromUTF8(f); + // if (m_fold = abc.Contains(lian_xu)) { + // break; + // } + // } + // /* wxString lian_xu = _L("Lian xu"); + // bool m_fold = false; + // auto full_config = wxGetApp().preset_bundle->full_config(); + // std::vector filament_types = full_config.option("filament_type")->values; + // for (std::string type : filament_types) { + // if ( type.find("CFC") != std::string::npos) { + // m_fold = true; + // break; + // } + // }*/ + // if (m_fold) { + // /* for (std::map::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) { + // wxString key = it->first; + // temp_presets.insert + // }*/ + // temp_presets.clear(); + // for (const auto& pair : nonsys_presets) { + // wxString key = pair.first; + // if (key.Contains(lian_xu)) { + // temp_presets.emplace(pair); + // } + // } + // for (std::map::iterator it = temp_presets.begin(); it != temp_presets.end(); ++it) { + // SetItemTooltip(Append(it->first, *it->second), preset_descriptions[it->first]); + // validate_selection(it->first == selected_user_preset); + // } + // //add_presets(temp_presets, selected_user_preset, ""); + // } + // else { + // for (std::map::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) { + // SetItemTooltip(Append(it->first, *it->second), preset_descriptions[it->first]); + // validate_selection(it->first == selected_user_preset); + // } + // //add_presets(nonsys_presets, selected_user_preset, L("User presets")); + // //add_presets(nonsys_presets, selected_user_preset, ""); + // } if (m_type == Preset::TYPE_CONFIG) { - wxString lian_xu = _L("Lian xu"); - bool m_fold = false; - //m_preset_bundle->filament_presets - for (auto& f : m_preset_bundle->filament_presets) { - wxString abc = wxString::FromUTF8(f); - if (m_fold = abc.Contains(lian_xu)) { - break; - } - } - - if (m_fold) { - /* for (std::map::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) { - wxString key = it->first; - temp_presets.insert - }*/ - temp_presets.clear(); - for (const auto& pair : nonsys_presets) { - wxString key = pair.first; - if (key.Contains(lian_xu)) { - temp_presets.emplace(pair); - } - } - for (std::map::iterator it = temp_presets.begin(); it != temp_presets.end(); ++it) { - SetItemTooltip(Append(it->first, *it->second), preset_descriptions[it->first]); - validate_selection(it->first == selected_user_preset); - } - //add_presets(temp_presets, selected_user_preset, ""); - } - else { - for (std::map::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) { - SetItemTooltip(Append(it->first, *it->second), preset_descriptions[it->first]); - validate_selection(it->first == selected_user_preset); - } - //add_presets(nonsys_presets, selected_user_preset, L("User presets")); - //add_presets(nonsys_presets, selected_user_preset, ""); + for (std::map::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) { + SetItemTooltip(Append(it->first, *it->second), preset_descriptions[it->first]); + validate_selection(it->first == selected_user_preset); } } else { @@ -1507,6 +1544,8 @@ void TabPresetComboBox::update() if (preset.is_system) preset_descriptions.emplace(name, _L(preset.description)); + + if (preset.is_default || preset.is_system) { //BBS: move system to the end system_presets.emplace(name, std::pair(bmp, is_enabled)); @@ -1536,15 +1575,9 @@ void TabPresetComboBox::update() //if (i + 1 == m_collection->num_default_presets()) // set_label_marker(Append(separator(L("System presets")), wxNullBitmap)); } - - if (m_type == Preset::TYPE_FILAMENT) - add_ams_filaments(into_u8(selected)); - - //BBS: add project embedded preset logic + wxString lian_xu = _L("Lian xu"); + bool m_fold = false; if (m_type == Preset::TYPE_CONFIG) { - wxString lian_xu = _L("Lian xu"); - bool m_fold = false; - //m_preset_bundle->filament_presets for (auto& f : m_preset_bundle->filament_presets) { wxString abc = wxString::FromUTF8(f); if (m_fold = abc.Contains(lian_xu)) { @@ -1552,10 +1585,6 @@ void TabPresetComboBox::update() } } if (m_fold) { - /* for (std::map::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) { - wxString key = it->first; - temp_presets.insert - }*/ temp_presets.clear(); for (const auto& pair : nonsys_presets) { wxString key = pair.first; @@ -1563,24 +1592,74 @@ void TabPresetComboBox::update() temp_presets.emplace(pair); } } - for (std::map>::iterator it = temp_presets.begin(); it != temp_presets.end(); ++it) { - int item_id = Append(it->first, *it->second.first); - SetItemTooltip(item_id, preset_descriptions[it->first]); - bool is_enabled = it->second.second; - if (!is_enabled) - set_label_marker(item_id, LABEL_ITEM_DISABLED); - validate_selection(it->first == selected); - } + nonsys_presets.clear(); + //nonsys_presets.emplace(temp_presets); + nonsys_presets.insert(temp_presets.begin(), temp_presets.end()); } - else { - for (std::map>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) { - int item_id = Append(it->first, *it->second.first); - SetItemTooltip(item_id, preset_descriptions[it->first]); - bool is_enabled = it->second.second; - if (!is_enabled) - set_label_marker(item_id, LABEL_ITEM_DISABLED); - validate_selection(it->first == selected); - } + } + if (m_type == Preset::TYPE_FILAMENT) + add_ams_filaments(into_u8(selected)); + + //BBS: add project embedded preset logic + //if (m_type == Preset::TYPE_CONFIG) { + // wxString lian_xu = _L("Lian xu"); + // bool m_fold = false; + // for (auto& f : m_preset_bundle->filament_presets) { + // wxString abc = wxString::FromUTF8(f); + // if (m_fold = abc.Contains(lian_xu)) { + // break; + // } + // } + // /* wxString lian_xu = _L("Lian xu"); + // bool m_fold = false; + // auto full_config = wxGetApp().preset_bundle->full_config(); + // std::vector filament_types = full_config.option("filament_type")->values; + // for (std::string type : filament_types) { + // if (type.find("CFC") != std::string::npos) { + // m_fold = true; + // break; + // } + // }*/ + // if (m_fold) { + // /* for (std::map::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) { + // wxString key = it->first; + // temp_presets.insert + // }*/ + // temp_presets.clear(); + // for (const auto& pair : nonsys_presets) { + // wxString key = pair.first; + // if (key.Contains(lian_xu)) { + // temp_presets.emplace(pair); + // } + // } + // for (std::map>::iterator it = temp_presets.begin(); it != temp_presets.end(); ++it) { + // int item_id = Append(it->first, *it->second.first); + // SetItemTooltip(item_id, preset_descriptions[it->first]); + // bool is_enabled = it->second.second; + // if (!is_enabled) + // set_label_marker(item_id, LABEL_ITEM_DISABLED); + // validate_selection(it->first == selected); + // } + // if (m_type == Preset::TYPE_CONFIG) { + // } + // else { + // for (std::map>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) { + // int item_id = Append(it->first, *it->second.first); + // SetItemTooltip(item_id, preset_descriptions[it->first]); + // bool is_enabled = it->second.second; + // if (!is_enabled) + // set_label_marker(item_id, LABEL_ITEM_DISABLED); + // validate_selection(it->first == selected); + // } + // } + if (m_type == Preset::TYPE_CONFIG) { + for (std::map>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) { + int item_id = Append(it->first, *it->second.first); + SetItemTooltip(item_id, preset_descriptions[it->first]); + bool is_enabled = it->second.second; + if (!is_enabled) + set_label_marker(item_id, LABEL_ITEM_DISABLED); + validate_selection(it->first == selected); } } else { diff --git a/slic3r/GUI/Tab.cpp b/slic3r/GUI/Tab.cpp index 7490b66..74a0674 100644 --- a/slic3r/GUI/Tab.cpp +++ b/slic3r/GUI/Tab.cpp @@ -882,7 +882,7 @@ void Tab::update_changed_ui() return; const bool deep_compare = (m_type == Preset::TYPE_PRINTER || m_type == Preset::TYPE_PRINT || m_type == Preset::TYPE_FILAMENT - || m_type == Preset::TYPE_SLA_MATERIAL || m_type == Preset::TYPE_MODEL); + || m_type == Preset::TYPE_SLA_MATERIAL || m_type == Preset::TYPE_MODEL || m_type == Preset::TYPE_CONFIG); auto dirty_options = m_presets->current_dirty_options(deep_compare); auto nonsys_options = m_presets->current_different_from_parent_options(deep_compare); if (m_type == Preset::TYPE_PRINTER && static_cast(this)->m_printer_technology == ptFFF) { @@ -3856,12 +3856,13 @@ void TabFilament::toggle_options() //if (m_active_page->title() == "Setting Overrides") // update_filament_overrides_page(); - wxString abc = wxString::FromUTF8(m_preset_bundle->filaments.get_edited_preset().name); + //wxString abc = wxString::FromUTF8(m_preset_bundle->filaments.get_edited_preset().name); std::string type; m_preset_bundle->filaments.get_edited_preset().get_filament_type(type); //CFC - wxString lian_xu = _L("Lian xu"); - if (abc.Contains(lian_xu)) { + //wxString lian_xu = _L("Lian xu"); + //if (abc.Contains(lian_xu)) { + if (type.find("CFC") != std::string::npos) { if (m_active_page->title() == "Filament") { toggle_option("filament_type", false); @@ -4211,29 +4212,32 @@ void TabConfig::reload_config() this->compatible_widget_reload(m_compatible_printers); Tab::reload_config(); } -//void TabConfig::update_description_lines() -//{ -// Tab::update_description_lines(); -// -// if (!m_active_page) -// return; -// -// //if (m_active_page->title() == "Cooling" && m_cooling_description_line) -// // m_cooling_description_line->SetText(from_u8(PresetHints::cooling_description(m_presets->get_edited_preset()))); -// //BBS -// //if (m_active_page->title() == "Filament" && m_volumetric_speed_description_line) -// // this->update_volumetric_flow_preset_hints(); -//} + +void TabConfig::update_description_lines() +{ + Tab::update_description_lines(); + + if (!m_active_page) + return; + + //if (m_active_page->title() == "Cooling" && m_cooling_description_line) + // m_cooling_description_line->SetText(from_u8(PresetHints::cooling_description(m_presets->get_edited_preset()))); + //BBS + //if (m_active_page->title() == "Filament" && m_volumetric_speed_description_line) + // this->update_volumetric_flow_preset_hints(); +} + void TabConfig::toggle_options() { if (!m_active_page) return; if (m_preset_bundle) { - bool is_BBL_printer = m_preset_bundle->configs.get_edited_preset().is_bbl_vendor_preset(m_preset_bundle); + bool is_BBL_printer = m_preset_bundle->printers.get_edited_preset().is_bbl_vendor_preset(m_preset_bundle); m_config_manipulation.set_is_BBL_Printer(is_BBL_printer); } m_config_manipulation.toggle_print_fff_options(m_config, m_type < Preset::TYPE_COUNT); + //m_config_manipulation.toggle_print_fff_options(m_config, int(intptr_t(m_extruder_switch->GetClientData())), m_type < Preset::TYPE_COUNT); bool enable_support = m_preset_bundle->prints.get_edited_preset().config.opt_bool("enable_support"); for (auto el : { "support_style", "support_base_pattern", @@ -4470,6 +4474,7 @@ void TabConfig::update() { m_update_cnt++; m_config_manipulation.update_print_fff_config(m_config, m_type < Preset::TYPE_COUNT, m_type == Preset::TYPE_PLATE); + update_description_lines(); m_parent->Layout(); m_update_cnt--; diff --git a/slic3r/GUI/Tab.hpp b/slic3r/GUI/Tab.hpp index 70301d9..55ed4e8 100644 --- a/slic3r/GUI/Tab.hpp +++ b/slic3r/GUI/Tab.hpp @@ -589,7 +589,7 @@ public: void build() override; void reload_config() override; - //void update_description_lines() override; + void update_description_lines() override; void toggle_options() override; void update() override; void clear_pages() override;