From 4ae89cf291caab261365bf119ab2a2a0d6cbeb3d Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Mon, 2 Sep 2019 09:38:45 +0200 Subject: [PATCH 1/3] Attempt to fix non compatible (newer) .3mf and .amf import error handling on Linux and OsX --- src/libslic3r/Format/3mf.cpp | 2 +- src/libslic3r/Format/AMF.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/Format/3mf.cpp b/src/libslic3r/Format/3mf.cpp index 2a8b4d1d300..d4f72ffb32c 100644 --- a/src/libslic3r/Format/3mf.cpp +++ b/src/libslic3r/Format/3mf.cpp @@ -567,7 +567,7 @@ namespace Slic3r { { // ensure the zip archive is closed and rethrow the exception close_zip_reader(&archive); - throw e; + throw std::runtime_error(e.what()); } } } diff --git a/src/libslic3r/Format/AMF.cpp b/src/libslic3r/Format/AMF.cpp index 7850c17fdc1..f43724cb645 100644 --- a/src/libslic3r/Format/AMF.cpp +++ b/src/libslic3r/Format/AMF.cpp @@ -872,7 +872,7 @@ bool load_amf_archive(const char* path, DynamicPrintConfig* config, Model* model { // ensure the zip archive is closed and rethrow the exception close_zip_reader(&archive); - throw e; + throw std::runtime_error(e.what()); } break; From 1e4b8f9fcdd4838e624e95adf2687929c5c0e7af Mon Sep 17 00:00:00 2001 From: YuSanka Date: Mon, 2 Sep 2019 10:03:07 +0200 Subject: [PATCH 2/3] Fixed side effect after changes in https://github.com/prusa3d/PrusaSlicer/commit/54cf0f22d5654cc0d1794144e466321dd33255b6 + Code cleaning --- src/slic3r/GUI/wxExtensions.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index 127f7d743c0..79116dfc84b 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -786,7 +786,12 @@ wxDataViewItem ObjectDataViewModel::AddInstanceRoot(const wxDataViewItem &parent wxDataViewItem ObjectDataViewModel::AddInstanceChild(const wxDataViewItem &parent_item, size_t num) { - const std::vector print_indicator(num, true); + std::vector print_indicator(num, true); + + // if InstanceRoot item isn't created for this moment + if (!GetInstanceRootItem(parent_item).IsOk()) + // use object's printable state to first instance + print_indicator[0] = IsPrintable(parent_item); return wxDataViewItem((void*)AddInstanceChild(parent_item, print_indicator)); } @@ -799,21 +804,12 @@ wxDataViewItem ObjectDataViewModel::AddInstanceChild(const wxDataViewItem& paren ObjectDataViewModelNode* inst_root_node = (ObjectDataViewModelNode*)inst_root_item.GetID(); - const bool just_created = inst_root_node->GetChildren().Count() == 0; - // Add instance nodes ObjectDataViewModelNode *instance_node = nullptr; size_t counter = 0; while (counter < print_indicator.size()) { instance_node = new ObjectDataViewModelNode(inst_root_node, itInstance); -// // if InstanceRoot item is just created and start to adding Instances -// if (just_created && counter == 0) { -// ObjectDataViewModelNode* obj_node = (ObjectDataViewModelNode*)parent_item.GetID(); -// // use object's printable state to first instance -// instance_node->set_printable_icon(obj_node->IsPrintable()); -// } -// else instance_node->set_printable_icon(print_indicator[counter] ? piPrintable : piUnprintable); inst_root_node->Append(instance_node); From c698e9c902d88dce60fed0dbbf942df2aa082eab Mon Sep 17 00:00:00 2001 From: YuSanka Date: Mon, 2 Sep 2019 10:53:07 +0200 Subject: [PATCH 3/3] Fix of #2850 --- src/slic3r/GUI/PresetBundle.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/PresetBundle.cpp b/src/slic3r/GUI/PresetBundle.cpp index af1298bfb94..29f12a4d271 100644 --- a/src/slic3r/GUI/PresetBundle.cpp +++ b/src/slic3r/GUI/PresetBundle.cpp @@ -1532,7 +1532,9 @@ void PresetBundle::update_platter_filament_ui(unsigned int idx_extruder, GUI::Pr } // Paint a lock at the system presets. bmps.emplace_back(m_bitmapCache->mkclear(space_icon_width, icon_height)); - bmps.emplace_back((preset.is_system || preset.is_default) ? *m_bitmapLock : m_bitmapCache->mkclear(normal_icon_width, icon_height)); + // To avoid asserts, each added bitmap to wxBitmapCombobox should be the same size, so + // for nonsystem presets set a width of empty bitmap to m_bitmapLock->GetWidth() + bmps.emplace_back((preset.is_system || preset.is_default) ? *m_bitmapLock : m_bitmapCache->mkclear(m_bitmapLock->GetWidth(), icon_height)); // (preset.is_dirty ? *m_bitmapLockOpen : *m_bitmapLock) : m_bitmapCache->mkclear(16, 16)); bitmap = m_bitmapCache->insert(bitmap_key, bmps); }