From 60fe87a73cc1808867ff44a27a6901ab1d13895c Mon Sep 17 00:00:00 2001 From: Mike Williams Date: Mon, 19 Feb 2024 09:41:27 -0500 Subject: [PATCH] PCB: always parse ki_fp_filters as a property, not a field --- .../kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp index 8d44dd01c1..277d86a27f 100644 --- a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp +++ b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp @@ -4072,13 +4072,6 @@ FOOTPRINT* PCB_IO_KICAD_SEXPR_PARSER::parseFOOTPRINT_unchecked( wxArrayString* a break; } - if( pName == "ki_fp_filters" ) - { - footprint->SetFilters( pValue ); - NeedRIGHT(); - break; - } - // Sheet file and name used to be stored as properties invisible to the user if( pName == "Sheetfile" || pName == "Sheet file" ) { @@ -4095,6 +4088,21 @@ FOOTPRINT* PCB_IO_KICAD_SEXPR_PARSER::parseFOOTPRINT_unchecked( wxArrayString* a } } + // 8.0.0rc3 had a bug where these properties were mistakenly added to the footprint as fields, + // this will remove them as fields but still correctly set the footprint filters + if( pName == "ki_fp_filters" ) + { + footprint->SetFilters( pValue ); + + // Use the text effect parsing function because it will handle ki_fp_filters as a property + // with no text effects, but will also handle parsing the text effects. We just drop the effects + // if they're present. + PCB_FIELD ignored = PCB_FIELD( footprint.get(), footprint->GetFieldCount(), pName ); + parsePCB_TEXT_effects( &ignored ); + + break; + } + PCB_FIELD* field = nullptr; if( footprint->HasFieldByName( pName ) )