From 019a731e03be096204f2e3e8084c920354dbb918 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sun, 5 May 2019 10:25:38 -0400 Subject: [PATCH] Back-propagate from child sheets when two parents point to one child --- eeschema/connection_graph.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp index fa3e682717..b40e3b148b 100644 --- a/eeschema/connection_graph.cpp +++ b/eeschema/connection_graph.cpp @@ -1386,6 +1386,7 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph ) { SCH_CONNECTION* conn = aSubgraph->m_driver_connection; std::vector children; + std::vector visited; auto add_children = [&] ( CONNECTION_SUBGRAPH* aParent ) { for( SCH_SHEET_PIN* pin : aParent->m_hier_pins ) @@ -1513,6 +1514,8 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph ) if( !aSubgraph->m_hier_ports.empty() ) return; + visited.push_back( aSubgraph ); + // If we are a bus, we must propagate to local neighbors and then the hierarchy if( conn->IsBus() ) propagate_bus_neighbors( aSubgraph ); @@ -1528,11 +1531,23 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph ) if( !child->m_dirty ) { - wxLogTrace( "CONN", "Child %lu (%s) is not dirty", + wxLogTrace( "CONN", "Child %lu (%s) is not dirty, backpropagating it", child->m_code, child->m_driver_connection->Name() ); + + for( CONNECTION_SUBGRAPH* subgraph : visited ) + { + subgraph->m_driver_connection->Clone( *child->m_driver_connection ); + subgraph->UpdateItemConnections(); + + if( conn->IsBus() ) + propagate_bus_neighbors( subgraph ); + } + continue; } + visited.push_back( child ); + // Check for grandchildren if( !child->m_hier_pins.empty() ) add_children( child );