7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 00:21:25 +00:00

Fix annotation issue loading legacy schematics.

Commit 83de056de9 broke loading legacy schematics that are not shared.
Legacy schematics do not contain instance data "AR Path=" entries when
the schematic file was not shared.  The reference and unit information
was only stored in the symbol reference field and unit entries in the
symbol definition.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18779
This commit is contained in:
Wayne Stambaugh 2024-09-26 12:22:57 -04:00
parent 0e788f97ca
commit 21dd41eeb2

View File

@ -686,7 +686,19 @@ void SCH_SHEET_PATH::CheckForMissingSymbolInstances( const wxString& aProjectNam
"sheet path '%s'.",
symbol->m_Uuid.AsString(), PathHumanReadable( false ) );
symbolInstance.m_Reference = UTIL::GetRefDesUnannotated( symbol->GetPrefix() );
// Legacy schematics that are not shared do not contain separate instance data.
// The symbol refrence and unit are saved in the reference field and unit entries.
if( ( LastScreen()->GetRefCount() <= 1 ) &&
( LastScreen()->GetFileFormatVersionAtLoad() <= 20200310 ) )
{
symbolInstance.m_Reference =
symbol->GetField( REFERENCE_FIELD )->GetShownText( this, true );
}
else
{
symbolInstance.m_Reference = UTIL::GetRefDesUnannotated( symbol->GetPrefix() );
}
symbolInstance.m_ProjectName = aProjectName;
symbolInstance.m_Path = Path();
symbol->AddHierarchicalReference( symbolInstance );