Eeschema: fix partial schematic load bug in the legacy plugin.
Move the hierarchical sheet loading outside of the try exception block so that any sheets that were loaded when a schematic file load fails are loaded rather than skipped. This allows more of the schematic to be loaded when any parser errors occur.
This commit is contained in:
parent
e05f36f9a7
commit
1a8082c6d6
|
@ -693,21 +693,6 @@ void SCH_LEGACY_PLUGIN::loadHierarchy( SCH_SHEET* aSheet )
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
loadFile( fileName.GetFullPath(), aSheet->GetScreen() );
|
loadFile( fileName.GetFullPath(), aSheet->GetScreen() );
|
||||||
for( auto aItem : aSheet->GetScreen()->Items().OfType( SCH_SHEET_T ) )
|
|
||||||
{
|
|
||||||
assert( aItem->Type() == SCH_SHEET_T );
|
|
||||||
auto sheet = static_cast<SCH_SHEET*>( aItem );
|
|
||||||
|
|
||||||
// Set the parent to aSheet. This effectively creates a method to find
|
|
||||||
// the root sheet from any sheet so a pointer to the root sheet does not
|
|
||||||
// need to be stored globally. Note: this is not the same as a hierarchy.
|
|
||||||
// Complex hierarchies can have multiple copies of a sheet. This only
|
|
||||||
// provides a simple tree to find the root sheet.
|
|
||||||
sheet->SetParent( aSheet );
|
|
||||||
|
|
||||||
// Recursion starts here.
|
|
||||||
loadHierarchy( sheet );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch( const IO_ERROR& ioe )
|
catch( const IO_ERROR& ioe )
|
||||||
{
|
{
|
||||||
|
@ -721,6 +706,22 @@ void SCH_LEGACY_PLUGIN::loadHierarchy( SCH_SHEET* aSheet )
|
||||||
|
|
||||||
m_error += ioe.What();
|
m_error += ioe.What();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for( auto aItem : aSheet->GetScreen()->Items().OfType( SCH_SHEET_T ) )
|
||||||
|
{
|
||||||
|
wxCHECK2( aItem->Type() == SCH_SHEET_T, continue );
|
||||||
|
auto sheet = static_cast<SCH_SHEET*>( aItem );
|
||||||
|
|
||||||
|
// Set the parent to aSheet. This effectively creates a method to find
|
||||||
|
// the root sheet from any sheet so a pointer to the root sheet does not
|
||||||
|
// need to be stored globally. Note: this is not the same as a hierarchy.
|
||||||
|
// Complex hierarchies can have multiple copies of a sheet. This only
|
||||||
|
// provides a simple tree to find the root sheet.
|
||||||
|
sheet->SetParent( aSheet );
|
||||||
|
|
||||||
|
// Recursion starts here.
|
||||||
|
loadHierarchy( sheet );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_currentPath.pop();
|
m_currentPath.pop();
|
||||||
|
|
Loading…
Reference in New Issue