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* footprint = nullptr;
|
||||
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();
|
||||
|
||||
if( fpEditor )
|
||||
|
@ -685,6 +685,20 @@ int CONVERT_TOOL::CreateLines( const TOOL_EVENT& aEvent )
|
|||
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 )
|
||||
{
|
||||
if( handleGraphicSeg( item ) )
|
||||
|
@ -721,19 +735,6 @@ int CONVERT_TOOL::CreateLines( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
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
|
||||
// copper layers) make sense for footprints, but anyway this code exists
|
||||
if( fpEditor )
|
||||
|
|
Loading…
Reference in New Issue