pruneItemLayers() is not the right place to filter refdes & value.

(And we already filter all mandatory fields in
pasteFootprintItemsToFootprintEditor() anyway.)

Also, don't nuke a footprint which contains only fields
during a paste.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17937
This commit is contained in:
Jeff Young 2024-05-03 18:37:13 +01:00
parent e3d2f338de
commit eb13dec265
1 changed files with 6 additions and 10 deletions

View File

@ -852,14 +852,7 @@ void PCB_CONTROL::pruneItemLayers( std::vector<BOARD_ITEM*>& aItems )
// NOTE: all traversals from the back as processFPItem() might delete the item
for( int ii = static_cast<int>( fp->Fields().size() ) - 1; ii >= 0; ii-- )
{
PCB_FIELD* field = fp->Fields()[ii];
if( field->GetId() == REFERENCE_FIELD || field->GetId() == VALUE_FIELD )
continue;
processFPItem( fp, field );
}
processFPItem( fp, fp->Fields()[ii] );
for( int ii = static_cast<int>( fp->Pads().size() ) - 1; ii >= 0; ii-- )
processFPItem( fp, fp->Pads()[ii] );
@ -870,7 +863,10 @@ void PCB_CONTROL::pruneItemLayers( std::vector<BOARD_ITEM*>& aItems )
for( int ii = static_cast<int>( fp->GraphicalItems().size() ) - 1; ii >= 0; ii-- )
processFPItem( fp, fp->GraphicalItems()[ii] );
if( fp->GraphicalItems().size() || fp->Pads().size() || fp->Zones().size() )
if( fp->Fields().size()
|| fp->GraphicalItems().size()
|| fp->Pads().size()
|| fp->Zones().size() )
{
returnItems.push_back( fp );
}
@ -1040,7 +1036,7 @@ int PCB_CONTROL::Paste( const TOOL_EVENT& aEvent )
cancelled = !placeBoardItems( &commit, pastedItems, true, true,
mode == PASTE_MODE::UNIQUE_ANNOTATIONS );
}
else
else // isBoardEditor
{
if( mode == PASTE_MODE::REMOVE_ANNOTATIONS )
{