Update allow-solder-mask-bridges when updating footprint from library.

Fixes https://gitlab.com/kicad/code/kicad/issues/14422
This commit is contained in:
Jeff Young 2023-03-26 13:27:24 +01:00
parent 04f6f04bed
commit 2443bc6e29
1 changed files with 26 additions and 4 deletions

View File

@ -2227,6 +2227,7 @@ void PCB_EDIT_FRAME::ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew,
resetTextLayers, resetTextEffects, aUpdated ); resetTextLayers, resetTextEffects, aUpdated );
// Copy fields in accordance with the reset* flags // Copy fields in accordance with the reset* flags
for( BOARD_ITEM* item : aExisting->GraphicalItems() ) for( BOARD_ITEM* item : aExisting->GraphicalItems() )
{ {
FP_TEXT* srcItem = dyn_cast<FP_TEXT*>( item ); FP_TEXT* srcItem = dyn_cast<FP_TEXT*>( item );
@ -2247,12 +2248,33 @@ void PCB_EDIT_FRAME::ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew,
} }
} }
if( !resetFabricationAttrs ) if( resetFabricationAttrs )
aNew->SetAttributes( aExisting->GetAttributes() ); {
// We've replaced the existing footprint with the library one, so the fabrication attrs
// are already reset.
//
// We only have to do anything if resetFabricationAttrs is *not* set....
}
else
{
// Careful; allow-soldermask-bridges is in the m_attributes field but is not presented
// as a fabrication attribute in the GUI....
int libraryFlagsToKeep = aNew->GetAttributes() & FP_ALLOW_SOLDERMASK_BRIDGES;
int existingFlagsToKeep = aExisting->GetAttributes() & ~FP_ALLOW_SOLDERMASK_BRIDGES;
aNew->SetAttributes( existingFlagsToKeep | libraryFlagsToKeep );
}
// Copy 3D model settings in accordance with the reset* flag if( reset3DModels )
if( !reset3DModels ) {
// We've replaced the existing footprint with the library one, so the 3D models are
// already reset.
//
// We only have to do anything if reset3DModels is *not* set....
}
else
{
aNew->Models() = aExisting->Models(); // Linked list of 3D models. aNew->Models() = aExisting->Models(); // Linked list of 3D models.
}
// Updating other parameters // Updating other parameters
const_cast<KIID&>( aNew->m_Uuid ) = aExisting->m_Uuid; const_cast<KIID&>( aNew->m_Uuid ) = aExisting->m_Uuid;