From 5574f35473cddfed227490f02a14ae365fbf10fd Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 15 Apr 2023 16:51:10 +0100 Subject: [PATCH] Apply symbol attributes from base symbol, not derived symbol. Fixes https://gitlab.com/kicad/code/kicad/issues/13740 (cherry picked from commit d4b4abd0013f02803a0258012ca3a29bbba5da2b) --- eeschema/dialogs/dialog_change_symbols.cpp | 6 ++++-- eeschema/lib_symbol.cpp | 4 ++++ eeschema/sch_symbol.cpp | 9 ++++----- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/eeschema/dialogs/dialog_change_symbols.cpp b/eeschema/dialogs/dialog_change_symbols.cpp index b31a40c3a7..02200b3a00 100644 --- a/eeschema/dialogs/dialog_change_symbols.cpp +++ b/eeschema/dialogs/dialog_change_symbols.cpp @@ -589,8 +589,10 @@ int DIALOG_CHANGE_SYMBOLS::processSymbols( const std::mapGetValue() ) { - symbol->SetIncludeInBom( libSymbol->GetIncludeInBom() ); - symbol->SetIncludeOnBoard( libSymbol->GetIncludeOnBoard() ); + // Fetch the attributes from the *flattened* library symbol. They are not supported + // in derived symbols. + symbol->SetIncludeInBom( symbol->GetLibSymbolRef()->GetIncludeInBom() ); + symbol->SetIncludeOnBoard( symbol->GetLibSymbolRef()->GetIncludeOnBoard() ); } bool removeExtras = m_removeExtraBox->GetValue(); diff --git a/eeschema/lib_symbol.cpp b/eeschema/lib_symbol.cpp index bbdfbbce2d..d28b682a67 100644 --- a/eeschema/lib_symbol.cpp +++ b/eeschema/lib_symbol.cpp @@ -512,6 +512,10 @@ std::unique_ptr< LIB_SYMBOL > LIB_SYMBOL::Flatten() const retv->SetKeyWords( m_keyWords.IsEmpty() ? parent->GetKeyWords() : m_keyWords ); retv->SetDescription( m_description.IsEmpty() ? parent->GetDescription() : m_description ); retv->SetFPFilters( m_fpFilters.IsEmpty() ? parent->GetFPFilters() : m_fpFilters ); + + retv->SetIncludeInBom( parent->GetIncludeInBom() ); + retv->SetIncludeOnBoard( parent->GetIncludeOnBoard() ); + retv->UpdateFieldOrdinals(); } else diff --git a/eeschema/sch_symbol.cpp b/eeschema/sch_symbol.cpp index ae725220a7..851485ab3d 100644 --- a/eeschema/sch_symbol.cpp +++ b/eeschema/sch_symbol.cpp @@ -137,13 +137,12 @@ SCH_SYMBOL::SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId, m_prefix = UTIL::GetRefDesPrefix( m_part->GetReferenceField().GetText() ); if( aSheet ) - { SetRef( aSheet, UTIL::GetRefDesUnannotated( m_prefix ) ); - } - // Inherit the include in bill of materials and board netlist settings from library symbol. - m_inBom = aSymbol.GetIncludeInBom(); - m_onBoard = aSymbol.GetIncludeOnBoard(); + // Inherit the include in bill of materials and board netlist settings from flattened + // library symbol. + m_inBom = m_part->GetIncludeInBom(); + m_onBoard = m_part->GetIncludeOnBoard(); m_DNP = false; }