From 4e2f84727c0b93bd3011d0782391fd037b8a3cc7 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 15 Sep 2025 18:09:25 +0100 Subject: [PATCH] ADDED: support for multiple footprints in the footprint json from HTTP libraries These are semi-colon-separated. This is different from the footprint_filters dict entry, which is space-separated. The first footprint in the footprint dict entry will go into the "Footprint" field, while the rest will go into the symbol's footprint filters. (cherry picked from commit 91405ae34d7faa27a1462a6dfbe602cf184b9e3f) --- eeschema/sch_io/http_lib/sch_io_http_lib.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/eeschema/sch_io/http_lib/sch_io_http_lib.cpp b/eeschema/sch_io/http_lib/sch_io_http_lib.cpp index 140bc56588..c2245f2646 100644 --- a/eeschema/sch_io/http_lib/sch_io_http_lib.cpp +++ b/eeschema/sch_io/http_lib/sch_io_http_lib.cpp @@ -405,14 +405,23 @@ LIB_SYMBOL* SCH_IO_HTTP_LIB::loadSymbolFromPart( const wxString& aSymbolName, symbol->SetExcludedFromBoard( aPart.exclude_from_board ); symbol->SetExcludedFromSim( aPart.exclude_from_sim ); + wxArrayString fp_filters; + for( auto& [fieldName, fieldProperties] : aPart.fields ) { wxString lowerFieldName = wxString( fieldName ).Lower(); if( lowerFieldName == footprint_field ) { - SCH_FIELD* field = &symbol->GetFootprintField(); - field->SetText( std::get<0>( fieldProperties ) ); + SCH_FIELD* field = &symbol->GetFootprintField(); + wxStringTokenizer tokenizer( std::get<0>( fieldProperties ), ';' ); + + while( tokenizer.HasMoreTokens() ) + fp_filters.Add( tokenizer.GetNextToken() ); + + if( fp_filters.size() > 0 ) + field->SetText( fp_filters[0] ); + field->SetVisible( std::get<1>( fieldProperties ) ); } else if( lowerFieldName == description_field ) @@ -476,12 +485,10 @@ LIB_SYMBOL* SCH_IO_HTTP_LIB::loadSymbolFromPart( const wxString& aSymbolName, symbol->SetDescription( aPart.desc ); symbol->SetKeyWords( aPart.keywords ); - wxArrayString filters; - for( const std::string& filter : aPart.fp_filters ) - filters.push_back( filter ); + fp_filters.push_back( filter ); - symbol->SetFPFilters( filters ); + symbol->SetFPFilters( fp_filters ); return symbol; }