From b2ecf097ed3f9fe50c1328c8b0c3e8235de191a9 Mon Sep 17 00:00:00 2001 From: Roberto Fernandez Bautista Date: Tue, 11 Jan 2022 20:47:37 +0000 Subject: [PATCH] Include Footprints within Groups when re annotating duplicates Fixes https://gitlab.com/kicad/code/kicad/-/issues/10329 (cherry picked from commit de7158b80e3a33d2ae9bd9480e50c3b70389f9b9) --- pcbnew/tools/board_reannotate_tool.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/pcbnew/tools/board_reannotate_tool.cpp b/pcbnew/tools/board_reannotate_tool.cpp index 9441140c37..33887e32dc 100644 --- a/pcbnew/tools/board_reannotate_tool.cpp +++ b/pcbnew/tools/board_reannotate_tool.cpp @@ -23,6 +23,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +#include #include #include #include @@ -85,6 +86,18 @@ int BOARD_REANNOTATE_TOOL::ReannotateDuplicates( const PCB_SELECTION& aSelection { if( item->Type() == PCB_FOOTPRINT_T ) fpOnBoard.push_back( static_cast( item ) ); + + if( item->Type() == PCB_GROUP_T ) + { + PCB_GROUP* group = static_cast( item ); + + group->RunOnDescendants( + [&]( BOARD_ITEM* aGroupItem ) + { + if( aGroupItem->Type() == PCB_FOOTPRINT_T ) + fpOnBoard.push_back( static_cast( aGroupItem ) ); + } ); + } } for( FOOTPRINT* fp : fpOnBoard ) @@ -97,6 +110,18 @@ int BOARD_REANNOTATE_TOOL::ReannotateDuplicates( const PCB_SELECTION& aSelection { if( item->Type() == PCB_FOOTPRINT_T ) fpInSelection.push_back( static_cast( item ) ); + + if( item->Type() == PCB_GROUP_T ) + { + PCB_GROUP* group = static_cast( item ); + + group->RunOnDescendants( + [&]( BOARD_ITEM* aGroupItem ) + { + if( aGroupItem->Type() == PCB_FOOTPRINT_T ) + fpInSelection.push_back( static_cast( aGroupItem ) ); + } ); + } } std::sort( fpInSelection.begin(), fpInSelection.end(),