From cae1567726f956fb5b8ac46dc4da2065af32aec7 Mon Sep 17 00:00:00 2001 From: Sabriel-Koh <52443698+Sabriel-Koh@users.noreply.github.com> Date: Mon, 9 Feb 2026 22:27:03 +0800 Subject: [PATCH] fix: Show Labels and Show Overhang toggles not being saved (#12218) * fix: Show Labels and Show Overhang toggles not being saved * refactor: use get_bool and add comments --- src/libslic3r/AppConfig.cpp | 6 ++++++ src/slic3r/GUI/GLCanvas3D.cpp | 5 +++++ src/slic3r/GUI/Plater.cpp | 13 +++++++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/AppConfig.cpp b/src/libslic3r/AppConfig.cpp index bf21a965fa..a9f04aae19 100644 --- a/src/libslic3r/AppConfig.cpp +++ b/src/libslic3r/AppConfig.cpp @@ -252,6 +252,12 @@ void AppConfig::set_defaults() if (get("show_axes").empty()) set_bool("show_axes", true); + if (get("show_labels").empty()) + set_bool("show_labels", false); + + if (get("show_overhang").empty()) + set_bool("show_overhang", false); + #ifdef _WIN32 //#ifdef SUPPORT_3D_CONNEXION diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index fd9d1da218..91210b0786 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1250,6 +1250,11 @@ bool GLCanvas3D::init() on_change_color_mode(wxGetApp().app_config->get("dark_color_mode") == "1", false); m_show_world_axes = wxGetApp().app_config->get("show_axes") == "true"; + + // Controls the display of object names directly over the object + m_labels.show(wxGetApp().app_config->get_bool("show_labels")); + // Controls the color coding of overhang surfaces + m_slope.globalUse(wxGetApp().app_config->get_bool("show_labels")); BOOST_LOG_TRIVIAL(info) <<__FUNCTION__<< " enter"; glsafe(::glClearColor(1.0f, 1.0f, 1.0f, 1.0f)); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index ab982260d6..7aa9a24cd3 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -4341,12 +4341,21 @@ struct Plater::priv bool is_assemble_view_show() const { return current_panel == assemble_view; } bool are_view3D_labels_shown() const { return (current_panel == view3D) && view3D->get_canvas3d()->are_labels_shown(); } - void show_view3D_labels(bool show) { if (current_panel == view3D) view3D->get_canvas3d()->show_labels(show); } + void show_view3D_labels(bool show) + { + if (current_panel == view3D) { + view3D->get_canvas3d()->show_labels(show); + wxGetApp().app_config->set_bool("show_labels", show); + } + } bool is_view3D_overhang_shown() const { return (current_panel == view3D) && view3D->get_canvas3d()->is_overhang_shown(); } void show_view3D_overhang(bool show) { - if (current_panel == view3D) view3D->get_canvas3d()->show_overhang(show); + if (current_panel == view3D) { + view3D->get_canvas3d()->show_overhang(show); + wxGetApp().app_config->set_bool("show_overhang", show); + } } void enable_sidebar(bool enabled);