diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 5fc63eb5e..84c30eb9b 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1960,24 +1960,22 @@ std::map Sidebar::build_filament_ams_list(MachineObject return tray_config; }; - auto vt_tray = obj->vt_tray; if (obj->ams_support_virtual_tray) { - int extruder = 0x10000; - //for (auto &vt_tray : obj->vt_slot) { - filament_ams_list.emplace(extruder + VIRTUAL_TRAY_MAIN_ID, build_tray_config(vt_tray, "Ext")); - extruder = 0; - //} + int extruder = 0x10000; // Main (first) extruder at right + for (auto & vt_tray : obj->vt_slot) { + filament_ams_list.emplace(extruder + VIRTUAL_TRAY_MAIN_ID, build_tray_config(vt_tray, "Ext")); + extruder = 0; + } } auto list = obj->amsList; for (auto ams : list) { char n = ams.first.front() - '0' + 'A'; - int extruder = /*ams.nozzle ? 0 :*/ 0x10000; + int extruder = ams.second->nozzle ? 0 : 0x10000; // Main (first) extruder at right for (auto tray : ams.second->trayList) { char t = tray.first.front() - '0' + '1'; filament_ams_list.emplace(extruder + ((n - 'A') * 4 + t - '1'), build_tray_config(*tray.second, std::string(1, n) + std::string(1, t))); - extruder = 0; } } return filament_ams_list; diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 64a3b7189..81ec23d81 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -497,6 +497,7 @@ void Tab::create_preset_tab() evt.Skip(); dynamic_cast(this)->switch_excluder(evt.GetInt()); reload_config(); + update_changed_ui(); }); m_main_sizer->Add(m_extruder_switch, 0, wxALIGN_CENTER | wxTOP | wxBOTTOM, 4); } @@ -840,7 +841,7 @@ void Tab::update_changed_ui() if (m_postpone_update_ui) return; - const bool deep_compare = (m_type == Slic3r::Preset::TYPE_PRINTER || m_type == Slic3r::Preset::TYPE_SLA_MATERIAL); + const bool deep_compare = (m_type == Slic3r::Preset::TYPE_PRINTER || m_type == Slic3r::Preset::TYPE_PRINT || m_type == Slic3r::Preset::TYPE_SLA_MATERIAL); 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) { @@ -854,8 +855,10 @@ void Tab::update_changed_ui() for (auto& it : m_options_list) it.second = m_opt_status_value; - filter_diff_option(dirty_options); - filter_diff_option(nonsys_options); + if (m_extruder_switch == nullptr || m_extruder_switch->IsEnabled()) { + filter_diff_option(dirty_options); + filter_diff_option(nonsys_options); + } for (auto opt_key : dirty_options) { m_options_list[opt_key] &= ~osInitValue; @@ -876,15 +879,6 @@ void Tab::update_changed_ui() update_undo_buttons(); } -void Tab::init_options_list() -{ - if (!m_options_list.empty()) - m_options_list.clear(); - - for (const std::string& opt_key : m_config->keys()) - m_options_list.emplace(opt_key, m_opt_status_value); -} - template void add_correct_opts_to_options_list(const std::string &opt_key, std::map& map, Tab *tab, const int& value) { @@ -893,14 +887,14 @@ void add_correct_opts_to_options_list(const std::string &opt_key, std::mapkeys()) { - if (opt_key == "printable_area" || opt_key == "bed_exclude_area"|| opt_key=="thumbnail_size") { + if (opt_key == "printable_area" || opt_key == "bed_exclude_area" || opt_key == "compatible_prints" || opt_key == "compatible_printers" || opt_key == "thumbnail_size") { m_options_list.emplace(opt_key, m_opt_status_value); continue; } @@ -918,6 +912,11 @@ void TabPrinter::init_options_list() default: m_options_list.emplace(opt_key, m_opt_status_value); break; } } +} + +void TabPrinter::init_options_list() +{ + Tab::init_options_list(); if (m_printer_technology == ptFFF) m_options_list.emplace("extruders_count", m_opt_status_value); } @@ -934,30 +933,13 @@ void TabPrinter::msw_rescale() m_parent->Layout(); } -void TabSLAMaterial::init_options_list() +void TabFilament::init_options_list() { if (!m_options_list.empty()) m_options_list.clear(); for (const std::string& opt_key : m_config->keys()) - { - if (opt_key == "compatible_prints" || opt_key == "compatible_printers") { - m_options_list.emplace(opt_key, m_opt_status_value); - continue; - } - switch (m_config->option(opt_key)->type()) - { - case coInts: add_correct_opts_to_options_list(opt_key, m_options_list, this, m_opt_status_value); break; - case coBools: add_correct_opts_to_options_list(opt_key, m_options_list, this, m_opt_status_value); break; - case coFloats: add_correct_opts_to_options_list(opt_key, m_options_list, this, m_opt_status_value); break; - case coStrings: add_correct_opts_to_options_list(opt_key, m_options_list, this, m_opt_status_value); break; - case coPercents:add_correct_opts_to_options_list(opt_key, m_options_list, this, m_opt_status_value); break; - case coPoints: add_correct_opts_to_options_list(opt_key, m_options_list, this, m_opt_status_value); break; - // BBS - case coEnums: add_correct_opts_to_options_list(opt_key, m_options_list, this, m_opt_status_value); break; - default: m_options_list.emplace(opt_key, m_opt_status_value); break; - } - } + m_options_list.emplace(opt_key, m_opt_status_value); } void Tab::get_sys_and_mod_flags(const std::string& opt_key, bool& sys_page, bool& modified_page) @@ -1591,7 +1573,7 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value) wxGetApp().plater()->on_extruders_change(boost::any_cast(value)); #endif - if (opt_key.find_first_of("nozzle_volume_type") != std::string::npos) { + if (opt_key.find("nozzle_volume_type") != std::string::npos) { int extruder_idx = std::atoi(opt_key.substr(opt_key.find_last_of('#') + 1).c_str()); for (auto tab : wxGetApp().tabs_list) { tab->update_extruder_variants(extruder_idx); @@ -3935,7 +3917,7 @@ void TabPrinter::build_unregular_pages(bool from_initial_build/* = false*/) optgroup->m_on_change = [this, extruder_idx](const t_config_option_key& opt_key, boost::any value) { - //if (m_config->opt_bool("single_extruder_multi_material") && m_extruders_count > 1 && opt_key.find_first_of("nozzle_diameter") != std::string::npos) + //if (m_config->opt_bool("single_extruder_multi_material") && m_extruders_count > 1 && opt_key.find("nozzle_diameter") != std::string::npos) //{ // SuppressBackgroundProcessingUpdate sbpu; // const double new_nd = boost::any_cast(value); @@ -5714,7 +5696,9 @@ void Tab::update_extruder_variants(int extruder_id) } m_extruder_switch->SetLabels(wxString::Format(_L("Left: %s"), left), wxString::Format(_L("Right: %s"), right)); m_extruder_switch->SetValue(extruder_id == 1); + m_extruder_switch->Enable(); } else { + m_extruder_switch->Enable(false); GetSizer()->Show(m_extruder_switch, false); return; } diff --git a/src/slic3r/GUI/Tab.hpp b/src/slic3r/GUI/Tab.hpp index 6f5791d1d..544e5041b 100644 --- a/src/slic3r/GUI/Tab.hpp +++ b/src/slic3r/GUI/Tab.hpp @@ -568,7 +568,8 @@ public: void update_description_lines() override; void toggle_options() override; void update() override; - void clear_pages() override; + void init_options_list() override; + void clear_pages() override; bool supports_printer_technology(const PrinterTechnology tech) const override { return tech == ptFFF; } }; @@ -641,7 +642,6 @@ public: void reload_config() override; void toggle_options() override; void update() override; - void init_options_list() override; bool supports_printer_technology(const PrinterTechnology tech) const override { return tech == ptSLA; } };