diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp index d63feb4e7..1c7210e7d 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp @@ -383,7 +383,8 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott float start_pos_x = ImGui::GetCursorPos().x; const ImVec2 max_label_size = ImGui::CalcTextSize("99", NULL, true); const float item_spacing = m_imgui->scaled(0.8f); - for (int extruder_idx = 0; extruder_idx < m_extruders_colors.size(); extruder_idx++) { + size_t n_extruder_colors = std::min((size_t)EnforcerBlockerType::ExtruderMax, m_extruders_colors.size()); + for (int extruder_idx = 0; extruder_idx < n_extruder_colors; extruder_idx++) { const std::array &extruder_color = m_extruders_colors[extruder_idx]; ImVec4 color_vec(extruder_color[0], extruder_color[1], extruder_color[2], extruder_color[3]); std::string color_label = std::string("##extruder color ") + std::to_string(extruder_idx); @@ -689,7 +690,7 @@ void GLGizmoMmuSegmentation::init_model_triangle_selectors() const TriangleMesh* mesh = &mv->mesh(); m_triangle_selectors.emplace_back(std::make_unique(*mesh, ebt_colors, 0.2)); // Reset of TriangleSelector is done inside TriangleSelectorMmGUI's constructor, so we don't need it to perform it again in deserialize(). - m_triangle_selectors.back()->deserialize(mv->mmu_segmentation_facets.get_data(), false); + m_triangle_selectors.back()->deserialize(mv->mmu_segmentation_facets.get_data(), false, (EnforcerBlockerType)m_extruders_colors.size()); m_triangle_selectors.back()->request_update_render_data(); m_volumes_extruder_idxs.push_back(mv->extruder_id()); } diff --git a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp index 0d09e4036..cf1ad0e4d 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp @@ -1091,7 +1091,7 @@ void TriangleSelectorPatch::render(ImGuiWrapper* imgui) void TriangleSelectorPatch::update_triangles_per_type() { - m_triangle_patches.resize((int)EnforcerBlockerType::ExtruderMax); + m_triangle_patches.resize((int)EnforcerBlockerType::ExtruderMax + 1); for (int i = 0; i < m_triangle_patches.size(); i++) { auto& patch = m_triangle_patches[i]; patch.type = (EnforcerBlockerType)i;