From 8060c30ba28dccc5bca98754b70df270a325185c Mon Sep 17 00:00:00 2001 From: Leonardo Date: Thu, 21 Dec 2017 14:12:01 -0800 Subject: [PATCH] Don't show parent models in the All Parts category. --- common/lc_partselectionwidget.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/common/lc_partselectionwidget.cpp b/common/lc_partselectionwidget.cpp index bf6661e3..6eeabeac 100644 --- a/common/lc_partselectionwidget.cpp +++ b/common/lc_partselectionwidget.cpp @@ -127,8 +127,22 @@ void lcPartSelectionListModel::SetCategory(int CategoryIndex) if (CategoryIndex != -1) Library->GetCategoryEntries(CategoryIndex, false, SingleParts, GroupedParts); else + { Library->GetParts(SingleParts); + lcModel* CurrentModel = lcGetActiveModel(); + + for (int PartIdx = 0; PartIdx < SingleParts.GetSize(); ) + { + PieceInfo* Info = SingleParts[PartIdx]; + + if (!Info->IsModel() || !Info->GetModel()->IncludesModel(CurrentModel)) + PartIdx++; + else + SingleParts.RemoveIndex(PartIdx); + } + } + auto lcPartSortFunc=[](PieceInfo* const& a, PieceInfo* const& b) { return strcmp(a->m_strDescription, b->m_strDescription);