Rebuild groups as a separate pass (required for nested groups).

Fixes https://gitlab.com/kicad/code/kicad/issues/5858
This commit is contained in:
Jeff Young 2020-10-13 17:54:01 +01:00
parent e789ad9fb2
commit 04f61fb1f2
1 changed files with 9 additions and 2 deletions

View File

@ -128,12 +128,19 @@ MODULE::MODULE( const MODULE& aModule ) :
for( PCB_GROUP* group : aModule.Groups() )
{
PCB_GROUP* newGroup = static_cast<PCB_GROUP*>( group->Clone() );
ptrMap[ group ] = newGroup;
Add( newGroup );
}
// Rebuild groups
for( PCB_GROUP* group : aModule.Groups() )
{
PCB_GROUP* newGroup = static_cast<PCB_GROUP*>( ptrMap[ group ] );
const_cast<std::unordered_set<BOARD_ITEM*>*>( &newGroup->GetItems() )->clear();
for( BOARD_ITEM* member : group->GetItems() )
newGroup->AddItem( ptrMap[ member ] );
Add( newGroup );
}
// Copy auxiliary data: 3D_Drawings info