Skip to content

Commit

Permalink
Fix duplicate_distance refresh.
Browse files Browse the repository at this point in the history
  • Loading branch information
supermerill committed Nov 9, 2024
1 parent e2debc6 commit 90d865c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/slic3r/GUI/ArrangeSettingsDialogImgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ConfigOptionFloat>("duplicate_distance");

Expand All @@ -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<ConfigOptionBool>("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;
Expand Down
2 changes: 1 addition & 1 deletion src/slic3r/GUI/ArrangeSettingsDialogImgui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }
Expand Down
2 changes: 1 addition & 1 deletion src/slic3r/GUI/GLCanvas3D.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
4 changes: 2 additions & 2 deletions src/slic3r/GUI/Tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 90d865c

Please sign in to comment.