From 0ce485ecb0f8e0b0f7d247f30274bcde4175baa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hejl?= Date: Wed, 21 Jul 2021 12:54:13 +0200 Subject: [PATCH 1/4] Fixed some compiler warnings. --- src/slic3r/GUI/ConfigWizard.cpp | 2 ++ src/slic3r/GUI/Notebook.cpp | 2 +- src/slic3r/GUI/NotificationManager.cpp | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/ConfigWizard.cpp b/src/slic3r/GUI/ConfigWizard.cpp index aec5d3839b1..127a6417e8b 100644 --- a/src/slic3r/GUI/ConfigWizard.cpp +++ b/src/slic3r/GUI/ConfigWizard.cpp @@ -40,6 +40,7 @@ #include "slic3r/Utils/PresetUpdater.hpp" #include "format.hpp" #include "MsgDialog.hpp" +#include "libslic3r/libslic3r.h" #if defined(__linux__) && defined(__WXGTK3__) #define wxLinux_gtk3 true @@ -65,6 +66,7 @@ bool Bundle::load(fs::path source_path, bool ais_in_resources, bool ais_prusa_bu std::string path_string = source_path.string(); auto [config_substitutions, presets_loaded] = preset_bundle->load_configbundle(path_string, PresetBundle::LoadConfigBundleAttribute::LoadSystem); + UNUSED(config_substitutions); // No substitutions shall be reported when loading a system config bundle, no substitutions are allowed. assert(config_substitutions.empty()); auto first_vendor = preset_bundle->vendors.begin(); diff --git a/src/slic3r/GUI/Notebook.cpp b/src/slic3r/GUI/Notebook.cpp index afc0241d8cb..bcc1d2e595c 100644 --- a/src/slic3r/GUI/Notebook.cpp +++ b/src/slic3r/GUI/Notebook.cpp @@ -50,7 +50,7 @@ void ButtonsListCtrl::OnPaint(wxPaintEvent&) const wxColour& selected_btn_bg = Slic3r::GUI::wxGetApp().get_color_selected_btn_bg(); const wxColour& default_btn_bg = Slic3r::GUI::wxGetApp().get_highlight_default_clr(); const wxColour& btn_marker_color = Slic3r::GUI::wxGetApp().get_color_hovered_btn_label(); - for (int idx = 0; idx < m_pageButtons.size(); idx++) { + for (int idx = 0; idx < int(m_pageButtons.size()); idx++) { wxButton* btn = m_pageButtons[idx]; btn->SetBackgroundColour(idx == m_selection ? selected_btn_bg : default_btn_bg); diff --git a/src/slic3r/GUI/NotificationManager.cpp b/src/slic3r/GUI/NotificationManager.cpp index 6f51f0cf864..b000cbd69c9 100644 --- a/src/slic3r/GUI/NotificationManager.cpp +++ b/src/slic3r/GUI/NotificationManager.cpp @@ -272,9 +272,9 @@ void NotificationManager::PopNotification::count_lines() // find next suitable endline if (ImGui::CalcTextSize(text.substr(last_end).c_str()).x >= m_window_width - m_window_width_offset) { // more than one line till end - int next_space = text.find_first_of(' ', last_end); + size_t next_space = text.find_first_of(' ', last_end); if (next_space > 0 && next_space < text.length()) { - int next_space_candidate = text.find_first_of(' ', next_space + 1); + size_t next_space_candidate = text.find_first_of(' ', next_space + 1); while (next_space_candidate > 0 && ImGui::CalcTextSize(text.substr(last_end, next_space_candidate - last_end).c_str()).x < m_window_width - m_window_width_offset) { next_space = next_space_candidate; next_space_candidate = text.find_first_of(' ', next_space + 1); From 2203ada89c03fc1bb81b7e1d5c33f00dc2b2f0b2 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Wed, 21 Jul 2021 14:10:05 +0200 Subject: [PATCH 2/4] Tech ENABLE_RELOAD_FROM_DISK_FOR_3MF set as default --- src/libslic3r/Format/3mf.cpp | 6 ------ src/libslic3r/Technologies.hpp | 2 -- 2 files changed, 8 deletions(-) diff --git a/src/libslic3r/Format/3mf.cpp b/src/libslic3r/Format/3mf.cpp index 58592e0d7e6..613b7444af1 100644 --- a/src/libslic3r/Format/3mf.cpp +++ b/src/libslic3r/Format/3mf.cpp @@ -666,7 +666,6 @@ namespace Slic3r { close_zip_reader(&archive); -#if ENABLE_RELOAD_FROM_DISK_FOR_3MF if (m_version == 0) { // if the 3mf was not produced by PrusaSlicer and there is more than one instance, // split the object in as many objects as instances @@ -711,7 +710,6 @@ namespace Slic3r { ++i; } } -#endif // ENABLE_RELOAD_FROM_DISK_FOR_3MF for (const IdToModelObjectMap::value_type& object : m_objects) { if (object.second >= int(m_model->objects.size())) { @@ -779,7 +777,6 @@ namespace Slic3r { return false; } -#if ENABLE_RELOAD_FROM_DISK_FOR_3MF int object_idx = 0; for (ModelObject* o : model.objects) { int volume_idx = 0; @@ -795,7 +792,6 @@ namespace Slic3r { } ++object_idx; } -#endif // ENABLE_RELOAD_FROM_DISK_FOR_3MF // // fixes the min z of the model if negative // model.adjust_min_z(); @@ -1877,7 +1873,6 @@ namespace Slic3r { stl_get_size(&stl); triangle_mesh.repair(); -#if ENABLE_RELOAD_FROM_DISK_FOR_3MF if (m_version == 0) { // if the 3mf was not produced by PrusaSlicer and there is only one instance, // bake the transformation into the geometry to allow the reload from disk command @@ -1887,7 +1882,6 @@ namespace Slic3r { object.instances.front()->set_transformation(Slic3r::Geometry::Transformation()); } } -#endif // ENABLE_RELOAD_FROM_DISK_FOR_3MF ModelVolume* volume = object.add_volume(std::move(triangle_mesh)); // stores the volume matrix taken from the metadata, if present diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index 716e61a60a2..07a9c65712c 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -41,8 +41,6 @@ //==================== #define ENABLE_2_4_0_ALPHA0 1 -// Enable reload from disk command for 3mf files -#define ENABLE_RELOAD_FROM_DISK_FOR_3MF (1 && ENABLE_2_4_0_ALPHA0) // Enable showing gcode line numbers in preview horizontal slider #define ENABLE_GCODE_LINES_ID_IN_H_SLIDER (1 && ENABLE_2_4_0_ALPHA0) // Enable validation of custom gcode against gcode processor reserved keywords From f387a354bae8ae1cd7ef3259c0a87d2077c76a19 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Wed, 21 Jul 2021 12:55:25 +0200 Subject: [PATCH 3/4] Fix of asserting ImGui: ImGui does not want the io flags to change in between NewFrame and EndFrame. We did that - e.g. after a key down-key up combination with no render in between, or when key down and mouse move event were processed with no render in between. An assert was added in imgui to detect this between 1.75 and 1.83, which made the issue visible. Solution: only call the new_frame function in update_key_data/update_mouse_data when imgui actually consumes the input. This forces immediate render so EndFrame will be called. --- src/slic3r/GUI/ImGuiWrapper.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/slic3r/GUI/ImGuiWrapper.cpp b/src/slic3r/GUI/ImGuiWrapper.cpp index 799b5be4ac4..9980ba5a714 100644 --- a/src/slic3r/GUI/ImGuiWrapper.cpp +++ b/src/slic3r/GUI/ImGuiWrapper.cpp @@ -204,7 +204,8 @@ bool ImGuiWrapper::update_mouse_data(wxMouseEvent& evt) unsigned buttons = (evt.LeftIsDown() ? 1 : 0) | (evt.RightIsDown() ? 2 : 0) | (evt.MiddleIsDown() ? 4 : 0); m_mouse_buttons = buttons; - new_frame(); + if (want_mouse()) + new_frame(); return want_mouse(); } @@ -222,9 +223,6 @@ bool ImGuiWrapper::update_key_data(wxKeyEvent &evt) if (key != 0) { io.AddInputCharacter(key); } - - new_frame(); - return want_keyboard() || want_text_input(); } else { // Key up/down event int key = evt.GetKeyCode(); @@ -235,10 +233,11 @@ bool ImGuiWrapper::update_key_data(wxKeyEvent &evt) io.KeyCtrl = evt.ControlDown(); io.KeyAlt = evt.AltDown(); io.KeySuper = evt.MetaDown(); - - new_frame(); - return want_keyboard() || want_text_input(); } + bool ret = want_keyboard() || want_text_input(); + if (ret) + new_frame(); + return ret; } void ImGuiWrapper::new_frame() From 32bb7ea341964c2aea159ea0361f0cde26e6d700 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Wed, 21 Jul 2021 14:46:40 +0200 Subject: [PATCH 4/4] Removed unnecessary conditions that interfere with the search. --- src/slic3r/GUI/MainFrame.cpp | 2 +- src/slic3r/GUI/Tab.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index c81a4956919..8614acf6806 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -1985,7 +1985,7 @@ void MainFrame::select_tab(size_t tab/* = size_t(-1)*/) m_main_sizer->Show(m_tabpanel, tab != 0); // plater should be focused for correct navigation inside search window - if (tab == 0 && m_plater->canvas3D()->is_search_pressed()) + if (tab == 0) m_plater->SetFocus(); Layout(); } diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index b642610d868..99c1e15988a 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1172,7 +1172,7 @@ void Tab::activate_option(const std::string& opt_key, const wxString& category) wxString page_title = translate_category(category, m_type); auto cur_item = m_treectrl->GetFirstVisibleItem(); - if (!cur_item || !m_treectrl->IsVisible(cur_item)) + if (!cur_item) return; while (cur_item) {