Select the copper layer before processing
If we are converting to tracks, the copper layer needs to be selected before any other elements are processed, otherwise, we end up with the default undefined layer Fixes https://gitlab.com/kicad/code/kicad/issues/11025
This commit is contained in:
parent
901c330478
commit
9396735733
|
@ -644,7 +644,7 @@ int CONVERT_TOOL::CreateLines( const TOOL_EVENT& aEvent )
|
||||||
FOOTPRINT_EDIT_FRAME* fpEditor = dynamic_cast<FOOTPRINT_EDIT_FRAME*>( m_frame );
|
FOOTPRINT_EDIT_FRAME* fpEditor = dynamic_cast<FOOTPRINT_EDIT_FRAME*>( m_frame );
|
||||||
FOOTPRINT* footprint = nullptr;
|
FOOTPRINT* footprint = nullptr;
|
||||||
PCB_LAYER_ID targetLayer = m_frame->GetActiveLayer();
|
PCB_LAYER_ID targetLayer = m_frame->GetActiveLayer();
|
||||||
PCB_LAYER_ID copperLayer = UNSELECTED_LAYER;
|
PCB_LAYER_ID copperLayer = F_Cu;
|
||||||
BOARD_ITEM_CONTAINER* parent = frame->GetModel();
|
BOARD_ITEM_CONTAINER* parent = frame->GetModel();
|
||||||
|
|
||||||
if( fpEditor )
|
if( fpEditor )
|
||||||
|
@ -685,6 +685,20 @@ int CONVERT_TOOL::CreateLines( const TOOL_EVENT& aEvent )
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if( aEvent.IsAction( &PCB_ACTIONS::convertToTracks ) )
|
||||||
|
{
|
||||||
|
if( !IsCopperLayer( targetLayer ) )
|
||||||
|
{
|
||||||
|
if( copperLayer == UNSELECTED_LAYER )
|
||||||
|
copperLayer = frame->SelectOneLayer( F_Cu, LSET::AllNonCuMask() );
|
||||||
|
|
||||||
|
if( copperLayer == UNDEFINED_LAYER ) // User canceled
|
||||||
|
return true;
|
||||||
|
|
||||||
|
targetLayer = copperLayer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for( EDA_ITEM* item : selection )
|
for( EDA_ITEM* item : selection )
|
||||||
{
|
{
|
||||||
if( handleGraphicSeg( item ) )
|
if( handleGraphicSeg( item ) )
|
||||||
|
@ -721,19 +735,6 @@ int CONVERT_TOOL::CreateLines( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if( !IsCopperLayer( targetLayer ) )
|
|
||||||
{
|
|
||||||
if( copperLayer == UNSELECTED_LAYER )
|
|
||||||
copperLayer = frame->SelectOneLayer( F_Cu, LSET::AllNonCuMask() );
|
|
||||||
|
|
||||||
if( copperLayer == UNDEFINED_LAYER ) // User canceled
|
|
||||||
continue;
|
|
||||||
|
|
||||||
targetLayer = copperLayer;
|
|
||||||
}
|
|
||||||
|
|
||||||
// I am really unsure converting a polygon to "tracks" (i.e. segments on
|
// I am really unsure converting a polygon to "tracks" (i.e. segments on
|
||||||
// copper layers) make sense for footprints, but anyway this code exists
|
// copper layers) make sense for footprints, but anyway this code exists
|
||||||
if( fpEditor )
|
if( fpEditor )
|
||||||
|
|
Loading…
Reference in New Issue