Don't prune inner layers of through-hole parts.

For historical reasons we've always included ALL inner layers in these
items and changing that has uncovered several latent bugs.  Rather
than find all the rest this late in the game, I went back to storing
all inner layers, even those the board doesn't currently have.

Fixes https://gitlab.com/kicad/code/kicad/issues/12863
This commit is contained in:
Jeff Young 2022-11-09 15:56:54 +00:00
parent 63f937db85
commit 3f63f9fc57
2 changed files with 29 additions and 3 deletions

View File

@ -31,6 +31,9 @@
#include <pcb_edit_frame.h>
#include <board.h>
#include <collectors.h>
#include <footprint.h>
#include <pad.h>
#include <pcb_track.h>
#include <panel_setup_layers.h>
#include <board_stackup_manager/panel_board_stackup.h>
@ -523,12 +526,31 @@ bool PANEL_SETUP_LAYERS::TransferDataFromWindow()
LSET changedLayers = m_enabledLayers ^ previousEnabled;
/* Ensure enabled layers are also visible
* This is mainly to avoid mistakes if some enabled
* layers are not visible when exiting this dialog
/*
* Ensure enabled layers are also visible. This is mainly to avoid mistakes if some
* enabled layers are not visible when exiting this dialog.
*/
m_pcb->SetVisibleLayers( m_pcb->GetVisibleLayers() | changedLayers );
/*
* Ensure items with through holes have all inner copper layers. (For historical reasons
* this is NOT trimmed to the currently-enabled inner layers.)
*/
for( FOOTPRINT* fp : m_pcb->Footprints() )
{
for( PAD* pad : fp->Pads() )
{
if( pad->HasHole() && pad->IsOnCopperLayer() )
pad->SetLayerSet( pad->GetLayerSet() | LSET::InternalCuMask() );
}
}
for( PCB_TRACK* via : m_pcb->Tracks() )
{
if( via->HasHole() )
via->SetLayerSet( via->GetLayerSet() | LSET::InternalCuMask() );
}
modified = true;
}

View File

@ -731,6 +731,10 @@ void PCB_CONTROL::pruneItemLayers( std::vector<BOARD_ITEM*>& aItems )
if( allowed.any() )
{
// Don't prune internal copper layers on items with holes
if( aItem->HasHole() && aItem->IsOnCopperLayer() )
allowed |= LSET::InternalCuMask();
aItem->SetLayerSet( allowed );
}
else