diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index fd6a48b200..3631a4e732 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -808,7 +808,26 @@ void PCB_PARSER::resolveGroups( BOARD_ITEM* aParent ) item = getItem( aUuid ); if( item && item->Type() != NOT_USED ) - group->AddItem( item ); + { + switch( item->Type() ) + { + // We used to allow fp items in non-footprint groups. It was a mistake. + case PCB_FP_TEXT_T: + case PCB_FP_SHAPE_T: + case PCB_FP_ZONE_T: + if( item->GetParent() == group->GetParent() ) + group->AddItem( item ); + + break; + + // This is the deleted item singleton, which means we didn't find the uuid. + case NOT_USED: + break; + + default: + group->AddItem( item ); + } + } } } diff --git a/pcbnew/tools/group_tool.cpp b/pcbnew/tools/group_tool.cpp index b7d63955cd..f71d95b682 100644 --- a/pcbnew/tools/group_tool.cpp +++ b/pcbnew/tools/group_tool.cpp @@ -211,13 +211,46 @@ int GROUP_TOOL::PickNewMember( const TOOL_EVENT& aEvent ) int GROUP_TOOL::Group( const TOOL_EVENT& aEvent ) { - PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool(); - const PCB_SELECTION& selection = selTool->GetSelection(); - BOARD* board = getModel(); - PCB_GROUP* group = nullptr; + PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool(); + PCB_SELECTION selection; + + if( m_isFootprintEditor ) + { + selection = selTool->RequestSelection( + []( const VECTOR2I& , GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* ) + { + } ); + } + else + { + selection = selTool->RequestSelection( + []( const VECTOR2I& , GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* ) + { + // Iterate from the back so we don't have to worry about removals. + for( int i = aCollector.GetCount() - 1; i >= 0; --i ) + { + BOARD_ITEM* item = aCollector[ i ]; + + switch( item->Type() ) + { + case PCB_FP_TEXT_T: + case PCB_FP_SHAPE_T: + case PCB_FP_ZONE_T: + aCollector.Remove( item ); + break; + + default: + break; + } + } + } ); + } if( selection.Empty() ) - m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true ); + return 0; + + BOARD* board = getModel(); + PCB_GROUP* group = nullptr; if( m_isFootprintEditor ) {