From 90d865c0222625a5c2ae70e358afd27131418ef0 Mon Sep 17 00:00:00 2001 From: supermerill Date: Sat, 9 Nov 2024 16:56:27 +0100 Subject: [PATCH] Fix duplicate_distance refresh. --- src/slic3r/GUI/ArrangeSettingsDialogImgui.cpp | 5 +++-- src/slic3r/GUI/ArrangeSettingsDialogImgui.hpp | 2 +- src/slic3r/GUI/GLCanvas3D.hpp | 2 +- src/slic3r/GUI/Tab.cpp | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/ArrangeSettingsDialogImgui.cpp b/src/slic3r/GUI/ArrangeSettingsDialogImgui.cpp index 92d595bdbd..1af7d65511 100644 --- a/src/slic3r/GUI/ArrangeSettingsDialogImgui.cpp +++ b/src/slic3r/GUI/ArrangeSettingsDialogImgui.cpp @@ -138,7 +138,7 @@ void ArrangeSettingsDialogImgui::render(float pos_x, float pos_y) m_imgui->end(); } -void ArrangeSettingsDialogImgui::set_arrange_settings(const DynamicPrintConfig &conf, PrinterTechnology tech) +void ArrangeSettingsDialogImgui::set_arrange_settings_distance_from_objects(const DynamicPrintConfig &conf, PrinterTechnology tech) { const ConfigOptionFloat *dd_opt = conf.option("duplicate_distance"); @@ -148,7 +148,8 @@ void ArrangeSettingsDialogImgui::set_arrange_settings(const DynamicPrintConfig & dist = dd_opt->value; } else if (tech == ptFFF) { const ConfigOptionBool *co_opt = conf.option("complete_objects"); - if (co_opt && co_opt->value) { + const ConfigOption *nz_opt = conf.option("nozzle_diameter"); + if (co_opt && co_opt->value && nz_opt) { dist = float(min_object_distance(&conf, 0.) * 2); } else { dist = 0.f; diff --git a/src/slic3r/GUI/ArrangeSettingsDialogImgui.hpp b/src/slic3r/GUI/ArrangeSettingsDialogImgui.hpp index dfdae163d0..90c7e976aa 100644 --- a/src/slic3r/GUI/ArrangeSettingsDialogImgui.hpp +++ b/src/slic3r/GUI/ArrangeSettingsDialogImgui.hpp @@ -49,7 +49,7 @@ class ArrangeSettingsDialogImgui: public arr2::ArrangeSettingsView { bool is_rotation_enabled() const override { return m_db.is_rotation_enabled(); } // update arrange dist from current print conf. - void set_arrange_settings(const DynamicPrintConfig &conf, PrinterTechnology tech); + void set_arrange_settings_distance_from_objects(const DynamicPrintConfig &conf, PrinterTechnology tech); XLPivots get_xl_alignment() const override { return m_db.get_xl_alignment(); } GeometryHandling get_geometry_handling() const override { return m_db.get_geometry_handling(); } diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 9af8d09a7f..d34b57d6e7 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -768,7 +768,7 @@ class GLCanvas3D const Model* get_model() const { return m_model; } const arr2::ArrangeSettingsView * get_arrange_settings_view() const { return &m_arrange_settings_dialog; } - void set_arrange_settings(const DynamicPrintConfig& conf, PrinterTechnology tech) { m_arrange_settings_dialog.set_arrange_settings(conf, tech); } + void set_arrange_settings_distance_from_objects(const DynamicPrintConfig& conf, PrinterTechnology tech) { m_arrange_settings_dialog.set_arrange_settings_distance_from_objects(conf, tech); } const Selection& get_selection() const { return m_selection; } Selection& get_selection() { return m_selection; } diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index c5bb33b972..f0a6697763 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1437,7 +1437,7 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value) } if (opt_key == "duplicate_distance") { - wxGetApp().mainframe->plater()->canvas3D()->set_arrange_settings(m_presets->get_edited_preset().config, m_presets->get_edited_preset().printer_technology()); + wxGetApp().mainframe->plater()->canvas3D()->set_arrange_settings_distance_from_objects(*wxGetApp().mainframe->plater()->config(), m_presets->get_edited_preset().printer_technology()); } // reset variable layer height if min/max has changed, as it's probably now invalid. @@ -4199,7 +4199,7 @@ void Tab::load_current_preset() // apply duplicate_distance for print preset if (type() == Preset::TYPE_FFF_PRINT || type() == Preset::TYPE_SLA_PRINT) { - wxGetApp().mainframe->plater()->canvas3D()->set_arrange_settings(m_presets->get_edited_preset().config, m_presets->get_edited_preset().printer_technology()); + wxGetApp().mainframe->plater()->canvas3D()->set_arrange_settings_distance_from_objects(*wxGetApp().mainframe->plater()->config(), m_presets->get_edited_preset().printer_technology()); } // m_undo_to_sys_btn->Enable(!preset.is_default);