From b6b52fee73becc2bac0af0e60aa031e14cf23571 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hejl?= Date: Fri, 16 Jul 2021 11:39:50 +0200 Subject: [PATCH] Fixed an issue when the object in the multi-material gizmo had the wrong default color when the multi-material gizmo was first time opened after loading a painted 3MF file with different extruders colors than in the printer profile in Slicer. --- src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp index 1a8bbd539a..1f0dbd137f 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp @@ -155,8 +155,8 @@ void GLGizmoMmuSegmentation::set_painter_gizmo_data(const Selection &selection) return; ModelObject *model_object = m_c->selection_info()->model_object(); - int prev_extruders_count = int(m_original_extruders_colors.size()); - if (prev_extruders_count != wxGetApp().extruders_edited_cnt() || get_extruders_colors() != m_original_extruders_colors) { + if (int prev_extruders_count = int(m_original_extruders_colors.size()); + prev_extruders_count != wxGetApp().extruders_edited_cnt() || get_extruders_colors() != m_original_extruders_colors) { if (wxGetApp().extruders_edited_cnt() > int(GLGizmoMmuSegmentation::EXTRUDERS_LIMIT)) show_notification_extruders_limit_exceeded(); @@ -555,6 +555,13 @@ void GLGizmoMmuSegmentation::init_model_triangle_selectors() void GLGizmoMmuSegmentation::update_from_model_object() { wxBusyCursor wait; + + // Extruder colors need to be reloaded before calling init_model_triangle_selectors to render painted triangles + // using colors from loaded 3MF and not from printer profile in Slicer. + if (int prev_extruders_count = int(m_original_extruders_colors.size()); + prev_extruders_count != wxGetApp().extruders_edited_cnt() || get_extruders_colors() != m_original_extruders_colors) + this->init_extruders_data(); + this->init_model_triangle_selectors(); }