From 47b54d5ce07cbb65ff50cf92fcb0e13bb621e566 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Wed, 6 Oct 2021 10:12:21 +0200 Subject: [PATCH] ObjectList: Fixed mouse click on the WarningIcon, when mesh wasn't repaired and isn't manifold. --- src/slic3r/GUI/GUI_ObjectList.cpp | 2 +- src/slic3r/GUI/ObjectDataViewModel.cpp | 9 +++++++++ src/slic3r/GUI/ObjectDataViewModel.hpp | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index b83f5e0a6..0cf57ee82 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -904,7 +904,7 @@ void ObjectList::list_manipulation(const wxPoint& mouse_pos, bool evt_context_me int obj_idx, vol_idx; get_selected_item_indexes(obj_idx, vol_idx, item); - if (get_mesh_errors_count(obj_idx, vol_idx) > 0 && + if (m_objects_model->HasWarningIcon(item) && mouse_pos.x > 2 * wxGetApp().em_unit() && mouse_pos.x < 4 * wxGetApp().em_unit()) fix_through_netfabb(); } diff --git a/src/slic3r/GUI/ObjectDataViewModel.cpp b/src/slic3r/GUI/ObjectDataViewModel.cpp index 746a99a2f..78735b925 100644 --- a/src/slic3r/GUI/ObjectDataViewModel.cpp +++ b/src/slic3r/GUI/ObjectDataViewModel.cpp @@ -1777,6 +1777,15 @@ void ObjectDataViewModel::DeleteWarningIcon(const wxDataViewItem& item, const bo } } +bool ObjectDataViewModel::HasWarningIcon(const wxDataViewItem& item) const +{ + if (!item.IsOk()) + return false; + + ObjectDataViewModelNode *node = static_cast(item.GetID()); + return node->has_warning_icon(); +} + } // namespace GUI } // namespace Slic3r diff --git a/src/slic3r/GUI/ObjectDataViewModel.hpp b/src/slic3r/GUI/ObjectDataViewModel.hpp index 95e53babd..ca7a0cde0 100644 --- a/src/slic3r/GUI/ObjectDataViewModel.hpp +++ b/src/slic3r/GUI/ObjectDataViewModel.hpp @@ -240,6 +240,7 @@ public: bool valid(); #endif /* NDEBUG */ bool invalid() const { return m_idx < -1; } + bool has_warning_icon() const { return !m_warning_icon_name.empty(); } private: friend class ObjectDataViewModel; @@ -388,6 +389,7 @@ public: const std::string& warning_icon_name = std::string()); void AddWarningIcon(const wxDataViewItem& item, const std::string& warning_name); void DeleteWarningIcon(const wxDataViewItem& item, const bool unmark_object = false); + bool HasWarningIcon(const wxDataViewItem& item) const; t_layer_height_range GetLayerRangeByItem(const wxDataViewItem& item) const; bool UpdateColumValues(unsigned col);