Fix broken legacy file format symbol instance data import.

This commit is contained in:
Wayne Stambaugh 2022-10-19 12:22:55 -04:00
parent c64b4b8179
commit 85805bdad7
2 changed files with 21 additions and 7 deletions

View File

@ -431,7 +431,6 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
// Legacy schematic can have duplicate time stamps so fix that before converting
// to the s-expression format.
schematic.ReplaceDuplicateTimeStamps();
schematic.SetLegacySymbolInstanceData();
// Allow the schematic to be saved to new file format without making any edits.
OnModify();

View File

@ -1346,13 +1346,28 @@ SCH_SYMBOL* SCH_LEGACY_PLUGIN::loadSymbol( LINE_READER& aReader )
}
else if( strCompare( "$EndComp", line ) )
{
if( !m_appending && ( m_currentSheet == m_rootSheet ) )
if( !m_appending )
{
KIID_PATH path;
path.push_back( m_rootSheet->GetScreen()->GetUuid() );
symbol->AddHierarchicalReference( path,
symbol->GetField( REFERENCE_FIELD )->GetText(),
symbol->GetUnit() );
if( m_currentSheet == m_rootSheet )
{
KIID_PATH path;
path.push_back( m_rootSheet->GetScreen()->GetUuid() );
symbol->AddHierarchicalReference( path,
symbol->GetField( REFERENCE_FIELD )->GetText(),
symbol->GetUnit(),
symbol->GetField( VALUE_FIELD )->GetText(),
symbol->GetField( FOOTPRINT_FIELD )->GetText() );
}
else
{
for( const SYMBOL_INSTANCE_REFERENCE& instance : symbol->GetInstanceReferences() )
{
symbol->AddHierarchicalReference( instance.m_Path, instance.m_Reference,
instance.m_Unit,
symbol->GetField( VALUE_FIELD )->GetText(),
symbol->GetField( FOOTPRINT_FIELD )->GetText() );
}
}
}
// Ensure all flags (some are set by previous initializations) are reset: