diff --git a/resources/images/printer_preview_C13.png b/resources/images/printer_preview_C13.png new file mode 100644 index 000000000..4d5b72fee Binary files /dev/null and b/resources/images/printer_preview_C13.png differ diff --git a/resources/images/printer_preview_O1D.png b/resources/images/printer_preview_O1D.png new file mode 100644 index 000000000..70bbc3637 Binary files /dev/null and b/resources/images/printer_preview_O1D.png differ diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 4aabbba63..a47b1080f 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -218,6 +218,26 @@ void Plater::show_illegal_characters_warning(wxWindow* parent) show_error(parent, _L("Invalid name, the following characters are not allowed:") + " <>:/\\|?*\"" +_L("(Including its escape characters)")); } +static std::map bed_type_thumbnails = { + {BedType::btPC, "bed_cool"}, + {BedType::btEP, "bed_engineering"}, + {BedType::btPEI, "bed_pei"}, + {BedType::btPTE, "bed_high_templ"}, + {BedType::btSuperTack, "bed_cool_supertack"} +}; + +// print_model_id +static std::map printer_thumbnails = { + {"N1", "printer_preview_N1"}, + {"N2S", "printer_preview_N2S"}, + {"C11", "printer_preview_C11"}, + {"C12", "printer_preview_C12"}, + {"C13", "printer_preview_C13"}, + {"BL-P001", "printer_preview_BL-P001"}, + {"BL-P002", "printer_preview_BL-P002"}, + {"O1D", "printer_preview_O1D"}, +}; + enum SlicedInfoIdx { siFilament_m, @@ -944,6 +964,13 @@ void ExtruderGroup::update_ams() if (ams_n4 * 4 + ams_n1 * 2 <= 8) is_upward = false; + std::vector colors = { + wxColour(255, 110, 100), + wxColour(97, 27, 22), + wxColour(7, 134, 219), + wxColour(170, 111, 252) + }; + bool display_front_ams = !is_upward; size_t i = 0; for (; i < ams_n4 && i < 4; ++i) { @@ -953,7 +980,11 @@ void ExtruderGroup::update_ams() if (show_this_ams) { AMSinfo ams_info; ams_info.ams_type = AMSModel::GENERIC_AMS; - for (size_t i = 0; i < 4; ++i) ams_info.cans.emplace_back(Caninfo()); + for (size_t i = 0; i < 4; ++i) { + Caninfo can_info; + can_info.material_colour = colors[i]; + ams_info.cans.push_back(can_info); + } ams[i]->Update(ams_info); ams[i]->Refresh(); ams[i]->Open(); @@ -969,7 +1000,9 @@ void ExtruderGroup::update_ams() if (show_this_ams) { AMSinfo ams_info; ams_info.ams_type = AMSModel::N3S_AMS; - ams_info.cans.emplace_back(Caninfo()); + Caninfo can_info; + can_info.material_colour = wxColour(255, 110, 100); + ams_info.cans.push_back(can_info); ams[i]->Update(ams_info); ams[i]->Refresh(); ams[i]->Open(); @@ -1431,6 +1464,11 @@ Sidebar::Sidebar(Plater *parent) } } + p->combo_printer_bed->Bind(wxEVT_COMBOBOX, [this](auto &e) { + int selection = p->combo_printer_bed->GetSelection(); + p->image_printer_bed->SetBitmap(create_scaled_bitmap(bed_type_thumbnails[BedType(selection + 1)], this, 48)); + }); + { auto hovered = std::make_shared(); for (wxWindow *w : std::initializer_list{p->panel_printer_bed, wiki_bed, p->image_printer_bed, p->combo_printer_bed}) { @@ -1980,8 +2018,10 @@ void Sidebar::update_all_preset_comboboxes() cb->update(); } - if (p->combo_printer) + if (p->combo_printer) { p->combo_printer->update(); + update_printer_thumbnail(); + } } void Sidebar::update_presets(Preset::Type preset_type) @@ -2912,6 +2952,17 @@ void Sidebar::set_is_gcode_file(bool flag) } } +void Sidebar::update_printer_thumbnail() +{ + auto& preset_bundle = wxGetApp().preset_bundle; + Preset & selected_preset = preset_bundle->printers.get_edited_preset(); + std::string printer_type = selected_preset.get_current_printer_type(preset_bundle); + if (printer_thumbnails.find(printer_type) != printer_thumbnails.end()) + p->image_printer->SetBitmap(create_scaled_bitmap(printer_thumbnails[printer_type], this, 48)); + else + p->image_printer->SetBitmap(create_scaled_bitmap("printer_placeholder", this, 48)); +} + void Sidebar::auto_calc_flushing_volumes(const int modify_id) { auto& preset_bundle = wxGetApp().preset_bundle; @@ -7454,6 +7505,7 @@ void Plater::priv::on_combobox_select(wxCommandEvent &evt) PlaterPresetComboBox* preset_combo_box = dynamic_cast(evt.GetEventObject()); if (preset_combo_box) { this->on_select_preset(evt); + sidebar->update_printer_thumbnail(); } else { this->on_select_bed_type(evt); diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 0a96dd893..9e723e2c7 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -199,6 +199,7 @@ public: void update_soft_first_start_state() { m_soft_first_start = false; } void cancel_update_3d_state() { m_update_3d_state = false; } bool get_update_3d_state() { return m_update_3d_state; } + void update_printer_thumbnail(); private: struct priv; std::unique_ptr p;