From 514bb23c6ce49cad049f4def313c18277e149d6e Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Thu, 5 Dec 2019 13:38:04 +0100 Subject: [PATCH 1/4] Add free functions to slice a TriangleMesh --- src/libslic3r/TriangleMesh.hpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/libslic3r/TriangleMesh.hpp b/src/libslic3r/TriangleMesh.hpp index 9c9f82040..ef935455e 100644 --- a/src/libslic3r/TriangleMesh.hpp +++ b/src/libslic3r/TriangleMesh.hpp @@ -198,6 +198,29 @@ private: void make_expolygons(std::vector &lines, const float closing_radius, ExPolygons* slices) const; }; +inline void slice_mesh( + const TriangleMesh & mesh, + const std::vector & z, + std::vector & layers, + TriangleMeshSlicer::throw_on_cancel_callback_type thr = nullptr) +{ + if (mesh.empty()) return; + TriangleMeshSlicer slicer(&mesh); + slicer.slice(z, &layers, thr); +} + +inline void slice_mesh( + const TriangleMesh & mesh, + const std::vector & z, + std::vector & layers, + float closing_radius, + TriangleMeshSlicer::throw_on_cancel_callback_type thr = nullptr) +{ + if (mesh.empty()) return; + TriangleMeshSlicer slicer(&mesh); + slicer.slice(z, closing_radius, &layers, thr); +} + TriangleMesh make_cube(double x, double y, double z); // Generate a TriangleMesh of a cylinder From cac64576c5aedf1fc34c28f2a73db59c92c043cc Mon Sep 17 00:00:00 2001 From: YuSanka Date: Thu, 5 Dec 2019 13:55:49 +0100 Subject: [PATCH 2/4] Fixed mode icons rendering under OSX (MacOSX10.14.sdk) --- src/slic3r/GUI/Tab.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index ee1750c37..a83922b95 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2929,7 +2929,13 @@ void Tab::OnTreeSelChange(wxTreeEvent& event) #ifdef __linux__ std::unique_ptr no_updates(new wxWindowUpdateLocker(this)); #else -// wxWindowUpdateLocker noUpdates(this); + /* On Windows we use DoubleBuffering during rendering, + * so on Window is no needed to call a Freeze/Thaw functions. + * But under OSX (builds compiled with MacOSX10.14.sdk) wxStaticBitmap rendering is broken without Freeze/Thaw call. + */ +#ifdef __WXOSX__ + wxWindowUpdateLocker noUpdates(this); +#endif #endif if (m_pages.empty()) From e2f859c3b20397df862926d056d29d0022f3e9a3 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Thu, 5 Dec 2019 14:21:28 +0100 Subject: [PATCH 3/4] Fixed filament/material sorting in the lists of ConfigWizard --- src/slic3r/GUI/ConfigWizard.cpp | 32 +++++++++++++++---------- src/slic3r/GUI/ConfigWizard_private.hpp | 7 +++--- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/slic3r/GUI/ConfigWizard.cpp b/src/slic3r/GUI/ConfigWizard.cpp index 4d523bc0b..5221bfff1 100644 --- a/src/slic3r/GUI/ConfigWizard.cpp +++ b/src/slic3r/GUI/ConfigWizard.cpp @@ -655,14 +655,6 @@ void PageMaterials::update_lists(int sel1, int sel2) sel2_prev = sel2; } - - // for the very begining - if ((wizard_p()->run_reason == ConfigWizard::RR_DATA_EMPTY || wizard_p()->run_reason == ConfigWizard::RR_DATA_LEGACY) - && list_l3->size() > 0 ) - { - list_l3->Check(0, true); - wizard_p()->update_presets_in_config(materials->appconfig_section(), list_l3->get_data(0), true); - } } void PageMaterials::select_material(int i) @@ -1254,7 +1246,7 @@ const std::string Materials::UNKNOWN = "(Unknown)"; void Materials::push(const Preset *preset) { - presets.insert(preset); + presets.push_back(preset); types.insert(technology & T_FFF ? Materials::get_filament_type(preset) : Materials::get_material_type(preset)); @@ -1527,6 +1519,10 @@ void ConfigWizard::priv::update_materials(Technology technology) } if (filament.is_compatible_with_printer(printer)) { + // Check if filament is already added + if (filaments.containts(&filament)) + continue; + filaments.push(&filament); if (!filament.alias.empty()) aliases_fff[filament.alias].insert(filament.name); @@ -1556,6 +1552,10 @@ void ConfigWizard::priv::update_materials(Technology technology) } if (material.is_compatible_with_printer(printer)) { + // Check if material is already added + if (sla_materials.containts(&material)) + continue; + sla_materials.push(&material); if (!material.alias.empty()) aliases_sla[material.alias].insert(material.name); @@ -1905,14 +1905,23 @@ ConfigWizard::ConfigWizard(wxWindow *parent) }); p->btn_prev->Bind(wxEVT_BUTTON, [this](const wxCommandEvent &) { this->p->index->go_prev(); }); - p->btn_next->Bind(wxEVT_BUTTON, [this](const wxCommandEvent &) { this->p->index->go_next(); }); + + p->btn_next->Bind(wxEVT_BUTTON, [this](const wxCommandEvent &) + { + // check, that there is selected at least one filament/material + ConfigWizardPage* active_page = this->p->index->active_page(); + if ( (active_page == p->page_filaments || active_page == p->page_sla_materials) + && !p->check_material_config()) + return; + this->p->index->go_next(); + }); + p->btn_finish->Bind(wxEVT_BUTTON, [this](const wxCommandEvent &) { if (!p->check_material_config()) return; this->EndModal(wxID_OK); }); -// p->btn_finish->Hide(); p->btn_sel_all->Bind(wxEVT_BUTTON, [this](const wxCommandEvent &) { p->any_sla_selected = true; @@ -1925,7 +1934,6 @@ ConfigWizard::ConfigWizard(wxWindow *parent) p->index->Bind(EVT_INDEX_PAGE, [this](const wxCommandEvent &) { const bool is_last = p->index->active_is_last(); p->btn_next->Show(! is_last); -// p->btn_finish->Show(is_last); if (is_last) p->btn_finish->SetFocus(); diff --git a/src/slic3r/GUI/ConfigWizard_private.hpp b/src/slic3r/GUI/ConfigWizard_private.hpp index 75cd23218..d0cd14b47 100644 --- a/src/slic3r/GUI/ConfigWizard_private.hpp +++ b/src/slic3r/GUI/ConfigWizard_private.hpp @@ -58,15 +58,16 @@ enum Technology { struct Materials { Technology technology; - std::set presets; + // use vector for the presets to purpose of save of presets sorting in the bundle + std::vector presets; std::set types; Materials(Technology technology) : technology(technology) {} void push(const Preset *preset); void clear(); - bool containts(const Preset *preset) { - return presets.find(preset) != presets.end(); + bool containts(const Preset *preset) const { + return std::find(presets.begin(), presets.end(), preset) != presets.end(); } const std::string& appconfig_section() const; From 8728f192c661f00e33a871a186a25dc9022aca8c Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Thu, 5 Dec 2019 14:43:18 +0100 Subject: [PATCH 4/4] Follow-up of c370bb7141360776f603c9eec679e8d276dda56b -> Do not force even size of toolbars icon textures --- src/slic3r/GUI/GLToolbar.cpp | 6 +++--- src/slic3r/GUI/Gizmos/GLGizmosManager.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/GLToolbar.cpp b/src/slic3r/GUI/GLToolbar.cpp index b955f39b4..2fc0590d5 100644 --- a/src/slic3r/GUI/GLToolbar.cpp +++ b/src/slic3r/GUI/GLToolbar.cpp @@ -1195,9 +1195,9 @@ bool GLToolbar::generate_icons_texture() const } unsigned int sprite_size_px = (unsigned int)(m_layout.icons_size * m_layout.scale); - // force even size - if (sprite_size_px % 2 != 0) - sprite_size_px += 1; +// // force even size +// if (sprite_size_px % 2 != 0) +// sprite_size_px += 1; bool res = m_icons_texture.load_from_svg_files_as_sprites_array(filenames, states, sprite_size_px, false); if (res) diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp index 8ea2f176a..0ac57da9f 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp @@ -956,9 +956,9 @@ bool GLGizmosManager::generate_icons_texture() const states.push_back(std::make_pair(0, true)); unsigned int sprite_size_px = (unsigned int)(m_overlay_icons_size * m_overlay_scale); - // force even size - if (sprite_size_px % 2 != 0) - sprite_size_px += 1; +// // force even size +// if (sprite_size_px % 2 != 0) +// sprite_size_px += 1; bool res = m_icons_texture.load_from_svg_files_as_sprites_array(filenames, states, sprite_size_px, false); if (res)