From f525c6ae35ae36a40146b9992ce25aefde1f1cc4 Mon Sep 17 00:00:00 2001 From: "zhou.xu" Date: Tue, 23 Apr 2024 10:47:04 +0800 Subject: [PATCH] FIX: add filament should reset ComboBox jira: STUDIO-6937 Change-Id: Ifabd27d1d74369245edbb47b095fcd448b6626fc --- src/slic3r/GUI/ObjColorDialog.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/ObjColorDialog.cpp b/src/slic3r/GUI/ObjColorDialog.cpp index 2b13c4857..d872d9b18 100644 --- a/src/slic3r/GUI/ObjColorDialog.cpp +++ b/src/slic3r/GUI/ObjColorDialog.cpp @@ -395,8 +395,9 @@ void ObjColorPanel::update_filament_ids() { if (m_is_add_filament) { for (auto c:m_new_add_colors) { - auto evt = new ColorEvent(EVT_ADD_CUSTOM_FILAMENT, c); - wxQueueEvent(wxGetApp().plater(), evt); + /*auto evt = new ColorEvent(EVT_ADD_CUSTOM_FILAMENT, c); + wxQueueEvent(wxGetApp().plater(), evt);*/ + wxGetApp().sidebar().add_custom_filament(c); } } //deal m_filament_ids @@ -725,15 +726,17 @@ void ObjColorPanel::deal_default_strategy() void ObjColorPanel::deal_add_btn() { if (m_colours.size() > g_max_color) { return; } + deal_reset_btn(); std::vector new_icons; auto new_color_size = m_cluster_colors_from_algo.size(); new_icons.reserve(new_color_size); m_new_add_colors.clear(); m_new_add_colors.reserve(new_color_size); int new_index = m_colours.size() + 1; + bool is_exceed = false; for (size_t i = 0; i < new_color_size; i++) { if (m_colours.size() + new_icons.size() >= g_max_color) { - m_warning_text->SetLabelText(_L("Waring:The count of newly added and \n current extruders exceeds 16.")); + is_exceed = true; break; } wxColour cur_color = convert_to_wxColour(m_cluster_colors_from_algo[i]); @@ -753,6 +756,10 @@ void ObjColorPanel::deal_add_btn() m_cluster_map_filaments[i] = new_index; new_index++; } + if (is_exceed) { + deal_approximate_match_btn(); + m_warning_text->SetLabelText(_L("Waring:The count of newly added and \n current extruders exceeds 16.")); + } m_is_add_filament = true; }