From 74e4a743af3eb939307baff8df1d84f2ef5dd176 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 12 Nov 2019 10:28:01 +0100 Subject: [PATCH] Added missed update for a config after extruder change from the ObjectList. Fixed erase "tool_change" ticks from ticks set. --- src/slic3r/GUI/GUI_ObjectList.cpp | 1 + src/slic3r/GUI/wxExtensions.cpp | 15 ++++++++++++--- src/slic3r/GUI/wxExtensions.hpp | 14 ++++++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 0fef8988e4..aa10aca52f 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -917,6 +917,7 @@ void ObjectList::extruder_editing() m_objects_model->SetExtruder(m_extruder_editor->GetString(selection), item); m_extruder_editor->Hide(); + update_extruder_in_config(item); }; // to avoid event propagation to other sidebar items diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index 8cfbf2206c..e273238861 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -3744,10 +3744,19 @@ void DoubleSlider::edit_extruder_sequence() if (dlg.ShowModal() != wxID_OK) return; - m_extruders_sequence = dlg.GetValue(); + const ExtrudersSequence& from_dlg_val = dlg.GetValue(); + if (m_extruders_sequence == from_dlg_val) + return; - m_ticks_.erase(std::remove_if(m_ticks_.begin(), m_ticks_.end(), - [](TICK_CODE tick) { return tick.gcode == Slic3r::ExtruderChangeCode; }), m_ticks_.end()); + m_extruders_sequence = from_dlg_val; + + auto it = m_ticks_.begin(); + while (it != m_ticks_.end()) { + if (it->gcode == Slic3r::ExtruderChangeCode) + it = m_ticks_.erase(it); + else + ++it; + } int tick = 0; double value = 0.0; diff --git a/src/slic3r/GUI/wxExtensions.hpp b/src/slic3r/GUI/wxExtensions.hpp index 32e96f3263..cedff40c5e 100644 --- a/src/slic3r/GUI/wxExtensions.hpp +++ b/src/slic3r/GUI/wxExtensions.hpp @@ -1014,6 +1014,20 @@ public: return *this; } + bool operator==(const ExtrudersSequence& other) const + { + return (other.is_mm_intervals == this->is_mm_intervals ) && + (other.interval_by_mm == this->interval_by_mm ) && + (other.interval_by_layers == this->interval_by_layers ) && + (other.extruders == this->extruders ) ; + } + bool operator!=(const ExtrudersSequence& other) const + { + return (other.is_mm_intervals != this->is_mm_intervals ) && + (other.interval_by_mm != this->interval_by_mm ) && + (other.interval_by_layers != this->interval_by_layers ) && + (other.extruders != this->extruders ) ; + } void add_extruder(size_t pos) {