diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index fa7869e6a..66985b4e4 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1300,11 +1300,12 @@ bool PlaterDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &fi // FIXME: when drag and drop is done on a .3mf or a .amf file we should clear the plater for consistence with the open project command // (the following call to plater->load_files() will load the config data, if present) - plater->load_files(paths); + std::vector res = plater->load_files(paths); // because right now the plater is not cleared, we set the project file (from the latest imported .3mf or .amf file) // only if not set yet - if (plater->get_project_filename().empty()) + // if res is empty no data has been loaded + if (!res.empty() && plater->get_project_filename().empty()) { for (std::vector::const_reverse_iterator it = paths.rbegin(); it != paths.rend(); ++it) { @@ -4076,11 +4077,15 @@ void Plater::load_project(const wxString& filename) Plater::TakeSnapshot snapshot(this, _(L("Load Project")) + ": " + wxString::FromUTF8(into_path(filename).stem().string().c_str())); p->reset(); - p->set_project_filename(filename); std::vector input_paths; input_paths.push_back(into_path(filename)); - load_files(input_paths); + + std::vector res = load_files(input_paths); + + // if res is empty no data has been loaded + if (!res.empty()) + p->set_project_filename(filename); } void Plater::add_model() @@ -4127,16 +4132,16 @@ void Plater::extract_config_from_project() load_files(input_paths, false, true); } -void Plater::load_files(const std::vector& input_files, bool load_model, bool load_config) { p->load_files(input_files, load_model, load_config); } +std::vector Plater::load_files(const std::vector& input_files, bool load_model, bool load_config) { return p->load_files(input_files, load_model, load_config); } // To be called when providing a list of files to the GUI slic3r on command line. -void Plater::load_files(const std::vector& input_files, bool load_model, bool load_config) +std::vector Plater::load_files(const std::vector& input_files, bool load_model, bool load_config) { std::vector paths; paths.reserve(input_files.size()); - for (const std::string &path : input_files) + for (const std::string& path : input_files) paths.emplace_back(path); - p->load_files(paths, load_model, load_config); + return p->load_files(paths, load_model, load_config); } void Plater::update() { p->update(); } diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index c2d7545e9..2d104bc46 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -147,9 +147,9 @@ public: void add_model(); void extract_config_from_project(); - void load_files(const std::vector& input_files, bool load_model = true, bool load_config = true); + std::vector load_files(const std::vector& input_files, bool load_model = true, bool load_config = true); // To be called when providing a list of files to the GUI slic3r on command line. - void load_files(const std::vector& input_files, bool load_model = true, bool load_config = true); + std::vector load_files(const std::vector& input_files, bool load_model = true, bool load_config = true); void update(); void stop_jobs(); diff --git a/src/slic3r/GUI/PresetBundle.cpp b/src/slic3r/GUI/PresetBundle.cpp index 29f12a4d2..79d49f13a 100644 --- a/src/slic3r/GUI/PresetBundle.cpp +++ b/src/slic3r/GUI/PresetBundle.cpp @@ -1492,13 +1492,16 @@ void PresetBundle::update_platter_filament_ui(unsigned int idx_extruder, GUI::Pr // To avoid the errors of number rounding for different combination of monitor configuration, // let use scaled 8px, as a smallest icon unit const int icon_unit = 8 * scale_f + 0.5f; - const int icon_height = 2 * icon_unit; //16 * scale_f + 0.5f; const int normal_icon_width = 2 * icon_unit; //16 * scale_f + 0.5f; const int thin_icon_width = icon_unit; //8 * scale_f + 0.5f; const int wide_icon_width = 3 * icon_unit; //24 * scale_f + 0.5f; const int space_icon_width = 2 * scale_f + 0.5f; + // To avoid asserts, each added bitmap to wxBitmapCombobox should be the same size, so + // set a bitmap height to m_bitmapLock->GetHeight() + const int icon_height = m_bitmapLock->GetHeight();//2 * icon_unit; //16 * scale_f + 0.5f; + for (int i = this->filaments().front().is_visible ? 0 : 1; i < int(this->filaments().size()); ++i) { const Preset &preset = this->filaments.preset(i); bool selected = this->filament_presets[idx_extruder] == preset.name; diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index 79116dfc8..a41bb1147 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -2218,7 +2218,8 @@ void DoubleSlider::SetTicksValues(const std::vector& heights) for (auto h : heights) { while (i < m_values.size() && m_values[i].second - 1e-6 < h) ++i; - if (i == m_values.size()) + // don't miss last layer if it is + if (i == m_values.size() && fabs(m_values[i-1].second - h) > EPSILON) return; m_ticks.insert(i-1); } @@ -2293,6 +2294,10 @@ void DoubleSlider::draw_action_icon(wxDC& dc, const wxPoint pt_beg, const wxPoin { const int tick = m_selection == ssLower ? m_lower_value : m_higher_value; + // suppress add tick on first layer + if (tick == 0) + return; + wxBitmap* icon = m_is_action_icon_focesed ? &m_bmp_add_tick_off.bmp() : &m_bmp_add_tick_on.bmp(); if (m_ticks.find(tick) != m_ticks.end()) icon = m_is_action_icon_focesed ? &m_bmp_del_tick_off.bmp() : &m_bmp_del_tick_on.bmp();