Include Footprints within Groups when re annotating duplicates

Fixes https://gitlab.com/kicad/code/kicad/-/issues/10329
This commit is contained in:
Roberto Fernandez Bautista 2022-01-11 20:47:37 +00:00
parent 3d8288f919
commit de7158b80e
1 changed files with 25 additions and 0 deletions

View File

@ -23,6 +23,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <pcb_group.h>
#include <refdes_utils.h>
#include <string_utils.h>
#include <tool/tool_manager.h>
@ -85,6 +86,18 @@ int BOARD_REANNOTATE_TOOL::ReannotateDuplicates( const PCB_SELECTION& aSelection
{
if( item->Type() == PCB_FOOTPRINT_T )
fpOnBoard.push_back( static_cast<FOOTPRINT*>( item ) );
if( item->Type() == PCB_GROUP_T )
{
PCB_GROUP* group = static_cast<PCB_GROUP*>( item );
group->RunOnDescendants(
[&]( BOARD_ITEM* aGroupItem )
{
if( aGroupItem->Type() == PCB_FOOTPRINT_T )
fpOnBoard.push_back( static_cast<FOOTPRINT*>( 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<FOOTPRINT*>( item ) );
if( item->Type() == PCB_GROUP_T )
{
PCB_GROUP* group = static_cast<PCB_GROUP*>( item );
group->RunOnDescendants(
[&]( BOARD_ITEM* aGroupItem )
{
if( aGroupItem->Type() == PCB_FOOTPRINT_T )
fpInSelection.push_back( static_cast<FOOTPRINT*>( aGroupItem ) );
} );
}
}
std::sort( fpInSelection.begin(), fpInSelection.end(),