From 0dd5057b4d48dc4ffef67450d9114a0264735673 Mon Sep 17 00:00:00 2001 From: "tao.jin" Date: Wed, 9 Nov 2022 21:40:29 +0800 Subject: [PATCH] ENH: mark icon if plate bed_type differ from global Change-Id: I6ae1396b8a3007b61ce85992ebb2aec6c64ec2ff (cherry picked from commit c8dbb583838df20105c0ca4f9d1a5d711d7c0347) --- resources/images/bbl-3dp-EP-logo.svg | 160 +++++------------- resources/images/bbl-3dp-PC-logo.svg | 74 ++------ resources/images/bbl-3dp-PEI-logo.svg | 97 +++-------- resources/images/bbl-3dp-PTE-logo.svg | 92 ++++------ resources/images/bbl-3dp-logo.svg | 77 +++++---- resources/images/plate_set_bedtype.svg | 6 +- resources/images/plate_set_bedtype_warned.svg | 10 ++ src/slic3r/GUI/PartPlate.cpp | 22 ++- src/slic3r/GUI/PartPlate.hpp | 8 + src/slic3r/GUI/Plater.cpp | 5 + 10 files changed, 207 insertions(+), 344 deletions(-) create mode 100644 resources/images/plate_set_bedtype_warned.svg diff --git a/resources/images/bbl-3dp-EP-logo.svg b/resources/images/bbl-3dp-EP-logo.svg index 11827f3e3a..8fff343ada 100644 --- a/resources/images/bbl-3dp-EP-logo.svg +++ b/resources/images/bbl-3dp-EP-logo.svg @@ -1,114 +1,40 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + @@ -118,8 +44,8 @@ - - + + @@ -133,27 +59,27 @@ - + - + - + - - - - - + + + + + @@ -162,9 +88,15 @@ - + - + + + + + + + diff --git a/resources/images/bbl-3dp-PC-logo.svg b/resources/images/bbl-3dp-PC-logo.svg index 293a36315b..f5ed799b7e 100644 --- a/resources/images/bbl-3dp-PC-logo.svg +++ b/resources/images/bbl-3dp-PC-logo.svg @@ -1,65 +1,21 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/resources/images/bbl-3dp-PEI-logo.svg b/resources/images/bbl-3dp-PEI-logo.svg index 5ef51ea4a5..0ef9e05204 100644 --- a/resources/images/bbl-3dp-PEI-logo.svg +++ b/resources/images/bbl-3dp-PEI-logo.svg @@ -1,76 +1,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/images/bbl-3dp-PTE-logo.svg b/resources/images/bbl-3dp-PTE-logo.svg index d838f60a5c..e1fd604c96 100644 --- a/resources/images/bbl-3dp-PTE-logo.svg +++ b/resources/images/bbl-3dp-PTE-logo.svg @@ -1,65 +1,37 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/images/bbl-3dp-logo.svg b/resources/images/bbl-3dp-logo.svg index d17daf639a..af0b6ef5e2 100644 --- a/resources/images/bbl-3dp-logo.svg +++ b/resources/images/bbl-3dp-logo.svg @@ -1,36 +1,43 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/images/plate_set_bedtype.svg b/resources/images/plate_set_bedtype.svg index 788682c488..b4b616d56e 100644 --- a/resources/images/plate_set_bedtype.svg +++ b/resources/images/plate_set_bedtype.svg @@ -1,10 +1,10 @@ - + - - + + diff --git a/resources/images/plate_set_bedtype_warned.svg b/resources/images/plate_set_bedtype_warned.svg new file mode 100644 index 0000000000..c4aed904b2 --- /dev/null +++ b/resources/images/plate_set_bedtype_warned.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index 41b39f0839..766c07ebc8 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -710,8 +710,12 @@ void PartPlate::render_icons(bool bottom, int hover_id) const if (m_partplate_list->render_bedtype_setting) { if (hover_id == 5) render_icon_texture(position_id, tex_coords_id, m_bedtype_icon, m_partplate_list->m_bedtype_hovered_texture, m_bedtype_vbo_id); - else - render_icon_texture(position_id, tex_coords_id, m_bedtype_icon, m_partplate_list->m_bedtype_texture, m_bedtype_vbo_id); + else { + if (render_bedtype_setting_warned) + render_icon_texture(position_id, tex_coords_id, m_bedtype_icon, m_partplate_list->m_bedtype_warned_texture, m_bedtype_vbo_id); + else + render_icon_texture(position_id, tex_coords_id, m_bedtype_icon, m_partplate_list->m_bedtype_texture, m_bedtype_vbo_id); + } } if (m_plate_index >=0 && m_plate_index < MAX_PLATE_COUNT) { @@ -2020,6 +2024,11 @@ void PartPlate::render(bool bottom, bool only_body, bool force_background_color, glsafe(::glDisable(GL_DEPTH_TEST)); } +void PartPlate::set_plate_render_option(bool bedtype_setting_warned) +{ + render_bedtype_setting_warned = bedtype_setting_warned; +} + void PartPlate::set_selected() { m_selected = true; } @@ -2428,6 +2437,14 @@ void PartPlateList::generate_icon_textures() } } + if (m_bedtype_warned_texture.get_id() == 0) + { + file_name = path + "plate_set_bedtype_warned.svg"; + if (!m_bedtype_warned_texture.load_from_svg_file(file_name, true, false, false, max_tex_size / 8)) { + BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(":load file %1% failed") % file_name; + } + } + if (m_bedtype_hovered_texture.get_id() == 0) { file_name = path + "plate_set_bedtype_hover.svg"; @@ -2493,6 +2510,7 @@ void PartPlateList::release_icon_textures() m_lockopen_texture.reset(); m_lockopen_hovered_texture.reset(); m_bedtype_texture.reset(); + m_bedtype_warned_texture.reset(); m_bedtype_hovered_texture.reset(); for (int i = 0;i < MAX_PLATE_COUNT; i++) { diff --git a/src/slic3r/GUI/PartPlate.hpp b/src/slic3r/GUI/PartPlate.hpp index 9601710746..33ad73dac2 100644 --- a/src/slic3r/GUI/PartPlate.hpp +++ b/src/slic3r/GUI/PartPlate.hpp @@ -138,6 +138,9 @@ private: mutable unsigned int m_plate_idx_vbo_id{ 0 }; GLTexture m_texture; + // plate render option + bool render_bedtype_setting_warned = false; + mutable float m_grabber_color[4]; float m_scale_factor{ 1.0f }; GLUquadricObject* m_quadric; @@ -207,6 +210,7 @@ public: void clear(bool clear_sliced_result = true); BedType get_bed_type() const; + bool is_bedtype_same_as_global = true; void set_bed_type(BedType, bool& same_as_global); void reset_bed_type(); DynamicPrintConfig* config() { return &m_config; } @@ -298,6 +302,7 @@ public: void render(bool bottom, bool only_body = false, bool force_background_color = false, HeightLimitMode mode = HEIGHT_LIMIT_NONE, int hover_id = -1); void render_for_picking() const { on_render_for_picking(); } + void set_plate_render_option(bool bedtype_setting_warned); void set_selected(); void set_unselected(); void set_hover_id(int id) { m_hover_id = id; } @@ -454,6 +459,7 @@ class PartPlateList : public ObjectBase GLTexture m_lockopen_texture; GLTexture m_lockopen_hovered_texture; GLTexture m_bedtype_texture; + GLTexture m_bedtype_warned_texture; GLTexture m_bedtype_hovered_texture; GLTexture m_idx_textures[MAX_PLATE_COUNT]; // set render option @@ -529,6 +535,8 @@ public: int get_curr_plate_index() const { return m_current_plate; } PartPlate* get_curr_plate() { return m_plate_list[m_current_plate]; } + std::vector& get_plate_list() { return m_plate_list; }; + PartPlate* get_selected_plate(); Vec3d get_current_plate_origin() { return compute_origin(m_current_plate, m_plate_cols); } diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 8b6288d3cf..1f9be3a018 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -5212,6 +5212,10 @@ void Plater::priv::on_select_bed_type(wxCommandEvent &evt) app_config->set("curr_bed_type", std::to_string(int(bed_type))); // update render + auto plate_list = partplate_list.get_plate_list(); + for (auto plate : plate_list) { + plate->set_plate_render_option(false); + } view3D->get_canvas3d()->render(); preview->msw_rescale(); } @@ -10588,6 +10592,7 @@ int Plater::select_plate_by_hover_id(int hover_id, bool right_click) bool same_as_global = false; auto type = (BedType)(e.GetInt()); p->partplate_list.get_curr_plate()->set_bed_type(type, same_as_global); + p->partplate_list.get_curr_plate()->set_plate_render_option(same_as_global?false:true); BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format("select bed type %1% for plate %2% at plate side")%type %plate_index; }); dlg.ShowModal();