Incremental updates should not clear globals

Netclass assignments are stored in the project level but
CONNECTION_GRAPH updates would clear the assignments.  This keeps
existing netname->netclass assignments but updates any netnames that
were changed by the incremental updates.  Absolute updates are not
affected and fully recreate the net name to netclass map

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17720

(cherry picked from commit e538b98286)
This commit is contained in:
Seth Hillbrand 2024-04-11 15:55:58 -07:00
parent 55c864ec45
commit 26629928c3
2 changed files with 18 additions and 3 deletions

View File

@ -689,7 +689,7 @@ void CONNECTION_GRAPH::Recalculate( const SCH_SHEET_LIST& aSheetList, bool aUnco
PROF_TIMER build_graph( "buildConnectionGraph" );
buildConnectionGraph( aChangedItemHandler );
buildConnectionGraph( aChangedItemHandler, aUnconditional );
if( wxLog::IsAllowedTraceMask( DanglingProfileMask ) )
build_graph.Show();
@ -1928,7 +1928,7 @@ void CONNECTION_GRAPH::processSubGraphs()
// on some portion of the items.
void CONNECTION_GRAPH::buildConnectionGraph( std::function<void( SCH_ITEM* )>* aChangedItemHandler )
void CONNECTION_GRAPH::buildConnectionGraph( std::function<void( SCH_ITEM* )>* aChangedItemHandler, bool aUnconditional )
{
// Recache all bus aliases for later use
wxCHECK_RET( m_schematic, wxT( "Connection graph cannot be built without schematic pointer" ) );
@ -2286,6 +2286,17 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function<void( SCH_ITEM* )>* a
for( const auto& [ netname, subgraphs ] : m_net_name_to_subgraphs_map )
checkNetclassDrivers( subgraphs );
if( !aUnconditional )
{
for( auto& [ netname, netclass ] : oldAssignments )
{
if( netSettings->m_NetClassLabelAssignments.count( netname ) )
continue;
netSettings->m_NetClassLabelAssignments[ netname ] = netclass;
}
}
}

View File

@ -499,8 +499,12 @@ private:
* the driver is first selected by CONNECTION_SUBGRAPH::ResolveDrivers(),
* and then the connection for the chosen driver is propagated to all the
* other items in the subgraph.
*
* If the unconitional flag is set, all existing net classes will be removed
* and re-created. Otherwise, we will preserve existing net classes that do not
* conflict with the new net classes.
*/
void buildConnectionGraph( std::function<void( SCH_ITEM* )>* aChangedItemHandler );
void buildConnectionGraph( std::function<void( SCH_ITEM* )>* aChangedItemHandler, bool aUnconditional );
/**
* Generate individual item subgraphs on a per-sheet basis.