From 5c54f40eaeae8ea3aea401c2847640fefbec32de Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 25 Feb 2022 00:08:21 +0000 Subject: [PATCH] Layer visibilities aren't stored in project for footprint editor. Fixes https://gitlab.com/kicad/code/kicad/issues/10953 --- pcbnew/tools/pcb_selection_tool.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/pcbnew/tools/pcb_selection_tool.cpp b/pcbnew/tools/pcb_selection_tool.cpp index e65ad30226..9b489222a2 100644 --- a/pcbnew/tools/pcb_selection_tool.cpp +++ b/pcbnew/tools/pcb_selection_tool.cpp @@ -2293,6 +2293,24 @@ bool PCB_SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibili { 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() ) { std::set activeLayers = settings->GetHighContrastLayers(); @@ -2388,7 +2406,7 @@ bool PCB_SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibili } // zones can exist on multiple layers! - if( !( zone->GetLayerSet() & board()->GetVisibleLayers() ).any() ) + if( !( zone->GetLayerSet() & visibleLayers() ).any() ) return false; break; @@ -2418,7 +2436,7 @@ bool PCB_SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibili via = static_cast( aItem ); // 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; 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 // 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; } 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 ) ) return false; - if( !( pad->GetLayerSet() & board()->GetVisibleLayers() ).any() ) + if( !( pad->GetLayerSet() & visibleLayers() ).any() ) return false; }