FIX:set logo name empty when no custom svg

jira: STUDIO-7532
Change-Id: I42ac46aec070facf55333c00b06c65e592ab9345
This commit is contained in:
zhou.xu 2024-07-02 20:51:27 +08:00 committed by Lane.Wei
parent 319b3e2247
commit 5bc97e4997
3 changed files with 16 additions and 3 deletions

View File

@ -640,7 +640,7 @@ void PartPlate::render_logo_texture(GLTexture &logo_texture, const GeometryBuffe
} }
} }
void PartPlate::render_logo(bool bottom, bool render_cali) const void PartPlate::render_logo(bool bottom, bool render_cali)
{ {
// render printer custom texture logo // render printer custom texture logo
if (m_partplate_list->m_logo_texture_filename.empty()) { if (m_partplate_list->m_logo_texture_filename.empty()) {
@ -707,6 +707,13 @@ void PartPlate::render_logo(bool bottom, bool render_cali) const
GL_STATIC_DRAW)); GL_STATIC_DRAW));
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0)); glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
} }
if (m_partplate_list && m_partplate_list->m_bed3d && !m_partplate_list->m_bed3d->get_model_filename().empty()) {
auto cur_bed = m_partplate_list->m_bed3d;
auto cur_box = cur_bed->get_model().get_bounding_box().transformed(Geometry::translation_transform(m_origin));
if ((m_cur_bed_boundingbox.center() - cur_box.center()).norm() > 1.0f) {
set_logo_box_by_bed(cur_box);
}
}
if (m_vbo_id != 0 && m_logo_triangles.get_vertices_count() > 0) { if (m_vbo_id != 0 && m_logo_triangles.get_vertices_count() > 0) {
render_logo_texture(m_partplate_list->m_logo_texture, m_logo_triangles, bottom, m_vbo_id); render_logo_texture(m_partplate_list->m_logo_texture, m_logo_triangles, bottom, m_vbo_id);
} }
@ -2539,6 +2546,7 @@ void PartPlate::generate_logo_polygon(ExPolygon &logo_polygon, const BoundingBox
void PartPlate::set_logo_box_by_bed(const BoundingBoxf3& box) void PartPlate::set_logo_box_by_bed(const BoundingBoxf3& box)
{ {
if (box.defined) { if (box.defined) {
m_cur_bed_boundingbox = box;
ExPolygon logo_poly; ExPolygon logo_poly;
generate_logo_polygon(logo_poly, box); generate_logo_polygon(logo_poly, box);
if (!m_logo_triangles.set_from_triangles(triangulate_expolygon_2f(logo_poly, NORMALS_UP), GROUND_Z + 0.02f)) { if (!m_logo_triangles.set_from_triangles(triangulate_expolygon_2f(logo_poly, NORMALS_UP), GROUND_Z + 0.02f)) {
@ -2720,7 +2728,8 @@ bool PartPlate::set_shape(const Pointfs& shape, const Pointfs& exclude_areas, Ve
; ;
} }
if (m_partplate_list && m_partplate_list->m_bed3d && !m_partplate_list->m_bed3d->get_model_filename().empty()) { if (m_partplate_list && m_partplate_list->m_bed3d && !m_partplate_list->m_bed3d->get_model_filename().empty()) {
set_logo_box_by_bed(m_partplate_list->m_bed3d->get_model().get_bounding_box()); auto cur_bed = m_partplate_list->m_bed3d;
set_logo_box_by_bed(cur_bed->get_model().get_bounding_box().transformed(Geometry::translation_transform(m_origin)));
} }
ExPolygon poly; ExPolygon poly;

View File

@ -121,6 +121,7 @@ private:
Pointfs m_exclude_area; Pointfs m_exclude_area;
BoundingBoxf3 m_bounding_box; BoundingBoxf3 m_bounding_box;
BoundingBoxf3 m_extended_bounding_box; BoundingBoxf3 m_extended_bounding_box;
BoundingBoxf3 m_cur_bed_boundingbox;
mutable std::vector<BoundingBoxf3> m_exclude_bounding_box; mutable std::vector<BoundingBoxf3> m_exclude_bounding_box;
mutable BoundingBoxf3 m_grabber_box; mutable BoundingBoxf3 m_grabber_box;
Transform3d m_grabber_trans_matrix; Transform3d m_grabber_trans_matrix;
@ -186,7 +187,7 @@ private:
void calc_vertex_for_icons(int index, GeometryBuffer &buffer); void calc_vertex_for_icons(int index, GeometryBuffer &buffer);
void calc_vertex_for_icons_background(int icon_count, GeometryBuffer &buffer); void calc_vertex_for_icons_background(int icon_count, GeometryBuffer &buffer);
void render_background(bool force_default_color = false) const; void render_background(bool force_default_color = false) const;
void render_logo(bool bottom, bool render_cali = true) const; void render_logo(bool bottom, bool render_cali = true);
void render_logo_texture(GLTexture& logo_texture, const GeometryBuffer& logo_buffer, bool bottom, unsigned int vbo_id) const; void render_logo_texture(GLTexture& logo_texture, const GeometryBuffer& logo_buffer, bool bottom, unsigned int vbo_id) const;
void render_exclude_area(bool force_default_color) const; void render_exclude_area(bool force_default_color) const;
//void render_background_for_picking(const float* render_color) const; //void render_background_for_picking(const float* render_color) const;

View File

@ -5513,6 +5513,9 @@ wxSizer* TabPrinter::create_bed_shape_widget(wxWindow* parent)
} }
load_key_value("bed_custom_texture", custom_texture); load_key_value("bed_custom_texture", custom_texture);
update_changed_ui(); update_changed_ui();
if (custom_texture == "") {
wxGetApp().plater()->get_partplate_list().update_logo_texture_filename("");
}
} else { } else {
const std::vector<Vec2d> &shape = dlg.get_shape(); const std::vector<Vec2d> &shape = dlg.get_shape();
const std::string & custom_texture = dlg.get_custom_texture(); const std::string & custom_texture = dlg.get_custom_texture();