From 457ded43c3976580d82e524d3f9e92c6f2c3c953 Mon Sep 17 00:00:00 2001 From: David Kocik Date: Wed, 22 Sep 2021 12:36:41 +0200 Subject: [PATCH 1/4] Instance check: Error output with lock file location --- src/slic3r/GUI/InstanceCheck.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/InstanceCheck.cpp b/src/slic3r/GUI/InstanceCheck.cpp index 9535e0126a..38ea95f2c8 100644 --- a/src/slic3r/GUI/InstanceCheck.cpp +++ b/src/slic3r/GUI/InstanceCheck.cpp @@ -352,10 +352,16 @@ bool instance_check(int argc, char** argv, bool app_config_single_instance) if (instance_check_internal::get_lock(lock_name + ".lock", data_dir() + "/cache/") && *cla.should_send) { #endif instance_check_internal::send_message(cla.cl_string, lock_name); - BOOST_LOG_TRIVIAL(info) << "instance check: Another instance found. This instance will terminate."; + BOOST_LOG_TRIVIAL(error) << "Instance check: Another instance found. This instance will terminate. Lock file of current running instance is located at " << data_dir() << +#ifdef _WIN32 + "\\cache\\" +#else // mac & linx + "/cache/" +#endif + << lock_name << ".lock"; return true; } - BOOST_LOG_TRIVIAL(info) << "instance check: Another instance not found or single-instance not set."; + BOOST_LOG_TRIVIAL(info) << "Instance check: Another instance not found or single-instance not set."; return false; } From e477903d3e6f23b549e343f9b5ef6aef84e8f6bf Mon Sep 17 00:00:00 2001 From: YuSanka Date: Wed, 22 Sep 2021 15:31:58 +0200 Subject: [PATCH 2/4] MSW specific: Fixed settings layout after switching from New to Old layout (Notebook: Added check of a visibility of just selected tab in notebook) --- src/slic3r/GUI/MainFrame.cpp | 5 +++-- src/slic3r/GUI/Notebook.hpp | 13 ++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 027e9ce977..b42a9c7bf8 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -435,8 +435,9 @@ void MainFrame::update_layout() { m_plater->Reparent(m_tabpanel); #ifdef _MSW_DARK_MODE + m_plater->Layout(); if (!wxGetApp().tabs_as_menu()) - dynamic_cast(m_tabpanel)->InsertPage(0, m_plater, _L("Plater"), std::string("plater")); + dynamic_cast(m_tabpanel)->InsertPage(0, m_plater, _L("Plater"), std::string("plater"), true); else #endif m_tabpanel->InsertPage(0, m_plater, _L("Plater")); @@ -461,7 +462,7 @@ void MainFrame::update_layout() m_plater_page = new wxPanel(m_tabpanel); #ifdef _MSW_DARK_MODE if (!wxGetApp().tabs_as_menu()) - dynamic_cast(m_tabpanel)->InsertPage(0, m_plater_page, _L("Plater"), std::string("plater")); + dynamic_cast(m_tabpanel)->InsertPage(0, m_plater_page, _L("Plater"), std::string("plater"), true); else #endif m_tabpanel->InsertPage(0, m_plater_page, _L("Plater")); // empty panel just for Plater tab */ diff --git a/src/slic3r/GUI/Notebook.hpp b/src/slic3r/GUI/Notebook.hpp index 56e6ddf6cb..56ae5b2851 100644 --- a/src/slic3r/GUI/Notebook.hpp +++ b/src/slic3r/GUI/Notebook.hpp @@ -165,8 +165,8 @@ public: GetBtnsListCtrl()->InsertPage(n, text, bSelect, bmp_name); - if (!DoSetSelectionAfterInsertion(n, bSelect)) - page->Hide(); + if (bSelect) + SetSelection(n); return true; } @@ -174,7 +174,14 @@ public: virtual int SetSelection(size_t n) override { GetBtnsListCtrl()->SetSelection(n); - return DoSetSelection(n, SetSelection_SendEvent); + int ret = DoSetSelection(n, SetSelection_SendEvent); + + // check that only the selected page is visible and others are hidden: + for (size_t page = 0; page < m_pages.size(); page++) + if (page != n) + m_pages[page]->Hide(); + + return ret; } virtual int ChangeSelection(size_t n) override From e48c320f6d6fc30b60e7b5867dddd816f3dbeb8d Mon Sep 17 00:00:00 2001 From: YuSanka Date: Wed, 22 Sep 2021 15:53:19 +0200 Subject: [PATCH 3/4] Fix for #6958 - GUI Setting non modal window: Search broken when main window hidden (minimized) --- src/slic3r/GUI/Plater.cpp | 7 +------ src/slic3r/GUI/Search.cpp | 22 +++++++++++++++++++--- src/slic3r/GUI/Search.hpp | 2 ++ 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index f4b7e758a0..9e7409c116 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -6536,12 +6536,7 @@ void Plater::search(bool plater_is_active) canvas3D()->on_char(evt); } else - { - wxPoint pos = this->ClientToScreen(wxPoint(0, 0)); - pos.x += em_unit(this) * 40; - pos.y += em_unit(this) * 4; - p->sidebar->get_searcher().search_dialog->Popup(pos); - } + p->sidebar->get_searcher().show_dialog(); } void Plater::msw_rescale() diff --git a/src/slic3r/GUI/Search.cpp b/src/slic3r/GUI/Search.cpp index 83d60ac6e9..000ebf4027 100644 --- a/src/slic3r/GUI/Search.cpp +++ b/src/slic3r/GUI/Search.cpp @@ -289,7 +289,6 @@ bool OptionsSearcher::search(const std::string& search, bool force/* = false*/) OptionsSearcher::OptionsSearcher() { - search_dialog = new SearchDialog(this); } OptionsSearcher::~OptionsSearcher() @@ -386,6 +385,22 @@ Option OptionsSearcher::get_option(const std::string& opt_key, const wxString& l return create_option(opt_key, label, type, gc); } +void OptionsSearcher::show_dialog() +{ + if (!search_dialog) { + search_dialog = new SearchDialog(this); + + auto parent = search_dialog->GetParent(); + wxPoint pos = parent->ClientToScreen(wxPoint(0, 0)); + pos.x += em_unit(parent) * 40; + pos.y += em_unit(parent) * 4; + + search_dialog->SetPosition(pos); + } + + search_dialog->Popup(); +} + void OptionsSearcher::add_key(const std::string& opt_key, Preset::Type type, const wxString& group, const wxString& category) { groups_and_categories[get_key(opt_key, type)] = GroupAndCategory{group, category}; @@ -405,7 +420,7 @@ static const std::map icon_idxs = { }; SearchDialog::SearchDialog(OptionsSearcher* searcher) - : GUI::DPIDialog(NULL, wxID_ANY, _L("Search"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER), + : GUI::DPIDialog(GUI::wxGetApp().tab_panel(), wxID_ANY, _L("Search"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER), searcher(searcher) { SetFont(GUI::wxGetApp().normal_font()); @@ -506,7 +521,8 @@ void SearchDialog::Popup(wxPoint position /*= wxDefaultPosition*/) if (check_english) check_english->SetValue(params.english); - this->SetPosition(position); + if (position != wxDefaultPosition) + this->SetPosition(position); this->ShowModal(); } diff --git a/src/slic3r/GUI/Search.hpp b/src/slic3r/GUI/Search.hpp index a942a89f8a..99575e1fae 100644 --- a/src/slic3r/GUI/Search.hpp +++ b/src/slic3r/GUI/Search.hpp @@ -134,6 +134,8 @@ public: return o1.key < o2.key; }); } void sort_options_by_label() { sort_options(); } + + void show_dialog(); }; From 284721e0de1eedfedb3704e113aeff5bd8cf97c0 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Wed, 22 Sep 2021 21:30:29 +0200 Subject: [PATCH 4/4] Fix of #4666 (selection rectangle in SLA gizmo incorrectly handles transformations) --- src/slic3r/GUI/MeshUtils.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/slic3r/GUI/MeshUtils.cpp b/src/slic3r/GUI/MeshUtils.cpp index 576728b247..0f72d0f781 100644 --- a/src/slic3r/GUI/MeshUtils.cpp +++ b/src/slic3r/GUI/MeshUtils.cpp @@ -253,11 +253,10 @@ std::vector MeshRaycaster::get_unobscured_idxs(const Geometry::Transfo std::vector out; const Transform3d& instance_matrix_no_translation_no_scaling = trafo.get_matrix(true,false,true); - Vec3f direction_to_camera = -camera.get_dir_forward().cast(); - Vec3f direction_to_camera_mesh = (instance_matrix_no_translation_no_scaling.inverse().cast() * direction_to_camera).normalized().eval(); - Vec3f scaling = trafo.get_scaling_factor().cast(); - direction_to_camera_mesh = Vec3f(direction_to_camera_mesh(0)*scaling(0), direction_to_camera_mesh(1)*scaling(1), direction_to_camera_mesh(2)*scaling(2)); - const Transform3f inverse_trafo = trafo.get_matrix().inverse().cast(); + Vec3d direction_to_camera = -camera.get_dir_forward(); + Vec3d direction_to_camera_mesh = (instance_matrix_no_translation_no_scaling.inverse() * direction_to_camera).normalized().eval(); + direction_to_camera_mesh = direction_to_camera_mesh.cwiseProduct(trafo.get_scaling_factor()); + const Transform3d inverse_trafo = trafo.get_matrix().inverse(); for (size_t i=0; i MeshRaycaster::get_unobscured_idxs(const Geometry::Transfo // Cast a ray in the direction of the camera and look for intersection with the mesh: std::vector hits; // Offset the start of the ray by EPSILON to account for numerical inaccuracies. - hits = m_emesh.query_ray_hits((inverse_trafo * pt + direction_to_camera_mesh * EPSILON).cast(), - direction_to_camera.cast()); - + hits = m_emesh.query_ray_hits((inverse_trafo * pt.cast() + direction_to_camera_mesh * EPSILON), + direction_to_camera_mesh); if (! hits.empty()) { // If the closest hit facet normal points in the same direction as the ray,