Layer visibilities aren't stored in project for footprint editor.

Fixes https://gitlab.com/kicad/code/kicad/issues/10953
This commit is contained in:
Jeff Young 2022-02-25 00:08:21 +00:00
parent 639fdb915a
commit 5c54f40eae
1 changed files with 22 additions and 4 deletions

View File

@ -2293,6 +2293,24 @@ bool PCB_SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibili
{ {
const RENDER_SETTINGS* settings = getView()->GetPainter()->GetSettings(); const RENDER_SETTINGS* settings = getView()->GetPainter()->GetSettings();
auto visibleLayers =
[&]()
{
if( m_isFootprintEditor )
{
LSET set;
for( PCB_LAYER_ID layer : LSET::AllLayersMask().Seq() )
set.set( layer, view()->IsLayerVisible( layer ) );
return set;
}
else
{
return board()->GetVisibleLayers();
}
};
if( settings->GetHighContrast() ) if( settings->GetHighContrast() )
{ {
std::set<unsigned int> activeLayers = settings->GetHighContrastLayers(); std::set<unsigned int> activeLayers = settings->GetHighContrastLayers();
@ -2388,7 +2406,7 @@ bool PCB_SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibili
} }
// zones can exist on multiple layers! // zones can exist on multiple layers!
if( !( zone->GetLayerSet() & board()->GetVisibleLayers() ).any() ) if( !( zone->GetLayerSet() & visibleLayers() ).any() )
return false; return false;
break; break;
@ -2418,7 +2436,7 @@ bool PCB_SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibili
via = static_cast<const PCB_VIA*>( aItem ); via = static_cast<const PCB_VIA*>( aItem );
// For vias it is enough if only one of its layers is visible // For vias it is enough if only one of its layers is visible
if( !( board()->GetVisibleLayers() & via->GetLayerSet() ).any() ) if( !( visibleLayers() & via->GetLayerSet() ).any() )
return false; return false;
break; break;
@ -2480,7 +2498,7 @@ bool PCB_SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibili
// A pad's hole is visible on every layer the pad is visible on plus many layers the // A pad's hole is visible on every layer the pad is visible on plus many layers the
// pad is not visible on -- so we only need to check for any visible hole layers. // pad is not visible on -- so we only need to check for any visible hole layers.
if( !( board()->GetVisibleLayers() & LSET::PhysicalLayersMask() ).any() ) if( !( visibleLayers() & LSET::PhysicalLayersMask() ).any() )
return false; return false;
} }
else else
@ -2491,7 +2509,7 @@ bool PCB_SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibili
else if( pad->IsOnLayer( B_Cu ) && !board()->IsElementVisible( LAYER_PAD_BK ) ) else if( pad->IsOnLayer( B_Cu ) && !board()->IsElementVisible( LAYER_PAD_BK ) )
return false; return false;
if( !( pad->GetLayerSet() & board()->GetVisibleLayers() ).any() ) if( !( pad->GetLayerSet() & visibleLayers() ).any() )
return false; return false;
} }