From 7395b923bd17593880b0a6039c34641ec515c89c Mon Sep 17 00:00:00 2001 From: YuSanka Date: Mon, 3 Dec 2018 13:29:07 +0100 Subject: [PATCH] Update gizmos on/off state --- src/slic3r/GUI/GLCanvas3D.cpp | 6 ++++++ src/slic3r/GUI/GLCanvas3D.hpp | 2 ++ src/slic3r/GUI/GUI_ObjectList.cpp | 6 +++--- src/slic3r/GUI/Plater.cpp | 1 + 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 5f9f6a401..24082c5cb 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -5248,6 +5248,12 @@ void GLCanvas3D::set_camera_zoom(float zoom) _refresh_if_shown_on_screen(); } +void GLCanvas3D::update_gizmos_on_off_state() +{ + set_as_dirty(); + m_gizmos.update_on_off_state(get_selection()); +} + bool GLCanvas3D::_is_shown_on_screen() const { return (m_canvas != nullptr) ? m_canvas->IsShownOnScreen() : false; diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 6567ac9ba..8391f6b49 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -919,6 +919,8 @@ public: void set_camera_zoom(float zoom); + void update_gizmos_on_off_state(); + private: bool _is_shown_on_screen() const; void _force_zoom_to_bed(); diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 3de6ca281..497b65a93 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -1405,7 +1405,7 @@ void ObjectList::update_selections_on_canvas() const int sel_cnt = GetSelectedItemsCount(); if (sel_cnt == 0) { selection.clear(); - wxGetApp().plater()->canvas3D()->set_as_dirty(); + wxGetApp().plater()->canvas3D()->update_gizmos_on_off_state(); return; } @@ -1435,7 +1435,7 @@ void ObjectList::update_selections_on_canvas() else add_to_selection(item, selection, true); - wxGetApp().plater()->canvas3D()->set_as_dirty(); + wxGetApp().plater()->canvas3D()->update_gizmos_on_off_state(); return; } @@ -1446,7 +1446,7 @@ void ObjectList::update_selections_on_canvas() for (auto item: sels) add_to_selection(item, selection, false); - wxGetApp().plater()->canvas3D()->set_as_dirty(); + wxGetApp().plater()->canvas3D()->update_gizmos_on_off_state(); } void ObjectList::select_item(const wxDataViewItem& item) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 12468c0d2..6dec67acf 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1563,6 +1563,7 @@ void Plater::priv::object_list_changed() void Plater::priv::select_all() { this->canvas3D->select_all(); + this->sidebar->obj_list()->update_selections(); } void Plater::priv::remove(size_t obj_idx)