Added: PCB Variant support

Fixes https://gitlab.com/kicad/code/kicad/-/issues/2131
This commit is contained in:
Seth Hillbrand
2026-01-05 17:47:39 -08:00
parent c385767cd3
commit 6bad3c58e1
63 changed files with 6143 additions and 113 deletions
+15 -7
View File
@@ -401,6 +401,9 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItems( const FOOTPRINT* aFootprint )
if( !GetPlotFPText() )
return;
const wxString variantName = m_board ? m_board->GetCurrentVariant() : wxString();
const bool dnp = aFootprint->GetDNPForVariant( variantName );
const PCB_TEXT* reference = &aFootprint->Reference();
PCB_LAYER_ID refLayer = reference->GetLayer();
@@ -408,10 +411,10 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItems( const FOOTPRINT* aFootprint )
if( GetPlotReference()
&& m_layerMask[refLayer]
&& reference->IsVisible()
&& !( aFootprint->IsDNP() && hideDNPItems( refLayer ) ) )
&& !( dnp && hideDNPItems( refLayer ) ) )
{
PlotText( reference, refLayer, reference->IsKnockout(), reference->GetFontMetrics(),
aFootprint->IsDNP() && crossoutDNPItems( refLayer ) );
dnp && crossoutDNPItems( refLayer ) );
}
const PCB_TEXT* value = &aFootprint->Value();
@@ -420,7 +423,7 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItems( const FOOTPRINT* aFootprint )
if( GetPlotValue()
&& m_layerMask[valueLayer]
&& value->IsVisible()
&& !( aFootprint->IsDNP() && hideDNPItems( valueLayer ) ) )
&& !( dnp && hideDNPItems( valueLayer ) ) )
{
PlotText( value, valueLayer, value->IsKnockout(), value->GetFontMetrics(), false );
}
@@ -451,7 +454,7 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItems( const FOOTPRINT* aFootprint )
if( textLayer == Edge_Cuts || textLayer >= PCB_LAYER_ID_COUNT )
continue;
if( aFootprint->IsDNP() && hideDNPItems( textLayer ) )
if( dnp && hideDNPItems( textLayer ) )
continue;
if( !m_layerMask[textLayer] || aFootprint->GetPrivateLayers().test( textLayer ) )
@@ -462,7 +465,7 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItems( const FOOTPRINT* aFootprint )
if( !GetPlotReference() )
continue;
strikeout = aFootprint->IsDNP() && crossoutDNPItems( textLayer );
strikeout = dnp && crossoutDNPItems( textLayer );
}
if( text->GetText() == wxT( "${VALUE}" ) )
@@ -657,6 +660,9 @@ void BRDITEMS_PLOTTER::PlotPcbTarget( const PCB_TARGET* aMire )
void BRDITEMS_PLOTTER::PlotFootprintGraphicItems( const FOOTPRINT* aFootprint )
{
const wxString variantName = m_board ? m_board->GetCurrentVariant() : wxString();
const bool dnp = aFootprint->GetDNPForVariant( variantName );
for( const BOARD_ITEM* item : aFootprint->GraphicalItems() )
{
PCB_LAYER_ID itemLayer = item->GetLayer();
@@ -664,7 +670,7 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItems( const FOOTPRINT* aFootprint )
if( aFootprint->GetPrivateLayers().test( itemLayer ) )
continue;
if( aFootprint->IsDNP() && hideDNPItems( itemLayer ) )
if( dnp && hideDNPItems( itemLayer ) )
continue;
if( !( m_layerMask & item->GetLayerSet() ).any() )
@@ -941,6 +947,8 @@ void BRDITEMS_PLOTTER::PlotShape( const PCB_SHAPE* aShape )
const FOOTPRINT* parentFP = aShape->GetParentFootprint();
GBR_METADATA gbr_metadata;
const wxString variantName = m_board ? m_board->GetCurrentVariant() : wxString();
const bool parentDnp = parentFP ? parentFP->GetDNPForVariant( variantName ) : false;
if( parentFP )
{
@@ -948,7 +956,7 @@ void BRDITEMS_PLOTTER::PlotShape( const PCB_SHAPE* aShape )
gbr_metadata.SetNetAttribType( GBR_NETLIST_METADATA::GBR_NETINFO_CMP );
}
if( parentFP && parentFP->IsDNP() && GetSketchDNPFPsOnFabLayers() )
if( parentFP && parentDnp && GetSketchDNPFPsOnFabLayers() )
{
if( aShape->GetLayer() == F_Fab || aShape->GetLayer() == B_Fab )
{