From 7d488e3424b76b4e4d66fd7d49c7d8971f20429d Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Wed, 3 Apr 2019 12:45:06 +0200 Subject: [PATCH 1/6] Added call to schedule_background_process() when deleting modifier attribute --- src/slic3r/GUI/GUI_ObjectSettings.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/GUI_ObjectSettings.cpp b/src/slic3r/GUI/GUI_ObjectSettings.cpp index 4c0879ad3..cd995bc09 100644 --- a/src/slic3r/GUI/GUI_ObjectSettings.cpp +++ b/src/slic3r/GUI/GUI_ObjectSettings.cpp @@ -85,7 +85,8 @@ void ObjectSettings::update_settings_list() #endif // __WXMSW__ btn->Bind(wxEVT_BUTTON, [opt_key, config, this](wxEvent &event) { config->erase(opt_key); - wxTheApp->CallAfter([this]() { + wxGetApp().obj_list()->part_settings_changed(); + wxTheApp->CallAfter([this]() { wxWindowUpdateLocker noUpdates(m_parent); update_settings_list(); m_parent->Layout(); From 69027b53fd8689ec2c9c7352e8580cd3fea76adf Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Wed, 3 Apr 2019 14:44:15 +0200 Subject: [PATCH 2/6] SLA gizmo now allows to deselect a point --- src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp | 21 ++++++++++++++++++-- src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.hpp | 1 + 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp index 5be7f9100..2264c541e 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp @@ -330,8 +330,12 @@ bool GLGizmoSlaSupports::gizmo_event(SLAGizmoEventType action, const Vec2d& mous m_canvas_width = m_parent.get_canvas_size().get_width(); m_canvas_height = m_parent.get_canvas_size().get_height(); } - else - select_point(m_hover_id); + else { + if (m_editing_mode_cache[m_hover_id].selected) + unselect_point(m_hover_id); + else + select_point(m_hover_id); + } return true; } @@ -791,6 +795,19 @@ void GLGizmoSlaSupports::select_point(int i) } +void GLGizmoSlaSupports::unselect_point(int i) +{ + m_editing_mode_cache[i].selected = false; + m_selection_empty = true; + for (const CacheEntry& ce : m_editing_mode_cache) { + if (ce.selected) { + m_selection_empty = false; + break; + } + } +} + + void GLGizmoSlaSupports::editing_mode_discard_changes() { diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.hpp b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.hpp index 7e8113774..bb3cf06ce 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.hpp @@ -93,6 +93,7 @@ private: NoPoints, }; void select_point(int i); + void unselect_point(int i); void editing_mode_apply_changes(); void editing_mode_discard_changes(); void editing_mode_reload_cache(); From 28ec3415eb45de9827bad22d5309456045f7b26e Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Wed, 3 Apr 2019 15:28:09 +0200 Subject: [PATCH 3/6] Keep instance mode selection when at least one instance is already selected --- src/slic3r/GUI/Selection.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index 7103ca12d..ca245029c 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -108,21 +108,26 @@ void Selection::add(unsigned int volume_idx, bool as_single_selection) if (is_wipe_tower() && volume->is_wipe_tower) return; + bool keep_instance_mode = (m_mode == Instance) && !as_single_selection && (is_single_full_instance() || is_multiple_full_instance()); + // resets the current list if needed bool needs_reset = as_single_selection; needs_reset |= volume->is_wipe_tower; needs_reset |= is_wipe_tower() && !volume->is_wipe_tower; - needs_reset |= !is_modifier() && volume->is_modifier; + needs_reset |= !keep_instance_mode && !is_modifier() && volume->is_modifier; needs_reset |= is_modifier() && !volume->is_modifier; if (needs_reset) clear(); if (!contains_volume(volume_idx)) - m_mode = volume->is_modifier ? Volume : Instance; + { + if (!keep_instance_mode) + m_mode = volume->is_modifier ? Volume : Instance; + } else - // keep current mode - return; + // keep current mode + return; switch (m_mode) { From c99fe20504ea72e06c35620e7e779c8f5a1c32b7 Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Wed, 3 Apr 2019 16:31:40 +0200 Subject: [PATCH 4/6] imgui: Yet another font size fix --- src/slic3r/GUI/ImGuiWrapper.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/slic3r/GUI/ImGuiWrapper.cpp b/src/slic3r/GUI/ImGuiWrapper.cpp index 1b4d4edf9..8a6a71b1b 100644 --- a/src/slic3r/GUI/ImGuiWrapper.cpp +++ b/src/slic3r/GUI/ImGuiWrapper.cpp @@ -340,13 +340,11 @@ bool ImGuiWrapper::want_any_input() const void ImGuiWrapper::init_font() { - const float font_size = m_font_size * m_style_scaling; - destroy_font(); ImGuiIO& io = ImGui::GetIO(); io.Fonts->Clear(); - ImFont* font = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/NotoSans-Regular.ttf").c_str(), font_size, nullptr, m_glyph_ranges); + ImFont* font = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/NotoSans-Regular.ttf").c_str(), m_font_size, nullptr, m_glyph_ranges); if (font == nullptr) { font = io.Fonts->AddFontDefault(); if (font == nullptr) { From 703b9bda324d656182e17cdf95b82abf358819e6 Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Wed, 3 Apr 2019 16:39:28 +0200 Subject: [PATCH 5/6] imgui: Fix scaling --- src/slic3r/GUI/ImGuiWrapper.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/ImGuiWrapper.hpp b/src/slic3r/GUI/ImGuiWrapper.hpp index c1bf491e1..b593054c4 100644 --- a/src/slic3r/GUI/ImGuiWrapper.hpp +++ b/src/slic3r/GUI/ImGuiWrapper.hpp @@ -45,8 +45,8 @@ public: void new_frame(); void render(); - float scaled(float x) const { return x * m_font_size * m_style_scaling; } - ImVec2 scaled(float x, float y) const { return ImVec2(x * m_font_size * m_style_scaling, y * m_font_size * m_style_scaling); } + float scaled(float x) const { return x * m_font_size; } + ImVec2 scaled(float x, float y) const { return ImVec2(x * m_font_size, y * m_font_size); } ImVec2 calc_text_size(const wxString &text); void set_next_window_pos(float x, float y, int flag); From a7318dbe197d0a05d368865fe169751f07840cd7 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Thu, 4 Apr 2019 09:01:47 +0200 Subject: [PATCH 6/6] Keeps non selected instances as disabled for any combination of current instance's volumes selection --- src/slic3r/GUI/Selection.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index ca245029c..db25e6332 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -1147,16 +1147,12 @@ void Selection::_update_type() } if (modifiers_count == 0) - { m_type = MultipleVolume; - requires_disable = true; - } else if (modifiers_count == (unsigned int)m_list.size()) - { m_type = MultipleModifier; - requires_disable = true; - } } + + requires_disable = true; } else if ((selected_instances_count > 1) && (selected_instances_count * volumes_count == (unsigned int)m_list.size())) {